From 7c1d171a7acb16279277bfc18ee55b2e45f110af Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 22 Oct 2024 16:45:51 +0100 Subject: [PATCH] Lookup at gpatch before patch on macOS now that both homebrew and macports expose gpatch as gpatch Homebrew changed behaviour in Homebrew/homebrew-core#174687 --- .github/workflows/ci.ml | 1 + .github/workflows/main.yml | 2 ++ master_changes.md | 1 + src/client/opamInitDefaults.ml | 2 +- src/core/opamSystem.ml | 2 +- 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.ml b/.github/workflows/ci.ml index 9ff06d19121..ffd1e3bd225 100644 --- a/.github/workflows/ci.ml +++ b/.github/workflows/ci.ml @@ -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 MacOS (run "Install GNU patch" ["brew install gpatch"]) ++ 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) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ee3dc78f71..377b09bdf32 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -245,6 +245,8 @@ jobs: ocamlv: [ 4.14.2, 5.2.0 ] fail-fast: true steps: + - name: Install GNU patch + run: brew install gpatch - name: Checkout tree uses: actions/checkout@v4 - name: src_ext/archives and opam-repository Cache diff --git a/master_changes.md b/master_changes.md index 1761ed7f9b7..ca9de2e8f99 100644 --- a/master_changes.md +++ b/master_changes.md @@ -66,6 +66,7 @@ users) ## Opamfile ## External dependencies + * Lookup at `gpatch` before `patch` on macOS now that both homebrew and macports expose `gpatch` as `gpatch` since Homebrew/homebrew-core#174687 [#6255 @kit-ty-kate] ## Format upgrade diff --git a/src/client/opamInitDefaults.ml b/src/client/opamInitDefaults.ml index 6b5a7017fbf..a6a18f20ade 100644 --- a/src/client/opamInitDefaults.ml +++ b/src/client/opamInitDefaults.ml @@ -57,7 +57,7 @@ let sandbox_filter = FOr (linux_filter, macos_filter) let gpatch_filter = FOr (FOr (openbsd_filter, netbsd_filter), - FOr (freebsd_filter, dragonflybsd_filter)) + FOr (freebsd_filter, FOr (dragonflybsd_filter, macos_filter))) let patch_filter = FNot gpatch_filter let gtar_filter = openbsd_filter diff --git a/src/core/opamSystem.ml b/src/core/opamSystem.ml index 75dbb588743..def6ee5159e 100644 --- a/src/core/opamSystem.ml +++ b/src/core/opamSystem.ml @@ -1570,12 +1570,12 @@ let gpatch = lazy begin in let default_cmd, other_cmds = match OpamStd.Sys.os () with + | Darwin | DragonFly | FreeBSD | NetBSD | OpenBSD -> ("gpatch", ["patch"]) | Cygwin - | Darwin | Linux | Unix | Win32