Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src-opam/linux.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,18 @@ module RPM = struct
let install fmt =
ksprintf (fun s -> run "yum install -y %s && yum clean packages" s) fmt

let groupinstall fmt =
ksprintf (fun s -> run "yum groupinstall -y %s && yum clean packages" s) fmt
let groupinstall ver fmt =
match ver with
| 3 ->
(* dnf3 syntax which was deprecated but worked in dnf4 *)
ksprintf
(fun s -> run "yum groupinstall -y %s && yum clean packages" s)
fmt
| _ ->
(* dnf4 and dnf5 syntax *)
ksprintf
(fun s -> run "yum group install -y %s && yum clean packages" s)
fmt

let dev_packages ?extra () =
install
Expand Down
5 changes: 3 additions & 2 deletions src-opam/linux.mli
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ module RPM : sig
val install : ('a, unit, string, t) format4 -> 'a
(** [install fmt] will run [yum 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. *)
val groupinstall : int -> ('a, unit, string, t) format4 -> 'a
(** [groupinstall ver fmt] will run [yum groupinstall] or [yum group install]
on the supplied package list. ver selects the appropriate syntax *)

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
Expand Down
26 changes: 15 additions & 11 deletions src-opam/opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,12 @@ 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.

[c_devtools_libs] uses the "C Development Tools and Libraries" package group.
If [false], defaults to the "Development Tools" package group. *)
[dnf_version] version of DNF tool installed which affects the syntax of groupinstall.

[c_devtools_libs] is the name of the package group e.g. "C Development Tools and Libraries" on Fedora, or
otherwise "Development Tools". *)
let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools
~c_devtools_libs ~opam_hashes distro () =
~dnf_version ~c_devtools_libs ~opam_hashes distro () =
let opam_master_hash, opam_branches = create_opam_branches opam_hashes in
let workaround =
if yum_workaround then
Expand All @@ -395,9 +397,7 @@ let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools
@@ label (("distro_style", "rpm") :: labels)
@@ run "yum --version || dnf install -y yum"
@@ workaround @@ Linux.RPM.update
@@ Linux.RPM.groupinstall
(if c_devtools_libs then {|"C Development Tools and Libraries"|}
else {|"Development Tools"|})
@@ Linux.RPM.groupinstall dnf_version c_devtools_libs
@@ Linux.RPM.install
"git patch unzip which tar curl xz libcap-devel openssl sudo bzip2"
@@ Linux.Git.init ()
Expand All @@ -406,9 +406,7 @@ let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools
@@ from ?arch distro
@@ run "yum --version || dnf install -y yum"
@@ workaround @@ Linux.RPM.update
@@ Linux.RPM.groupinstall
(if c_devtools_libs then {|"C Development Tools and Libraries"|}
else {|"Development Tools"|})
@@ Linux.RPM.groupinstall dnf_version c_devtools_libs
@@ bubblewrap_and_dev_packages distro
@@ copy_opams ~src:"/usr/bin" ~dst:"/usr/bin" opam_branches
@@ (if enable_powertools then
Expand Down Expand Up @@ -561,8 +559,14 @@ let gen_opam2_distro ?override_tag ?(clone_opam_repo = true) ?arch ?labels
| `CentOS _ -> true
| _ -> false
in
let c_devtools_libs = match d with `Fedora _ -> true | _ -> false in
yum_opam2 ?labels ?arch ~yum_workaround ~enable_powertools
let c_devtools_libs : (t, unit, string, t) format4 =
match d with
| `Fedora `V41 -> {|"c-development"|}
| `Fedora _ -> {|"C Development Tools and Libraries"|}
| _ -> {|"Development Tools"|}
in
let dnf_version = match d with `Fedora `V41 -> 5 | _ -> 3 in
yum_opam2 ?labels ?arch ~yum_workaround ~enable_powertools ~dnf_version
~c_devtools_libs ~opam_hashes d ()
| `Zypper -> zypper_opam2 ?labels ?arch ~opam_hashes d ()
| `Pacman -> pacman_opam2 ?labels ?arch ~opam_hashes d ()
Expand Down