From 809551a5fed82c75ed393e61b6c7014ad5479751 Mon Sep 17 00:00:00 2001 From: Kate Date: Sun, 8 Aug 2021 16:25:14 +0100 Subject: [PATCH] depexts: Disable the detection of available packages on RHEL-based distributions --- master_changes.md | 4 ++++ src/state/opamSysInteract.ml | 28 ++++------------------------ 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/master_changes.md b/master_changes.md index df5e48a4aef..8d2b7ef3833 100644 --- a/master_changes.md +++ b/master_changes.md @@ -61,6 +61,10 @@ users) ## External dependencies * Set DEBIAN_FRONTEND=noninteractive for unsafe-yes confirmation level [#4735 @dra27 - partially fix #4731] [2.1.0~rc2 #4739] * Fix depext alpine tagged repositories handling [#4763 @rjbou] [2.1.0~rc2 #4758] + * Disable the detection of available packages on RHEL-based distributions. + This fixes an issue on RHEL-based distributions where yum list used to detect available + and installed packages would wait for user input without showing any output and/or fail + in some cases [#4791 @kit-ty-kate - fixes #4790] ## Format upgrade * Fix format upgrade when there is missing local switches in the config file [#4763 @rjbou - fix #4713] [2.1.0~rc2 #4715] diff --git a/src/state/opamSysInteract.ml b/src/state/opamSysInteract.ml index 9ae0aa713c4..d5e5a4bc0a5 100644 --- a/src/state/opamSysInteract.ml +++ b/src/state/opamSysInteract.ml @@ -286,30 +286,9 @@ let packages_status packages = in compute_sets sys_installed ~sys_available | Centos -> - (* XXX /!\ only checked on centos XXX *) - let lines = run_query_command "yum" ["-q"; "-C"; "list"] in - (* -C to retrieve from cache, no update but still quite long, 1,5 sec *) - (* Return a list of installed packages then available ones: - >Installed Packages - >foo.arch version repo - >Available Packages - >bar.arch version repo - *) - let sys_installed, sys_available, _ = - List.fold_left (fun (inst,avail,part) -> function - (* beware of locales!! *) - | "Installed Packages" -> inst, avail, `installed - | "Available Packages" -> inst, avail, `available - | l -> - (match part, OpamStd.String.split l '.' with - | `installed, pkg::_ -> - pkg +++ inst, avail, part - | `available, pkg::_ -> - inst, pkg +++ avail, part - | _ -> (* shouldn't happen *) inst, avail, part)) - OpamSysPkg.Set.(empty, empty, `preamble) lines - in - compute_sets sys_installed ~sys_available + let lines = run_query_command "rpm" ["-qa"; "--qf"; "%{NAME}\\n"] in + let sys_installed = OpamSysPkg.Set.of_list (List.map OpamSysPkg.of_string lines) in + compute_sets sys_installed | Debian -> let sys_available, sys_provides, _ = let provides_sep = Re.(compile @@ str ", ") in @@ -582,6 +561,7 @@ let install_packages_commands_t sys_packages = | Arch -> ["pacman", "-Su"::yes ["--noconfirm"] packages], None | Centos -> (* TODO: check if they all declare "rhel" as primary family *) + (* Kate's answer: no they don't :( (e.g. Fedora, Oraclelinux define Nothing and "fedora" respectively) *) (* When opam-packages specify the epel-release package, usually it means that other dependencies require the EPEL repository to be already setup when yum-install is called. Cf. opam-depext/#70,#76. *)