Skip to content

Commit

Permalink
Merge pull request #5870 from kit-ty-kate/opam-2.1.6
Browse files Browse the repository at this point in the history
2.1.6 backport commits
  • Loading branch information
kit-ty-kate authored May 16, 2024
2 parents 93f47ec + d614bfa commit dfbe6a0
Show file tree
Hide file tree
Showing 23 changed files with 119 additions and 69 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ env:
OPAMBSROOT: ~/.cache/.opam.cached
OPAM12CACHE: ~/.cache/opam1.2/cache
# This should be identical to the value in appveyor.yml
OPAM_TEST_REPO_SHA: 3d6779beedc761067596bf5c3f5c25ab57a7e3e7
OPAM_REPO_SHA: 3d6779beedc761067596bf5c3f5c25ab57a7e3e7
OPAM_TEST_REPO_SHA: c687553afb80373165068d67f33512b7ad39e6a3
OPAM_REPO_SHA: c687553afb80373165068d67f33512b7ad39e6a3
# Default ocaml version for some jobs
OCAML_VERSION: 4.12.0
## variables for cache paths
Expand Down Expand Up @@ -119,9 +119,12 @@ jobs:
OPAM_TEST: 1
steps:
- uses: actions/checkout@v2
- name: install deps
- name: install deps - Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- name: install deps - macOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install gpatch
- name: ocaml ${{ matrix.ocamlv }} cache - test
id: ocaml-cache-test
uses: actions/cache@v2
Expand Down Expand Up @@ -200,13 +203,15 @@ jobs:
fail-fast: false
env:
SOLVER: ${{ matrix.solver }}
OPAM_REPO_SHA: 3d6779beedc761067596bf5c3f5c25ab57a7e3e7
OPAMBSROOT: ~/.cache/opam.${{ matrix.solver }}.cached
steps:
- uses: actions/checkout@v2
- name: install deps
- name: install deps - Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- name: install deps - macOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install gpatch
- name: ocaml ${{ matrix.ocamlv }} cache - test
id: ocaml-cache-test
uses: actions/cache@v2
Expand Down Expand Up @@ -248,9 +253,12 @@ jobs:
ocamlv: [ 4.12.0 ]
fail-fast: false
steps:
- name: install deps
- name: install deps - Linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt install bubblewrap
- name: install deps - macOS
if: ${{ matrix.os == 'macos-latest' }}
run: brew install gpatch
- uses: actions/checkout@v2
- name: opam 1.2 root cache
uses: actions/cache@v2
Expand Down
18 changes: 18 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@ repositories (changes that are automatically handled by the format upgrade tools
are not marked). Those prefixed with "(+)" are new command/option (since
2.1.0~alpha2).

