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
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
unreleased
----------

- Optimize and fix Linux package install (@MisterDA #153)
- 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
43 changes: 24 additions & 19 deletions src-opam/linux.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,19 @@ 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 install fmt =
ksprintf (fun s -> update @@ run "yum install -y %s && yum clean all" s) fmt

let groupinstall fmt =
ksprintf (run "yum groupinstall -y %s && yum clean all") fmt
ksprintf (fun s -> run "yum groupinstall -y %s && yum clean all" 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"
(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 All @@ -58,13 +67,6 @@ module RPM = struct
@@ env [ ("HOME", home) ]
@@ workdir "%s" home @@ run "mkdir .ssh" @@ run "chmod 700 .ssh"

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

let install_system_ocaml = install "ocaml ocaml-camlp4-devel ocaml-ocamldoc"
end

Expand All @@ -81,10 +83,9 @@ module Apt = struct
fmt

let dev_packages ?extra () =
update
@@ copy_heredoc
~src:[ heredoc ~strip:true "\tAcquire::Retries \"5\";" ]
~dst:"/etc/apt/apt.conf.d/mirror-retry" ()
copy_heredoc
~src:[ heredoc ~strip:true "\tAcquire::Retries \"5\";" ]
~dst:"/etc/apt/apt.conf.d/mirror-retry" ()
@@ install
"build-essential curl git rsync sudo unzip nano libcap-dev \
libx11-dev%s"
Expand Down Expand Up @@ -147,7 +148,7 @@ module Apk = struct
@@ user "%s" username @@ workdir "%s" home @@ run "mkdir .ssh"
@@ run "chmod 700 .ssh"

let install_system_ocaml = run "apk add ocaml camlp4"
let install_system_ocaml = install "ocaml camlp4"

let add_repository ?tag url =
run "<<-EOF cat >> /etc/apk/repositories\n\t%s\nEOF"
Expand Down Expand Up @@ -177,8 +178,8 @@ module Zypper = struct
install "-t pattern devel_C_C++"
@@ install
"sudo git unzip curl gcc-c++ libcap-devel xz libX11-devel bzip2 which \
rsync gzip"
@@ maybe (install "%s") extra
rsync gzip%s"
(match extra with None -> "" | Some x -> " " ^ x)

let add_user ?uid ?gid ?(sudo = false) username =
let home = "/home/" ^ username in
Expand All @@ -203,8 +204,12 @@ end

(** Pacman rules *)
module Pacman = struct
let update = run "pacman -Syu --noconfirm"
let install fmt = ksprintf (fun s -> run "pacman -Syu --noconfirm %s" s) fmt
let update = run "pacman -Syu --noconfirm && yes | pacman -Scc"

let install fmt =
ksprintf
(fun s -> run "pacman -Syu --noconfirm %s && yes | pacman -Scc" s)
fmt

let dev_packages ?extra () =
install
Expand All @@ -230,5 +235,5 @@ module Pacman = struct
@@ user "%s" username @@ workdir "%s" home @@ run "mkdir .ssh"
@@ run "chmod 700 .ssh"

let install_system_ocaml = run "pacman add ocaml ocaml-compiler-libs"
let install_system_ocaml = install "ocaml ocaml-compiler-libs"
end
7 changes: 4 additions & 3 deletions src-opam/opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -350,14 +350,15 @@ 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.update
@@ Linux.RPM.dev_packages ~extra:"which tar curl xz libcap-devel openssl" ()
@@ workaround
@@ Linux.RPM.install "which tar curl xz libcap-devel openssl sudo"
@@ Linux.RPM.groupinstall {|"Development Tools"|}
@@ 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 @@ Linux.RPM.update
@@ workaround
@@ bubblewrap_and_dev_packages distro
@@ copy_opams ~src:"/usr/bin" ~dst:"/usr/bin" opam_branches
@@ (if enable_powertools then
Expand Down