Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Fedora & yum install #154

Merged
merged 4 commits into from
Mar 14, 2023
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
3 changes: 2 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
unreleased
----------

- Optimize and fix Linux package install (@MisterDA #153)
- Optimize and fix Linux package install.
(@MisterDA #147, #151, #153, #154, review by @kit-ty-kate)
- Switch to ocaml-opam/opam-repository-mingw#sunset for Windows images. (@MisterDA #152)
- Use DockerHub user risvc64/ubuntu. (@MisterDA, #150)
- Various LCU Updates (@mtelvers #144 #136 #135)
Expand Down
9 changes: 4 additions & 5 deletions src-opam/linux.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,16 @@ module RPM = struct
let update = run "yum update -y"

let install fmt =
ksprintf (fun s -> update @@ run "yum install -y %s && yum clean all" s) 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 all" s) fmt
ksprintf (fun s -> run "yum groupinstall -y %s && yum clean packages" s) fmt

let dev_packages ?extra () =
install
"sudo passwd bzip2 patch rsync nano gcc-c++ git tar curl xz libX11-devel \
which m4 diffutils findutils%s"
"sudo passwd bzip2 unzip patch rsync nano gcc-c++ git tar curl xz \
libX11-devel which m4 diffutils findutils%s"
(match extra with None -> "" | Some x -> " " ^ x)
@@ groupinstall "\"Development Tools\""

let add_user ?uid ?gid ?(sudo = false) username =
let uid = match uid with Some u -> sprintf "-u %d " u | None -> "" in
Expand Down
26 changes: 18 additions & 8 deletions src-opam/opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,12 @@ let apt_opam2 ?(labels = []) ?arch distro ~opam_hashes () =
for older versions of yum as found in CentOS 7 and earlier

[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. *)
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. *)
let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools
~opam_hashes distro () =
~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 @@ -350,15 +353,21 @@ let yum_opam2 ?(labels = []) ?arch ~yum_workaround ~enable_powertools
header ?arch distro
@@ label (("distro_style", "rpm") :: labels)
@@ run "yum --version || dnf install -y yum"
@@ workaround
@@ Linux.RPM.install "which tar curl xz libcap-devel openssl sudo"
@@ Linux.RPM.groupinstall {|"Development Tools"|}
@@ workaround @@ Linux.RPM.update
@@ Linux.RPM.groupinstall
(if c_devtools_libs then {|"C Development Tools and Libraries"|}
else {|"Development Tools"|})
@@ Linux.RPM.install
"git patch unzip which tar curl xz libcap-devel openssl sudo bzip2"
@@ Linux.Git.init ()
@@ maybe_build_bubblewrap_from_source distro
@@ install_opams ~prefix:"/usr" opam_master_hash opam_branches
@@ from ?arch distro
@@ run "yum --version || dnf install -y yum"
@@ workaround
@@ workaround @@ Linux.RPM.update
@@ Linux.RPM.groupinstall
(if c_devtools_libs then {|"C Development Tools and Libraries"|}
else {|"Development Tools"|})
@@ bubblewrap_and_dev_packages distro
@@ copy_opams ~src:"/usr/bin" ~dst:"/usr/bin" opam_branches
@@ (if enable_powertools then
Expand Down Expand Up @@ -474,8 +483,9 @@ 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
d ()
let c_devtools_libs = match d with `Fedora _ -> true | _ -> false in
yum_opam2 ?labels ?arch ~yum_workaround ~enable_powertools
~c_devtools_libs ~opam_hashes d ()
| `Zypper -> zypper_opam2 ?labels ?arch ~opam_hashes d ()
| `Pacman -> pacman_opam2 ?labels ?arch ~opam_hashes d ()
| `Windows ->
Expand Down