Skip to content

Commit

Permalink
Fallback on dnf if yum does not exist on RHEL-based systems (backports
Browse files Browse the repository at this point in the history
…#4825)

Co-authored-by: R. Boujbel <[email protected]>
  • Loading branch information
kit-ty-kate and rjbou committed Nov 19, 2021
1 parent 838b017 commit a53bbb0
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
16 changes: 16 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,22 @@ New option/command/subcommand are prefixed with ◈.

## 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]
* 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]
* Archlinux: handle virtual package detection [#4831 @rjbou - partial fix #4759]
* Fallback on dnf if yum does not exist on RHEL-based systems [#4825 @kit-ty-kate]

## Format upgrade
* Fix format upgrade when there is missing local switches in the config file [#4763 @rjbou - fix #4713] [2.1.0~rc2 #4715]
* Fix not recorded local switch handling, with format upgrade [#4763 @rjbou] [2.1.0~rc2 #4715]
* Set opam root version to 2.1 [#4763 @rjbou] [2.1.0~rc2 #4715]
* Fix 2.1~alpha2 to 2.1 format upgrade with reinit [#4763 @rjbou - fix #4748] [2.1.0~rc2 #4750]
* Fix bypass-check handling on reinit [#4750 @rjbou] [#4763 @rjbou] [2.1.0~rc2 #4750 #4756]

## Sandbox
*
Expand Down
14 changes: 11 additions & 3 deletions src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,14 @@ let family =
) in
fun () -> Lazy.force family

let yum_cmd = lazy begin
if OpamSystem.resolve_command "yum" <> None then
"yum"
else if OpamSystem.resolve_command "dnf" <> None then
"dnf"
else
raise (OpamSystem.Command_not_found "yum or dnf")
end

let packages_status packages =
let (+++) pkg set = OpamSysPkg.Set.add (OpamSysPkg.of_string pkg) set in
Expand Down Expand Up @@ -635,11 +643,11 @@ let install_packages_commands_t sys_packages =
let epel_release = "epel-release" in
let install_epel rest =
if List.mem epel_release packages then
["yum", "install"::yes ["-y"] [epel_release]] @ rest
[Lazy.force yum_cmd, "install"::yes ["-y"] [epel_release]] @ rest
else rest
in
install_epel
["yum", "install"::yes ["-y"]
[Lazy.force yum_cmd, "install"::yes ["-y"]
(OpamStd.String.Set.of_list packages
|> OpamStd.String.Set.remove epel_release
|> OpamStd.String.Set.elements);
Expand Down Expand Up @@ -704,7 +712,7 @@ let update () =
match family () with
| Alpine -> Some ("apk", ["update"])
| Arch -> Some ("pacman", ["-Sy"])
| Centos -> Some ("yum", ["makecache"])
| Centos -> Some (Lazy.force yum_cmd, ["makecache"])
| Debian -> Some ("apt-get", ["update"])
| Gentoo -> Some ("emerge", ["--sync"])
| Homebrew -> Some ("brew", ["update"])
Expand Down

0 comments on commit a53bbb0

Please sign in to comment.