2.1.6:
* Changes necessary for opam repository
* Warn if `GNU patch` is not detected when a patch is applied
[#5893 @kit-ty-kate]
* Use `gpatch` by default instead of `patch` on NetBSD and DragonFlyBSD
[#5893 @kit-ty-kate]
* Use `gpatch` if it exists and is detected as GNU patch when `patch` is not
`GNU patch` [#5893 @kit-ty-kate]
* Better recognize depexts on Gentoo, NetBSD, OpenBSD [#5065 @mndrix]
* Upgrade the vendored dune to 3.14.0 [#5869 @kit-ty-kate]
* Vendor mccs.1.1+17 [#5769 @kit-ty-kate]
* Require mccs >= 1.1+17: Fix debug logs showing up regardless of verbosity on
macOS 12.7.1 / 13.6.3 / 14.2 and FreeBSD [#5769 @kit-ty-kate]
* API Changes:
* `OpamSystem.patch` now displays a warning when GNU patch is not detected
and looks for both patch and gpatch as a backup option depending on the OS
[#5893 @kit-ty-kate]

2.1.5:
* [BUG] Variables are now expanded in build-env (as for setenv) [#5352 @dra27]
* Correctly handle empty environment variable additions [#5350 @dra27]
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ DUNE_PROMOTE_ARG =
DUNE_PROMOTE_ARG += --promote-install-files

ifeq ($(DUNE),)
DUNE_EXE = src_ext/dune-local/dune.exe
DUNE_EXE = src_ext/dune-local/_boot/dune.exe
ifeq ($(shell command -v cygpath 2>/dev/null),)
DUNE := $(DUNE_EXE)
else
Expand All @@ -22,7 +22,7 @@ else
DUNE_EXE=
# NB make does not export the PATH update in Makefile.config to $(shell ...)
ifeq ($(shell PATH='$(PATH)' $(DUNE) build --root . --help=plain 2>/dev/null \
| grep -F -- '$(DUNE_PROMOTE_ARG) '),)
| grep -F -- '$(DUNE_PROMOTE_ARG)'),)
DUNE_PROMOTE_ARG =
endif
endif
Expand All @@ -44,11 +44,11 @@ else
DUNE_PROFILE_ARG = --profile=$(DUNE_PROFILE)
endif

src_ext/dune-local/dune.exe: src_ext/dune-local.stamp $(DUNE_SECONDARY)
src_ext/dune-local/_boot/dune.exe: src_ext/dune-local.stamp $(DUNE_SECONDARY)
ifeq ($(DUNE_SECONDARY),)
cd src_ext/dune-local && ocaml bootstrap.ml
cd src_ext/dune-local && ocaml boot/bootstrap.ml
else
cd src_ext/dune-local && ( unset OCAMLLIB ; unset CAML_LD_LIBRARY_PATH ; PATH="$(dir $(realpath $(DUNE_SECONDARY))):$$PATH" ../../$(DUNE_SECONDARY) bootstrap.ml )
cd src_ext/dune-local && ( unset OCAMLLIB ; unset CAML_LD_LIBRARY_PATH ; PATH="$(dir $(realpath $(DUNE_SECONDARY))):$$PATH" ../../$(DUNE_SECONDARY) boot/bootstrap.ml )
endif

src_ext/dune-local.stamp:
Expand Down
18 changes: 9 additions & 9 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dnl The line below must be formatted AC_INIT(opam,VERSION) with no extra spaces
AC_INIT(opam,2.1.5)
AC_INIT(opam,2.1.6)
AC_COPYRIGHT(Copyright 2012-2019 OcamlPro SAS)

AC_CONFIG_MACRO_DIR([m4])
Expand Down
5 changes: 5 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ New option/command/subcommand are prefixed with ◈.
*

## Init
*

## Config report
*
Expand All @@ -37,6 +38,9 @@ New option/command/subcommand are prefixed with ◈.
## Lint
*

## Repository
*

## Lock
*

Expand All @@ -54,6 +58,7 @@ New option/command/subcommand are prefixed with ◈.
*

## Build
*

## Infrastructure
*
Expand Down
2 changes: 1 addition & 1 deletion opam-client.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Client library for opam 2.1"
description: """
Actions on the opam root, switches, installations, and front-end.
Expand Down
2 changes: 1 addition & 1 deletion opam-core.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Core library for opam 2.1"
description: """
Small standard library extensions, and generic system interaction modules used by opam.
Expand Down
2 changes: 1 addition & 1 deletion opam-devel.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Bootstrapped development binary for opam 2.1"
description: """
This package compiles (bootstraps) opam. For consistency and safety of the installation, the binaries are not installed into the PATH, but into lib/opam-devel, from where the user can manually install them system-wide.
Expand Down
2 changes: 1 addition & 1 deletion opam-format.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Format library for opam 2.1"
description: """
Definition of opam datastructures and its file interface.
Expand Down
2 changes: 1 addition & 1 deletion opam-installer.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Installation of files to a prefix, following opam conventions"
description: """
opam-installer is a small tool that can read *.install files, as defined by opam [1], and execute them to install or remove package files without going through opam.
Expand Down
2 changes: 1 addition & 1 deletion opam-repository.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Repository library for opam 2.1"
description: """
This library includes repository and remote sources handling, including curl/wget, rsync, git, mercurial, darcs backends.
Expand Down
4 changes: 2 additions & 2 deletions opam-solver.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Solver library for opam 2.1"
description: """
Solver and Cudf interaction. This library is based on the Cudf and Dose libraries, and handles calls to the external solver from opam.
Expand Down Expand Up @@ -28,7 +28,7 @@ build: [
depends: [
"ocaml" {>= "4.02.3"}
"opam-format" {= version}
"mccs" {>= "1.1+9"}
"mccs" {>= "1.1+17"}
("dose3" {>= "6.1"} | "dose3" {>= "5"} & "ocaml" {= "4.02.3"})
"cudf" {>= "0.7"}
"dune" {>= "1.11.0"}
Expand Down
2 changes: 1 addition & 1 deletion opam-state.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "State library for opam 2.1"
description: """
Handling of the ~/.opam hierarchy, repository and switch states.
Expand Down
2 changes: 1 addition & 1 deletion opam.opam
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
opam-version: "2.0"
version: "2.1.5"
version: "2.1.6"
synopsis: "Meta-package for Dune"
maintainer: "opam-devel@lists.ocaml.org"
authors: [
Expand Down
6 changes: 5 additions & 1 deletion src/client/opamInitDefaults.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ let linux_filter = os_filter "linux"
let macos_filter = os_filter "macos"
let openbsd_filter = os_filter "openbsd"
let freebsd_filter = os_filter "freebsd"
let netbsd_filter = os_filter "netbsd"
let dragonflybsd_filter = os_filter "dragonfly"
let not_open_free_bsd_filter =
FNot (FOr (openbsd_filter, freebsd_filter))
let win32_filter = os_filter "win32"
let sandbox_filter = FOr (linux_filter, macos_filter)

let gpatch_filter = FOr (openbsd_filter, freebsd_filter)
let gpatch_filter =
FOr (FOr (openbsd_filter, netbsd_filter),
FOr (freebsd_filter, dragonflybsd_filter))
let patch_filter = FNot gpatch_filter

let gtar_filter = openbsd_filter
Expand Down
41 changes: 35 additions & 6 deletions src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,40 @@ let translate_patch ~dir orig corrected =
end;
close_in ch
let gpatch = lazy begin
let rec search_gpatch = function
| [] -> None
| patch_cmd::patch_cmds ->
match OpamProcess.run (make_command ~name:"patch" patch_cmd ["--version"]) with
| r ->
(match OpamProcess.is_success r, r.OpamProcess.r_stdout with
| true, full::_ when
OpamStd.String.is_prefix_of ~from:0 ~full "GNU patch " ->
Some patch_cmd
| _ ->
search_gpatch patch_cmds)
| exception _ -> search_gpatch patch_cmds
in
let default_cmd, other_cmds =
match OpamStd.Sys.os () with
| DragonFly
| FreeBSD
| NetBSD
| OpenBSD -> ("gpatch", ["patch"])
| Cygwin
| Darwin
| Linux
| Unix
| Win32
| Other _ -> ("patch", ["gpatch"])
in
match search_gpatch (default_cmd :: other_cmds) with
| Some gpatch -> gpatch
| None ->
OpamConsole.warning "Invalid patch utility. Please install GNU patch";
default_cmd
end
let patch ?(preprocess=true) ~dir p =
if not (Sys.file_exists p) then
(OpamConsole.error "Patch file %S not found." p;
Expand All @@ -1507,12 +1541,7 @@ let patch ?(preprocess=true) ~dir p =
else
p
in
let patch_cmd =
match OpamStd.Sys.os () with
| OpamStd.Sys.OpenBSD
| OpamStd.Sys.FreeBSD -> "gpatch"
| _ -> "patch"
in
let patch_cmd = Lazy.force gpatch in
make_command ~name:"patch" ~dir patch_cmd ["-p1"; "-i"; p'] @@> fun r ->
if not (OpamConsole.debug ()) then Sys.remove p';
if OpamProcess.is_success r then Done None
Expand Down
8 changes: 7 additions & 1 deletion src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,17 @@ let packages_status packages =
let short_name =
match String.rindex pkg '/' with
| exception Not_found -> pkg
| idx -> String.sub pkg idx (String.length pkg - idx)
| idx -> String.sub pkg (idx+1) (String.length pkg - idx - 1)
in
let no_flavor =
match String.index short_name ',' with
| exception Not_found -> short_name
| idx -> String.sub short_name 0 idx
in
set
|> OpamSysPkg.Set.add (OpamSysPkg.of_string pkg)
|> OpamSysPkg.Set.add (OpamSysPkg.of_string short_name)
|> OpamSysPkg.Set.add (OpamSysPkg.of_string no_flavor)
) OpamSysPkg.Set.empty l
in
let compute_sets_with_virtual get_avail_w_virtuals get_installed =
Expand Down
Loading

0 comments on commit dfbe6a0

Please sign in to comment.