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
6 changes: 6 additions & 0 deletions .github/workflows/ci.ml
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ let main_build_job ~analyse_job ~cygwin_job ?section runner start_version ~oc ~w
let host = host_of_platform platform in
job ~oc ~workflow ~runs_on:(Runner [runner]) ?shell ?section ~needs ~matrix ("Build-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ only_on Windows (git_lf_checkouts ~cond:(Predicate(true, EndsWith("matrix.host", "-pc-cygwin"))) ~shell:"cmd" ~title:"Configure LF checkout for Cygwin" ())
++ checkout ()
++ only_on Windows (cache ~cond:(Predicate(true, Compare("matrix.build", "x86_64-pc-cygwin"))) Cygwin)
Expand Down Expand Up @@ -384,6 +385,7 @@ let main_test_job ~analyse_job ~build_linux_job ~build_windows_job:_ ~build_macO
++ only_on MacOS (install_sys_packages ["coreutils"; "gpatch"] ~descr:"Install gnu coreutils" [MacOS])
++ checkout ()
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ cache Archives
++ cache OCaml platform ocamlv host
++ build_cache OCaml platform ocamlv host
Expand All @@ -402,6 +404,7 @@ let cold_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ?
let needs = [analyse_job; (match platform with Linux -> build_linux_job | Windows -> build_windows_job | MacOS -> build_macOS_job)] in
job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env:[("OPAM_COLD", "1")] ~needs ("Cold-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ checkout ()
++ cache Archives
++ run "Cold" [
Expand All @@ -420,6 +423,7 @@ let doc_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_job ?s
let ocamlv = "${{ matrix.ocamlv }}" in
job ~oc ~workflow ?section ~runs_on:(Runner [platform]) ~env ~needs ~matrix ("Doc-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ run "Install man2html" ["sudo apt install man2html"]
++ checkout ()
++ cache Archives
Expand All @@ -444,6 +448,7 @@ let solvers_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo
let ocamlv = "${{ matrix.ocamlv }}" in
job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~env ~needs ~matrix ("Solvers-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ checkout ()
++ cache Archives
++ cache OCaml platform ocamlv host
Expand All @@ -463,6 +468,7 @@ let upgrade_job ~analyse_job ~build_linux_job ~build_windows_job ~build_macOS_jo
let ocamlv = "${{ matrix.ocamlv }}" in
job ~oc ~workflow ?section ~runs_on:(Runner [runner]) ~needs ~matrix ("Upgrade-" ^ name_of_platform platform)
++ only_on Linux (run "Install bubblewrap" ["sudo apt install bubblewrap"])
++ only_on Linux (run "Disable AppArmor" ["echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns"])
++ checkout ()
++ cache Opam12Root
++ cache OCaml platform ocamlv host
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ jobs:
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Checkout tree
uses: actions/checkout@v4
- name: src_ext/archives and opam-repository Cache
Expand Down Expand Up @@ -288,6 +290,8 @@ jobs:
uses: actions/checkout@v4
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: src_ext/archives and opam-repository Cache
id: archives
uses: actions/cache@v4
Expand Down Expand Up @@ -394,6 +398,8 @@ jobs:
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Checkout tree
uses: actions/checkout@v4
- name: src_ext/archives and opam-repository Cache
Expand Down Expand Up @@ -427,6 +433,8 @@ jobs:
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Install man2html
run: sudo apt install man2html
- name: Checkout tree
Expand Down Expand Up @@ -483,6 +491,8 @@ jobs:
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Checkout tree
uses: actions/checkout@v4
- name: src_ext/archives and opam-repository Cache
Expand Down Expand Up @@ -576,6 +586,8 @@ jobs:
steps:
- name: Install bubblewrap
run: sudo apt install bubblewrap
- name: Disable AppArmor
run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns
- name: Checkout tree
uses: actions/checkout@v4
- name: opam 1.2 root Cache
Expand Down
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ users)
* `OpamFile.Repos_config.t`: change the type to not allow repositories without an URL [#6249 @kit-ty-kate]

## opam-core
* `OpamStd.List.split`: Improve performance [#6210 @kit-ty-kate]
* `OpamStd.Sys.{get_terminal_columns,uname,getconf,guess_shell_compat}`: Harden the process calls to account for failures [#6230 @kit-ty-kate - fix #6215]
* `OpamStd.Sys.getconf`: was removed, replaced by `get_long_bit` [#6217 @kit-ty-kate]
* `OpamStd.Sys.get_long_bit`: was added, which returns the output of the `getconf LONG_BIT` command [#6217 @kit-ty-kate]
Expand Down
26 changes: 21 additions & 5 deletions src/core/opamStd.ml
Original file line number Diff line number Diff line change
Expand Up @@ -692,9 +692,25 @@ module OpamString = struct
let rcut_at = cut_at_aux String.rindex

let split s c =
(* old compat version (Re 1.2.0)
{[Re_str.split (Re_str.regexp (Printf.sprintf "[%c]+" c)) s]} *)
Re.(split (compile (rep1 (char c)))) s
let rec loop acc i slice_start len s c =
if (i : int) < (len : int) then
if s.[i] = (c : char) then
let acc =
if (slice_start : int) < (i : int) then
String.sub s slice_start (i - slice_start) :: acc
else
acc
in
let i = i+1 in
loop acc i i len s c
else
loop acc (i+1) slice_start len s c
else if (i : int) = (slice_start : int) then
acc
else
String.sub s slice_start (len - slice_start) :: acc
in
List.rev (loop [] 0 0 (String.length s) s c)

let split_delim s c =
let tokens = Re.(split_full (compile (char c)) s) in
Expand Down Expand Up @@ -1160,9 +1176,9 @@ module OpamSys = struct
| SH_fish ->
Some (List.fold_left Filename.concat (home ".config") ["fish"; "config.fish"])
| SH_zsh ->
let zsh_home f =
let zsh_home f =
try Filename.concat (Env.get "ZDOTDIR") f
with Not_found -> home f in
with Not_found -> home f in
Some (zsh_home ".zshrc")
| SH_bash ->
let shell =
Expand Down