Skip to content

Commit d49929d

Browse files
committed
depexts: Disable the detection of available packages on SUSE-based distributions
1 parent e1f60b9 commit d49929d

File tree

2 files changed

+4
-38
lines changed

2 files changed

+4
-38
lines changed

master_changes.md

+3
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ users)
113113
* Relax lookup on OpenBSD to consider all installed packages [#6362 @semarie]
114114
* Speedup the detection of available system packages with pacman and brew [#6324 @kit-ty-kate]
115115
* The system GNU Patch and diff are no longer runtime dependencies of opam [#5892 @kit-ty-kate - fix #6052]
116+
* Change probing tool for SUSE-based distributions from `zypper` to `rpm` [#6464 @kit-ty-kate]
117+
* Disable the detection of available system packages on SUSE-based distributions [#6464 @kit-ty-kate]
116118

117119
## Format upgrade
118120

@@ -277,6 +279,7 @@ users)
277279
* `OpamStateConfig`: Make the `?lock_kind` parameters non-optional to avoid breaking the library users after they upgrade their opam root [#5488 @kit-ty-kate]
278280
* `OpamSwitchState.load_selections`: Make the `?lock_kind` parameter non-optional to avoid breaking the library users after they upgrade their opam root [#5488 @kit-ty-kate]
279281
* `OpamSysInteract.Cygwin.check_setup`: unexpose the function [#6467 @kit-ty-kate]
282+
* `OpamSysInteract.package_status`: SUSE-based distributions now uses `rpm` instead of `zypper` and no longer return an `available` set of system packages [#6464 @kit-ty-kate]
280283

281284
## opam-solver
282285

src/state/opamSysInteract.ml

+1-38
Original file line numberDiff line numberDiff line change
@@ -509,17 +509,6 @@ let packages_status ?(env=OpamVariable.Map.empty) config packages =
509509
Re.(Group.get (exec re_pkg l) 1) +++ pkgs
510510
with Not_found -> pkgs) OpamSysPkg.Set.empty
511511
in
512-
let with_regexp_dbl ~re_installed ~re_pkg =
513-
List.fold_left (fun (inst,avail) l ->
514-
try
515-
let pkg = Re.(Group.get (exec re_pkg l) 1) in
516-
if Re.execp re_installed l then
517-
pkg +++ inst, avail
518-
else
519-
inst, pkg +++ avail
520-
with Not_found -> inst, avail)
521-
OpamSysPkg.Set.(empty, empty)
522-
in
523512
let package_set_of_pkgpath l =
524513
List.fold_left (fun set pkg ->
525514
let short_name =
@@ -705,7 +694,7 @@ let packages_status ?(env=OpamVariable.Map.empty) config packages =
705694
compute_sets sys_installed ~sys_available
706695
| Arch ->
707696
compute_sets_for_arch ~pacman:"pacman"
708-
| Centos | Altlinux ->
697+
| Centos | Altlinux | Suse ->
709698
(* Output format:
710699
>crypto-policies
711700
>python3-pip-wheel
@@ -983,32 +972,6 @@ let packages_status ?(env=OpamVariable.Map.empty) config packages =
983972
|> package_set_of_pkgpath
984973
in
985974
compute_sets sys_installed
986-
| Suse ->
987-
(* get the second column of the table:
988-
zypper --quiet se -i -t package|grep '^i '|awk -F'|' '{print $2}'|xargs echo
989-
output:
990-
>S | Name | Summary
991-
>--+-----------------------------+-------------
992-
> | go-gosqlite | Trivial SQLi
993-
>i | libqt4-sql-sqlite-32bit | Qt 4 sqlite
994-
*)
995-
let re_pkg =
996-
Re.(compile @@ seq
997-
[ bol;
998-
rep1 any;
999-
char '|';
1000-
rep1 space;
1001-
group @@ rep1 @@ alt [alnum; punct];
1002-
rep1 space;
1003-
char '|';
1004-
])
1005-
in
1006-
let re_installed = Re.(compile @@ seq [bol ; char 'i']) in
1007-
let sys_installed, sys_available =
1008-
run_query_command "zypper" ["--quiet"; "se"; "-t"; "package"]
1009-
|> with_regexp_dbl ~re_installed ~re_pkg
1010-
in
1011-
compute_sets sys_installed ~sys_available
1012975

1013976
(* Install *)
1014977

0 commit comments

Comments
 (0)