diff --git a/master_changes.md b/master_changes.md index ca1b6fd6178..5c2739a6212 100644 --- a/master_changes.md +++ b/master_changes.md @@ -63,6 +63,10 @@ users) * 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] * Homebrew: Add support for casks and full-names [#4801 @kit-ty-kate] + * 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 2e60b266558..5de7446f746 100644 --- a/src/state/opamSysInteract.ml +++ b/src/state/opamSysInteract.ml @@ -286,30 +286,16 @@ 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 + (* Output format: + >crypto-policies + >python3-pip-wheel *) - 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 + let sys_installed = + run_query_command "rpm" ["-qa"; "--qf"; "%{NAME}\\n"] + |> List.map OpamSysPkg.of_string + |> OpamSysPkg.Set.of_list in - compute_sets sys_installed ~sys_available + compute_sets sys_installed | Debian -> let sys_available, sys_provides, _ = let provides_sep = Re.(compile @@ str ", ") in @@ -589,6 +575,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. *)