diff --git a/CHANGES.md b/CHANGES.md index 83e14f51..215ab04e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,7 @@ unreleased ---------- +- Switch from yum to DNF for Fedora, CentOS and OracleLinux. (@MisterDA, #???) - Add Fedora 36. (@MisterDA #125) - Add Ubuntu 22.10. (@MisterDA #124) - Support STOPSIGNAL instruction. (@MisterDA #121, review by @avsm) diff --git a/src-opam/distro.ml b/src-opam/distro.ml index 3f8fe18d..4fbc60b7 100644 --- a/src-opam/distro.ml +++ b/src-opam/distro.ml @@ -1093,16 +1093,16 @@ let latest_tag_of_distro (t : t) = tag_of_distro latest type package_manager = - [ `Apt | `Yum | `Apk | `Zypper | `Pacman | `Cygwin | `Windows ] + [ `Apt | `Dnf | `Apk | `Zypper | `Pacman | `Cygwin | `Windows ] [@@deriving sexp] let package_manager (t : t) = match t with | `Ubuntu _ -> `Apt | `Debian _ -> `Apt - | `CentOS _ -> `Yum - | `Fedora _ -> `Yum - | `OracleLinux _ -> `Yum + | `CentOS _ -> `Dnf + | `Fedora _ -> `Dnf + | `OracleLinux _ -> `Dnf | `Alpine _ -> `Apk | `Archlinux _ -> `Pacman | `OpenSUSE _ -> `Zypper diff --git a/src-opam/distro.mli b/src-opam/distro.mli index a9bfee85..a5107140 100644 --- a/src-opam/distro.mli +++ b/src-opam/distro.mli @@ -270,7 +270,7 @@ val human_readable_short_string_of_distro : t -> string type package_manager = [ `Apk (** Alpine Apk *) | `Apt (** Debian Apt *) - | `Yum (** Fedora Yum *) + | `Dnf (** Fedora DNF *) | `Zypper (** OpenSUSE Zypper *) | `Pacman (** Archlinux Pacman *) | `Cygwin (** Cygwin package manager *) diff --git a/src-opam/linux.ml b/src-opam/linux.ml index 1dd9e116..ba7658a0 100644 --- a/src-opam/linux.ml +++ b/src-opam/linux.ml @@ -31,11 +31,11 @@ let sudo_nopasswd = "ALL=(ALL:ALL) NOPASSWD:ALL" (** RPM rules *) module RPM = struct - let update = run "yum update -y" - let install fmt = ksprintf (run "yum install -y %s && yum clean all") fmt + let update = run "dnf update -y" + let install fmt = ksprintf (run "dnf install -y %s && dnf clean all") fmt let groupinstall fmt = - ksprintf (run "yum groupinstall -y %s && yum clean all") fmt + ksprintf (run "dnf groupinstall -y %s && dnf clean all") fmt let add_user ?uid ?gid ?(sudo = false) username = let uid = match uid with Some u -> sprintf "-u %d " u | None -> "" in diff --git a/src-opam/linux.mli b/src-opam/linux.mli index 0f96437d..64168e49 100644 --- a/src-opam/linux.mli +++ b/src-opam/linux.mli @@ -31,13 +31,13 @@ val run_as_user : string -> ('a, unit, string, t) format4 -> 'a (** Rules for RPM-based distributions *) module RPM : sig val update : t - (** [update] will run [yum update -y] *) + (** [update] will run [dnf update -y] *) val install : ('a, unit, string, t) format4 -> 'a - (** [install fmt] will run [yum install] on the supplied package list. *) + (** [install fmt] will run [dnf install] on the supplied package list. *) val groupinstall : ('a, unit, string, t) format4 -> 'a - (** [groupinstall fmt] will run [yum groupinstall] on the supplied package list. *) + (** [groupinstall fmt] will run [dnf groupinstall] on the supplied package list. *) val add_user : ?uid:int -> ?gid:int -> ?sudo:bool -> string -> t (** [add_user username] will install a new user with name [username] and a locked @@ -49,7 +49,7 @@ module RPM : sig [passwd] and [git]. Extra packages may also be optionally supplied via [extra]. *) val install_system_ocaml : t - (** Install the system OCaml packages via Yum *) + (** Install the system OCaml packages via DNF *) end (** Rules for Apt-based distributions *) diff --git a/src-opam/opam.ml b/src-opam/opam.ml index ad44ff8b..a1f98eeb 100644 --- a/src-opam/opam.ml +++ b/src-opam/opam.ml @@ -74,7 +74,7 @@ let bubblewrap_and_dev_packages distro = match D.package_manager distro with | `Apk -> Linux.Apk.dev_packages | `Apt -> Linux.Apt.dev_packages - | `Yum -> Linux.RPM.dev_packages + | `Dnf -> Linux.RPM.dev_packages | `Zypper -> Linux.Zypper.dev_packages | `Pacman -> Linux.Pacman.dev_packages | `Cygwin | `Windows -> assert false @@ -281,7 +281,7 @@ let apt_opam2 ?(labels = []) ?arch distro ~opam_hashes () = [enable_powertools] enables the PowerTools repository on CentOS 8 and above. This is needed to get most of *-devel packages frequently used by opam packages. *) -let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools +let dnf_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools ~opam_hashes distro () = let opam_master_hash, opam_branches = create_opam_branches opam_hashes in let img, tag = D.base_distro_tag ?arch distro in @@ -292,19 +292,17 @@ let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools in header ?arch distro @@ label (("distro_style", "rpm") :: labels) - @@ run "yum --version || dnf install -y yum" @@ workaround @@ Linux.RPM.update @@ Linux.RPM.dev_packages ~extra:"which tar curl xz libcap-devel openssl" () @@ Linux.Git.init () @@ maybe_build_bubblewrap_from_source distro @@ install_opams ~prefix:"/usr" opam_master_hash opam_branches @@ from ~tag img - @@ run "yum --version || dnf install -y yum" @@ workaround @@ Linux.RPM.update @@ bubblewrap_and_dev_packages distro @@ copy_opams ~src:"/usr/bin" ~dst:"/usr/bin" opam_branches @@ (if enable_powertools then - run "yum config-manager --set-enabled powertools" @@ Linux.RPM.update + run "dnf config-manager --set-enabled powertools" @@ Linux.RPM.update else empty) @@ run "sed -i.bak '/LC_TIME LC_ALL LANGUAGE/aDefaults env_keep += \ @@ -393,7 +391,7 @@ let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo = true) ?arch match D.package_manager d with | `Apk -> apk_opam2 ?labels ?arch ~opam_hashes d () | `Apt -> apt_opam2 ?labels ?arch ~opam_hashes d () - | `Yum -> + | `Dnf -> let yum_workaround = match d with `CentOS `V7 -> true | _ -> false in let enable_powertools = match d with @@ -401,7 +399,7 @@ let gen_opam2_distro ?win10_revision ?winget ?(clone_opam_repo = true) ?arch | `CentOS _ -> true | _ -> false in - yum_opam2 ?labels ?arch ~yum_workaround ~enable_powertools ~opam_hashes + dnf_opam2 ?labels ?arch ~yum_workaround ~enable_powertools ~opam_hashes d () | `Zypper -> zypper_opam2 ?labels ?arch ~opam_hashes d () | `Pacman -> pacman_opam2 ?labels ?arch ~opam_hashes d ()