From 9130a7ae6db4a92e961d9040b807d0dbab86808a Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 24 Sep 2024 20:11:59 +0100 Subject: [PATCH 1/6] reftest: add a test showing the behaviour of opam install when a local opam file changes while being pinned --- master_changes.md | 1 + tests/reftests/pin.test | 70 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/master_changes.md b/master_changes.md index 33c82c40394..d0b9ca148db 100644 --- a/master_changes.md +++ b/master_changes.md @@ -106,6 +106,7 @@ users) ## Reftests ### Tests + * Add a test showing the behaviour of opam install when a local opam file changes while being pinned [#6209 @kit-ty-kate] ### Engine diff --git a/tests/reftests/pin.test b/tests/reftests/pin.test index 85b082340f5..d22e6ba1eb4 100644 --- a/tests/reftests/pin.test +++ b/tests/reftests/pin.test @@ -399,3 +399,73 @@ echo GARBAGE>>"$1" error 2: File format error: unsupported or missing file format version; should be 2.0 or older [ERROR] No package named pin-at-future found. # Return code 5 # +### : Make sure opam install works when the opam file changes and the package is pinned +### opam switch create --empty local-pin-pinned-packages +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### mkdir pin-change +### git -C pin-change init -q --initial-branch=master +### git -C pin-change config core.autocrlf false +### +opam-version: "2.0" +### git -C pin-change add opam +### git -C pin-change commit -qm first-commit +### ::: behaviour when the package is not pinned +### opam install --deps-only --show ./pin-change +Nothing to do. +### +opam-version: "2.0" +depends: "dependency" {= "1"} +### opam install --deps-only --show ./pin-change +The following actions would be performed: +=== install 1 package + - install dependency 1 [required by pin-change] +### ::: behaviour when the package is pinned +### +opam-version: "2.0" +### opam install ./pin-change +Package pin-change does not exist, create as a NEW package? [y/n] y +pin-change is now pinned to git+file://${BASEDIR}/pin-change#master (version dev) +The following actions will be performed: +=== install 1 package + - install pin-change dev (pinned) + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved pin-change.dev (git+file://${BASEDIR}/pin-change#master) +-> installed pin-change.dev +Done. +### +opam-version: "2.0" +depends: "dependency" {= "1"} +### ::: behaviour when the package is not pinned +### opam install ./pin-change +[NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). +[pin-change.dev] synchronised (no changes) +[NOTE] Package pin-change is already installed (current version is dev). +### +opam-version: "2.0" +depends: "dependency" {= "2"} +### opam install --deps-only ./pin-change +[NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). +[pin-change.dev] synchronised (no changes) +### opam remove pin-change +The following actions will be performed: +=== remove 1 package + - remove pin-change dev (pinned) + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed pin-change.dev +Done. +### +opam-version: "2.0" +depends: "dependency" {= "3"} +### opam install --deps-only ./pin-change/opam +[NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). +[pin-change.dev] synchronised (no changes) +Nothing to do. +### opam pin +pin-change.dev (uninstalled) git git+file://${BASEDIR}/pin-change#master From b060e1d3465d9bcf1956ab55dd612ca6c7f2e8d0 Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 24 Sep 2024 20:14:40 +0100 Subject: [PATCH 2/6] Fix "opam install " not updating pinned packages' metadata --- master_changes.md | 1 + src/client/opamAuxCommands.ml | 29 ++++++++++++++++++++++------- tests/reftests/pin.test | 23 +++++++++++++++++++++-- 3 files changed, 44 insertions(+), 9 deletions(-) diff --git a/master_changes.md b/master_changes.md index d0b9ca148db..47a1eae1162 100644 --- a/master_changes.md +++ b/master_changes.md @@ -24,6 +24,7 @@ users) ## Actions ## Install + * Fix `opam install ` not updating and storing pinned packages' metadata [#6209 @kit-ty-kate - fix #5567] ## Build (package) diff --git a/src/client/opamAuxCommands.ml b/src/client/opamAuxCommands.ml index cbcc6851b5d..7e0bcf27ac4 100644 --- a/src/client/opamAuxCommands.ml +++ b/src/client/opamAuxCommands.ml @@ -250,7 +250,7 @@ let resolve_locals ?(quiet=false) ?locked ?recurse ?subpath (OpamUrl.to_string nf.pin.pin_url)) duplicates) -let autopin_aux st ?quiet ?(for_view=false) ?recurse ?subpath ?locked +let autopin_aux st ?quiet ?recurse ?subpath ?locked atom_or_local_list = let to_pin, atoms = resolve_locals ?quiet ?recurse ?subpath ?locked atom_or_local_list @@ -303,16 +303,31 @@ let autopin_aux st ?quiet ?(for_view=false) ?recurse ?subpath ?locked | _ -> false) | None -> false) && - (* For `opam show`, we need to check does the opam file changed to - perform a simulated pin if so *) - (not for_view || - match + (match OpamSwitchState.opam_opt st pinned_pkg, OpamFile.OPAM.read_opt nf.pin.pin_file with | Some opam0, Some opam -> let opam = OpamFile.OPAM.with_locked_opt nf.pin.pin_locked opam in - OpamFile.OPAM.equal opam0 opam + let opam = OpamFile.OPAM.with_name nf.pin_name opam in + let opam = + match OpamFile.OPAM.version_opt opam with + | None -> + OpamFile.OPAM.with_version + (OpamPinCommand.default_version st nf.pin_name) opam + | Some _ -> opam + in + let opam = + OpamFile.OPAM.with_url + (OpamFile.URL.create ?subpath:nf.pin.pin_subpath nf.pin.pin_url) + opam + in + let opam = + (* This is required to avoid the case where locked opam files were + stored with the added `available: opam-version >= "2.1"` *) + OpamFile.OPAM.with_available (OpamFile.OPAM.available opam0) opam + in + OpamFile.OPAM.effectively_equal opam0 opam | _, _ -> false) with Not_found -> false) to_pin @@ -396,7 +411,7 @@ let simulate_local_pinnings ?quiet ?(for_view=false) st to_pin = let simulate_autopin st ?quiet ?(for_view=false) ?locked ?recurse ?subpath atom_or_local_list = let atoms, to_pin, obsolete_pins, already_pinned_set = - autopin_aux st ?quiet ~for_view ?recurse ?subpath ?locked atom_or_local_list + autopin_aux st ?quiet ?recurse ?subpath ?locked atom_or_local_list in if to_pin = [] then st, atoms else let st = diff --git a/tests/reftests/pin.test b/tests/reftests/pin.test index d22e6ba1eb4..67d8453abf2 100644 --- a/tests/reftests/pin.test +++ b/tests/reftests/pin.test @@ -443,9 +443,21 @@ opam-version: "2.0" depends: "dependency" {= "1"} ### ::: behaviour when the package is not pinned ### opam install ./pin-change +pin-change is now pinned to git+file://${BASEDIR}/pin-change#master (version dev) [NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). [pin-change.dev] synchronised (no changes) -[NOTE] Package pin-change is already installed (current version is dev). +The following actions will be performed: +=== recompile 1 package + - recompile pin-change dev (pinned) +=== install 1 package + - install dependency 1 [required by pin-change] + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed dependency.1 +-> retrieved pin-change.dev (no changes) +-> removed pin-change.dev +-> installed pin-change.dev +Done. ### opam-version: "2.0" depends: "dependency" {= "2"} @@ -466,6 +478,13 @@ depends: "dependency" {= "3"} ### opam install --deps-only ./pin-change/opam [NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). [pin-change.dev] synchronised (no changes) -Nothing to do. +The following actions will be performed: +=== upgrade 1 package + - upgrade dependency 1 to 3 [required by pin-change] + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed dependency.1 +-> installed dependency.3 +Done. ### opam pin pin-change.dev (uninstalled) git git+file://${BASEDIR}/pin-change#master From 5e531b5c30532d4618b21bdcf40e814bb9481663 Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 24 Sep 2024 20:20:19 +0100 Subject: [PATCH 3/6] Fix "opam install --deps/--show " not updating pinned packages' metadata The reinstall field from the switch state wasn't updated according to the implicit pin and thus opam didn't think there was anything to do. --- master_changes.md | 1 + src/client/opamAuxCommands.ml | 23 +++++++++++++++++++++++ src/client/opamClient.ml | 3 --- tests/reftests/pin.test | 17 +++++++++++++++-- tests/reftests/working-dir.test | 6 +++++- 5 files changed, 44 insertions(+), 6 deletions(-) diff --git a/master_changes.md b/master_changes.md index 47a1eae1162..b839b8c1532 100644 --- a/master_changes.md +++ b/master_changes.md @@ -25,6 +25,7 @@ users) ## Install * Fix `opam install ` not updating and storing pinned packages' metadata [#6209 @kit-ty-kate - fix #5567] + * Fix `opam install --deps-only/--show-action ` not updating (without storing) pinned packages' metadata [#6209 @kit-ty-kate - fix #5567] ## Build (package) diff --git a/src/client/opamAuxCommands.ml b/src/client/opamAuxCommands.ml index 7e0bcf27ac4..da456eb6727 100644 --- a/src/client/opamAuxCommands.ml +++ b/src/client/opamAuxCommands.ml @@ -404,6 +404,29 @@ let simulate_local_pinnings ?quiet ?(for_view=false) st to_pin = st.switch_global st.switch st.switch_config ~pinned ~opams:local_opams) ); + reinstall = lazy ( + let open OpamPackage.Set.Op in + let installed_pinned = st.pinned %% st.installed in + OpamPackage.Set.fold (fun pinned_pkg reinstall -> + match + OpamPackage.Set.find_opt + (fun pkg -> + OpamPackage.Name.equal + (OpamPackage.name pinned_pkg) + (OpamPackage.name pkg)) + local_packages + with + | None -> reinstall + | Some local_pkg -> + let old_opam = OpamPackage.Map.find pinned_pkg st.installed_opams in + let new_opam = OpamPackage.Map.find local_pkg local_opams in + if OpamFile.OPAM.effectively_equal old_opam new_opam then + reinstall + else + OpamPackage.Set.add local_pkg + (OpamPackage.Set.remove pinned_pkg reinstall)) + installed_pinned (Lazy.force st.reinstall) + ); pinned; } in st, local_packages diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index 535135fb191..b7aa57786fd 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -2207,9 +2207,6 @@ let install_t t ?ask ?(ignore_conflicts=false) ?(depext_only=false) in let pkg_reinstall = if assume_built then OpamPackage.Set.of_list pkg_skip - else if deps_only then OpamPackage.Set.empty - (* NOTE: As we only install dependency packages, there are no intersections - between t.reinstall and pkg_skip *) else Lazy.force t.reinstall %% OpamPackage.Set.of_list pkg_skip in (* Add the packages to the list of package roots and display a diff --git a/tests/reftests/pin.test b/tests/reftests/pin.test index 67d8453abf2..a6359b9ab7f 100644 --- a/tests/reftests/pin.test +++ b/tests/reftests/pin.test @@ -464,6 +464,19 @@ depends: "dependency" {= "2"} ### opam install --deps-only ./pin-change [NOTE] Ignoring uncommitted changes in ${BASEDIR}/pin-change (`--working-dir' not specified or specified with no argument). [pin-change.dev] synchronised (no changes) +The following actions will be performed: +=== recompile 1 package + - recompile pin-change dev (pinned) [uses dependency] +=== upgrade 1 package + - upgrade dependency 1 to 2 [required by pin-change] + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed dependency.1 +-> installed dependency.2 +-> retrieved pin-change.dev (no changes) +-> removed pin-change.dev +-> installed pin-change.dev +Done. ### opam remove pin-change The following actions will be performed: === remove 1 package @@ -480,10 +493,10 @@ depends: "dependency" {= "3"} [pin-change.dev] synchronised (no changes) The following actions will be performed: === upgrade 1 package - - upgrade dependency 1 to 3 [required by pin-change] + - upgrade dependency 2 to 3 [required by pin-change] <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> --> removed dependency.1 +-> removed dependency.2 -> installed dependency.3 Done. ### opam pin diff --git a/tests/reftests/working-dir.test b/tests/reftests/working-dir.test index f432c25193f..5a311f80106 100644 --- a/tests/reftests/working-dir.test +++ b/tests/reftests/working-dir.test @@ -256,7 +256,11 @@ Done. opam-version: "2.0" depends: ["qux" {= "1"}] ### opam install ./ongoing --working-dir --show-action -[NOTE] Package ongoing is already installed (current version is dev). +The following actions would be performed: +=== downgrade 1 package + - downgrade qux 4 to 1 [required by ongoing] +=== recompile 1 package + - recompile ongoing dev (pinned) ### opam reinstall ./ongoing --working-dir --show-action <><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><> From ae68f5b45c992e31caeba5daf922f8683d0501ce Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 22 Oct 2024 18:51:55 +0100 Subject: [PATCH 4/6] the test --- tests/reftests/autopin.test | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/tests/reftests/autopin.test b/tests/reftests/autopin.test index 7f6e3aba571..8e94c21e3ea 100644 --- a/tests/reftests/autopin.test +++ b/tests/reftests/autopin.test @@ -320,3 +320,28 @@ opam believes some required external dependencies are missing. opam can: + echo "some-depext" - some-depext Nothing to do. +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### opam install dep.2 +The following actions will be performed: +=== install 1 package + - install dep 2 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed dep.2 +Done. +### +depends: ["dep" {= "1"}] +### opam install --deps-only ./bar +The following actions will be performed: +=== downgrade 1 package + - downgrade dep 2 to 1 [required by pkg] + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed dep.2 +-> installed dep.1 +Done. From 9dc96e1a6d7241e0a4cb096307bc531d04d8517b Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 22 Oct 2024 22:33:56 +0100 Subject: [PATCH 5/6] working test --- tests/reftests/6248.test | 254 +++++++++++++++++++++++++++++++++++++++ tests/reftests/dune.inc | 42 +++++++ 2 files changed, 296 insertions(+) create mode 100644 tests/reftests/6248.test diff --git a/tests/reftests/6248.test b/tests/reftests/6248.test new file mode 100644 index 00000000000..cdc2a350cbf --- /dev/null +++ b/tests/reftests/6248.test @@ -0,0 +1,254 @@ +6a44505c76c94ac5d2ad231b5259cdfe10b9970d +### OPAMYES=1 OPAMSTRICT=0 +### git clone https://github.com/goblint/analyzer/ +Cloning into 'analyzer'... +### opam switch create default --empty +### opam install --deps-only --fake ./analyzer +The following additional pinnings are required by goblint.1.1.1: + - goblint-cil.2.0.4 at git+https://github.com/goblint/cil.git#9f4fac450c02bc61a13717784515056b185794cd + - camlidl.1.12 at git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0 + - apron.v0.9.15 at git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a +Pin and install them? [y/n] y +[goblint-cil.2.0.4] synchronised (no changes) +goblint-cil is now pinned to git+https://github.com/goblint/cil.git#9f4fac450c02bc61a13717784515056b185794cd (version 2.0.4) +[camlidl.1.12] synchronised (no changes) +camlidl is now pinned to git+https://github.com/xavierleroy/camlidl.git#1c1e87e3f56c2c6b3226dd0af3510ef414b462d0 (version 1.12) +[apron.v0.9.15] synchronised (no changes) +apron is now pinned to git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a (version v0.9.15) +The following actions will be faked: +=== install 72 packages + - install angstrom 0.16.1 [required by uri] + - install arg-complete 0.1.0 [required by goblint] + - install astring 0.8.5 [required by fpath] + - install base-bigarray base + - install base-domains base + - install base-nnp base + - install base-threads base [required by catapult] + - install base-unix base [required by fileutils, catapult, qcheck-core] + - install batteries 3.8.0 [required by goblint] + - install bigarray-compat 1.1.0 [required by ctypes] + - install bigstringaf 0.10.0 [required by angstrom] + - install bos 0.2.1 [required by yaml] + - install camlp-streams 5.0.1 [required by batteries] + - install catapult 0.2 [required by goblint] + - install catapult-file 0.2 [required by goblint] + - install conf-autoconf 0.2 [required by cpu] + - install conf-gcc 1.0 [required by goblint] + - install conf-gmp 4 [required by goblint] + - install conf-perl 2 [required by goblint-cil] + - install conf-pkg-config 3 [required by zarith] + - install cppo 1.7.0 [required by arg-complete, goblint-cil] + - install cpu 2.0.0 [required by goblint] + - install csexp 1.5.2 [required by dune-private-libs, dune-configurator] + - install cstruct 6.2.0 [required by hex] + - install ctypes 0.23.0 [required by yaml] + - install dune 3.16.0 [required by goblint] + - install dune-build-info 3.16.0 [required by goblint] + - install dune-configurator 3.16.0 [required by goblint-cil, yaml] + - install dune-private-libs 3.16.0 [required by dune-site] + - install dune-site 3.16.0 [required by goblint] + - install dyn 3.16.0 [required by dune-private-libs] + - install fileutils 0.6.4 [required by goblint] + - install fmt 0.9.0 [required by bos] + - install fpath 0.7.3 [required by goblint] + - install goblint-cil 2.0.4 (pinned) [required by goblint] + - install hex 1.5.0 [required by json-data-encoding] + - install host-arch-arm64 1 + - install host-system-other 1 + - install integers 0.7.0 [required by ctypes] + - install json-data-encoding 1.0.1 [required by goblint] + - install jsonrpc 1.19.0 [required by goblint] + - install logs 0.7.0 [required by bos] + - install num 1.5-1 [required by batteries] + - install ocaml 5.2.0 [required by goblint] + - install ocaml-base-compiler 5.2.0 [required by ocaml] + - install ocaml-compiler-libs v0.17.0 [required by ppxlib] + - install ocaml-config 3 [required by ocaml] + - install ocaml-options-vanilla 1 + - install ocaml-syntax-shims 1.0.0 [required by angstrom] + - install ocamlbuild 0.15.0 [required by fpath, uuidm] + - install ocamlfind 1.9.6 [required by fpath, batteries, uuidm] + - install ordering 3.16.0 [required by dyn, stdune] + - install pp 1.2.0 [required by dune-private-libs] + - install ppx_derivers 1.2.1 [required by ppx_deriving] + - install ppx_deriving 6.0.3 [required by goblint] + - install ppx_deriving_hash 0.1.2 [required by goblint] + - install ppx_deriving_yojson 3.9.0 [required by goblint] + - install ppxlib 0.33.0 [required by ppx_deriving_hash] + - install qcheck-core 0.22 [required by goblint] + - install rresult 0.7.0 [required by bos] + - install seq base [required by fileutils] + - install sexplib0 v0.17.0 [required by ppxlib] + - install sha 1.15.4 [required by goblint] + - install stdlib-shims 0.3.0 [required by goblint-cil, fileutils, sha] + - install stdune 3.16.0 [required by dune-private-libs] + - install stringext 1.6.0 [required by uri] + - install topkg 1.0.7 [required by fpath, uuidm] + - install uri 4.4.0 [required by json-data-encoding] + - install uuidm 0.9.9 [required by goblint] + - install yaml 3.2.0 [required by goblint] + - install yojson 2.2.2 [required by goblint] + - install zarith 1.14 [required by goblint] + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +Faking installation of base-bigarray.base +Faking installation of base-threads.base +Faking installation of base-unix.base +Faking installation of conf-autoconf.0.2 +Faking installation of conf-gcc.1.0 +Faking installation of conf-gmp.4 +Faking installation of conf-perl.2 +Faking installation of conf-pkg-config.3 +Faking installation of host-arch-arm64.1 +Faking installation of host-system-other.1 +Faking installation of ocaml-base-compiler.5.2.0 +Faking installation of ocaml-config.3 +Faking installation of ocaml.5.2.0 +Faking installation of base-domains.base +Faking installation of base-nnp.base +Faking installation of dune.3.16.0 +Faking installation of bigarray-compat.1.1.0 +Faking installation of camlp-streams.5.0.1 +Faking installation of catapult.0.2 +Faking installation of catapult-file.0.2 +Faking installation of cppo.1.7.0 +Faking installation of arg-complete.0.1.0 +Faking installation of cpu.2.0.0 +Faking installation of csexp.1.5.2 +Faking installation of dune-build-info.3.16.0 +Faking installation of dune-configurator.3.16.0 +Faking installation of bigstringaf.0.10.0 +Faking installation of jsonrpc.1.19.0 +Faking installation of num.1.5-1 +Faking installation of ocaml-compiler-libs.v0.17.0 +Faking installation of ocaml-options-vanilla.1 +Faking installation of ocaml-syntax-shims.1.0.0 +Faking installation of angstrom.0.16.1 +Faking installation of ocamlbuild.0.15.0 +Faking installation of ocamlfind.1.9.6 +Faking installation of batteries.3.8.0 +Faking installation of ordering.3.16.0 +Faking installation of pp.1.2.0 +Faking installation of dyn.3.16.0 +Faking installation of ppx_derivers.1.2.1 +Faking installation of qcheck-core.0.22 +Faking installation of seq.base +Faking installation of sexplib0.v0.17.0 +Faking installation of stdlib-shims.0.3.0 +Faking installation of fileutils.0.6.4 +Faking installation of integers.0.7.0 +Faking installation of ctypes.0.23.0 +Faking installation of ppxlib.0.33.0 +Faking installation of ppx_deriving.6.0.3 +Faking installation of ppx_deriving_hash.0.1.2 +Faking installation of sha.1.15.4 +Faking installation of stdune.3.16.0 +Faking installation of dune-private-libs.3.16.0 +Faking installation of dune-site.3.16.0 +Faking installation of stringext.1.6.0 +Faking installation of topkg.1.0.7 +Faking installation of astring.0.8.5 +Faking installation of fmt.0.9.0 +Faking installation of cstruct.6.2.0 +Faking installation of fpath.0.7.3 +Faking installation of hex.1.5.0 +Faking installation of logs.0.7.0 +Faking installation of rresult.0.7.0 +Faking installation of bos.0.2.1 +Faking installation of uri.4.4.0 +Faking installation of json-data-encoding.1.0.1 +Faking installation of uuidm.0.9.9 +Faking installation of yaml.3.2.0 +Faking installation of yojson.2.2.2 +Faking installation of ppx_deriving_yojson.3.9.0 +Faking installation of zarith.1.14 +Faking installation of goblint-cil.2.0.4 +Done. +### opam install --check ./analyzer +All dependencies installed +### opam install --show --deps-only ./analyzer +The following actions would be performed: +=== install 1 package + - install ppx_blob 0.9.0 [required by goblint] +### opam install --show --check --locked ./analyzer +All dependencies installed +### opam install --show --deps-only --locked ./analyzer +The following actions would be performed: +=== remove 3 packages + - remove base-domains base [conflicts with ocaml] + - remove ocaml-base-compiler 5.2.0 [conflicts with ocaml-config] + - remove ocaml-options-vanilla 1 [conflicts with ocaml-option-nnp, ocaml-option-flambda] +=== downgrade 17 packages + - downgrade angstrom 0.16.1 to 0.16.0 [required by goblint] + - downgrade bigstringaf 0.10.0 to 0.9.1 [required by goblint] + - downgrade cppo 1.7.0 to 1.6.9 [required by goblint] + - downgrade ctypes 0.23.0 to 0.22.0 [required by goblint] + - downgrade jsonrpc 1.19.0 to 1.17.0 [required by goblint] + - downgrade num 1.5-1 to 1.5 [required by goblint] + - downgrade ocaml 5.2.0 to 4.14.2 [required by goblint] + - downgrade ocaml-compiler-libs v0.17.0 to v0.12.4 [required by goblint] + - downgrade ocaml-config 3 to 2 [required by goblint] + - downgrade ocamlbuild 0.15.0 to 0.14.3 [required by goblint] + - downgrade ppx_deriving 6.0.3 to 6.0.2 [required by goblint] + - downgrade ppx_deriving_yojson 3.9.0 to 3.8.0 [required by goblint] + - downgrade ppxlib 0.33.0 to 0.32.1 [required by goblint] + - downgrade qcheck-core 0.22 to 0.21.3 [required by goblint] + - downgrade sexplib0 v0.17.0 to v0.16.0 [required by goblint] + - downgrade uuidm 0.9.9 to 0.9.8 [required by goblint] + - downgrade yojson 2.2.2 to 2.2.1 [required by goblint] +=== recompile 42 packages + - recompile arg-complete 0.1.0 [uses cppo, dune] + - recompile astring 0.8.5 [uses ocaml] + - recompile base-nnp base [uses base-domains] + - recompile batteries 3.8.0 [uses ocaml] + - recompile bigarray-compat 1.1.0 [uses ocaml] + - recompile bos 0.2.1 [uses ocaml] + - recompile camlp-streams 5.0.1 [uses ocaml] + - recompile catapult 0.2 [uses ocaml] + - recompile catapult-file 0.2 [uses ocaml] + - recompile cpu 2.0.0 [uses ocaml] + - recompile csexp 1.5.2 [uses ocaml] + - recompile cstruct 6.2.0 [uses ocaml] + - recompile dune 3.16.0 [uses ocaml] + - recompile dune-build-info 3.16.0 [uses ocaml] + - recompile dune-configurator 3.16.0 [uses ocaml] + - recompile dune-private-libs 3.16.0 [uses ocaml] + - recompile dune-site 3.16.0 [uses dune] + - recompile dyn 3.16.0 [uses ocaml] + - recompile fileutils 0.6.4 [uses ocaml] + - recompile fmt 0.9.0 [uses ocaml] + - recompile fpath 0.7.3 [uses ocaml] + - recompile goblint-cil 2.0.4 (pinned) [uses ocaml] + - recompile hex 1.5.0 [uses ocaml] + - recompile integers 0.7.0 [uses ocaml] + - recompile json-data-encoding 1.0.1 [uses ocaml] + - recompile logs 0.7.0 [uses ocaml] + - recompile ocaml-syntax-shims 1.0.0 [uses ocaml] + - recompile ocamlfind 1.9.6 [uses ocaml] + - recompile ordering 3.16.0 [uses ocaml] + - recompile pp 1.2.0 [uses ocaml] + - recompile ppx_derivers 1.2.1 [uses ocaml] + - recompile ppx_deriving_hash 0.1.2 [uses dune] + - recompile rresult 0.7.0 [uses ocaml] + - recompile seq base [uses ocaml] + - recompile sha 1.15.4 [uses ocaml] + - recompile stdlib-shims 0.3.0 [uses ocaml] + - recompile stdune 3.16.0 [uses ocaml] + - recompile stringext 1.6.0 [uses ocaml] + - recompile topkg 1.0.7 [uses ocaml] + - recompile uri 4.4.0 [uses angstrom] + - recompile yaml 3.2.0 [uses ocaml] + - recompile zarith 1.14 [uses ocaml] +=== install 12 packages + - install apron v0.9.15 (pinned) [required by goblint] + - install base-bytes base [required by goblint] + - install camlidl 1.12 (pinned) [required by goblint] + - install conf-findutils 1 [required by goblint] + - install conf-gmp-paths 1 [required by goblint] + - install conf-mpfr-paths 1 [required by goblint] + - install ez-conf-lib 2 [required by goblint] + - install mlgmpidl 1.3.0 [required by goblint] + - install ocaml-option-flambda 1 [required by goblint] + - install ocaml-option-nnp 1 [required by base-nnp, ocaml-variants] + - install ocaml-variants 4.14.2+options [required by goblint] + - install ppx_blob 0.9.0 [required by goblint] diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index ce89cec8454..c9f7ac011ba 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -1,4 +1,25 @@ +(rule + (alias reftest-6248) + (enabled_if (and (or (<> %{env:TESTALL=1} 0) ))) + (action + (diff 6248.test 6248.out))) + +(alias + (name reftest) + (enabled_if (and (or (<> %{env:TESTALL=1} 0) ))) + (deps (alias reftest-6248))) + +(rule + (targets 6248.out) + (deps root-6a44505c76c94ac5d2ad231b5259cdfe10b9970d) + (enabled_if (and (or (<> %{env:TESTALL=1} 0) ))) + (package opam) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:6248.test} %{read-lines:testing-env})))) + (rule (alias reftest-admin-cache) (enabled_if (and (or (<> %{env:TESTALL=1} 0) (= %{env:TESTN0REP0=0} 1)))) @@ -2138,6 +2159,27 @@ --no-setup --bypass-checks --no-opamrc --bare file://%{dep:opam-repo-3235916}))))) +(rule + (targets opam-archive-6a44505c76c94ac5d2ad231b5259cdfe10b9970d.tar.gz) + (action (run curl --silent -Lo %{targets} https://github.com/ocaml/opam-repository/archive/6a44505c76c94ac5d2ad231b5259cdfe10b9970d.tar.gz))) + +(rule + (targets opam-repo-6a44505c76c94ac5d2ad231b5259cdfe10b9970d) + (action + (progn + (run mkdir -p %{targets}) + (run tar -C %{targets} -xzf %{dep:opam-archive-6a44505c76c94ac5d2ad231b5259cdfe10b9970d.tar.gz} --strip-components=1)))) + +(rule + (targets root-6a44505c76c94ac5d2ad231b5259cdfe10b9970d) + (deps opam-root-version) + (action + (progn + (ignore-stdout + (run %{bin:opam} init --root=%{targets} + --no-setup --bypass-checks --no-opamrc --bare + file://%{dep:opam-repo-6a44505c76c94ac5d2ad231b5259cdfe10b9970d}))))) + (rule (targets opam-archive-7090735c.tar.gz) (action (run curl --silent -Lo %{targets} https://github.com/ocaml/opam-repository/archive/7090735c.tar.gz))) From 7f616a2ffbeeb7f36f5fd10d8a651dd6fc2ddf8e Mon Sep 17 00:00:00 2001 From: Kate Date: Tue, 22 Oct 2024 18:52:00 +0100 Subject: [PATCH 6/6] the fix --- src/client/opamAuxCommands.ml | 22 ++++++++++++++++++++++ tests/reftests/6248.test | 20 +++++++++++--------- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/src/client/opamAuxCommands.ml b/src/client/opamAuxCommands.ml index da456eb6727..89c1032301d 100644 --- a/src/client/opamAuxCommands.ml +++ b/src/client/opamAuxCommands.ml @@ -255,6 +255,28 @@ let autopin_aux st ?quiet ?recurse ?subpath ?locked let to_pin, atoms = resolve_locals ?quiet ?recurse ?subpath ?locked atom_or_local_list in + let atoms = + (* Ensure the atoms are set to their expected version *) + List.map (function + | name, None -> + begin match + List.find_opt + (fun {pin_name; _} -> OpamPackage.Name.equal pin_name name) + to_pin + with + | None -> (name, Some (`Eq, OpamPinCommand.default_version st name)) + | Some {pin = {pin_file; _}; _} -> + let opam_file = OpamFile.OPAM.safe_read pin_file in + let v = match OpamFile.OPAM.version_opt opam_file with + | None -> OpamPinCommand.default_version st name + | Some v -> v + in + (name, Some (`Eq, v)) + end + | (_, Some _) as atom -> atom + (* TODO: does autopin really need other forms of atoms than `Eq ? *) + ) atoms + in if to_pin = [] then atoms, to_pin, OpamPackage.Set.empty, OpamPackage.Set.empty else diff --git a/tests/reftests/6248.test b/tests/reftests/6248.test index cdc2a350cbf..a9d0b38d3ce 100644 --- a/tests/reftests/6248.test +++ b/tests/reftests/6248.test @@ -16,7 +16,7 @@ camlidl is now pinned to git+https://github.com/xavierleroy/camlidl.git#1c1e87e3 [apron.v0.9.15] synchronised (no changes) apron is now pinned to git+https://github.com/antoinemine/apron.git#418a217c7a70dae3f422678f3aaba38ae374d91a (version v0.9.15) The following actions will be faked: -=== install 72 packages +=== install 73 packages - install angstrom 0.16.1 [required by uri] - install arg-complete 0.1.0 [required by goblint] - install astring 0.8.5 [required by fpath] @@ -70,11 +70,12 @@ The following actions will be faked: - install ocamlfind 1.9.6 [required by fpath, batteries, uuidm] - install ordering 3.16.0 [required by dyn, stdune] - install pp 1.2.0 [required by dune-private-libs] + - install ppx_blob 0.9.0 [required by goblint] - install ppx_derivers 1.2.1 [required by ppx_deriving] - install ppx_deriving 6.0.3 [required by goblint] - install ppx_deriving_hash 0.1.2 [required by goblint] - install ppx_deriving_yojson 3.9.0 [required by goblint] - - install ppxlib 0.33.0 [required by ppx_deriving_hash] + - install ppxlib 0.33.0 [required by goblint] - install qcheck-core 0.22 [required by goblint] - install rresult 0.7.0 [required by bos] - install seq base [required by fileutils] @@ -139,6 +140,7 @@ Faking installation of fileutils.0.6.4 Faking installation of integers.0.7.0 Faking installation of ctypes.0.23.0 Faking installation of ppxlib.0.33.0 +Faking installation of ppx_blob.0.9.0 Faking installation of ppx_deriving.6.0.3 Faking installation of ppx_deriving_hash.0.1.2 Faking installation of sha.1.15.4 @@ -167,11 +169,11 @@ Done. ### opam install --check ./analyzer All dependencies installed ### opam install --show --deps-only ./analyzer -The following actions would be performed: -=== install 1 package - - install ppx_blob 0.9.0 [required by goblint] +Nothing to do. ### opam install --show --check --locked ./analyzer -All dependencies installed +Missing dependencies: +angstrom apron base-bytes bigstringaf camlidl conf-findutils conf-gmp-paths conf-mpfr-paths cppo ctypes ez-conf-lib jsonrpc mlgmpidl num ocaml ocaml-compiler-libs ocaml-config ocaml-option-flambda ocaml-variants ocamlbuild ppx_deriving ppx_deriving_yojson ppxlib qcheck-core sexplib0 uuidm yojson +# Return code 1 # ### opam install --show --deps-only --locked ./analyzer The following actions would be performed: === remove 3 packages @@ -196,7 +198,7 @@ The following actions would be performed: - downgrade sexplib0 v0.17.0 to v0.16.0 [required by goblint] - downgrade uuidm 0.9.9 to 0.9.8 [required by goblint] - downgrade yojson 2.2.2 to 2.2.1 [required by goblint] -=== recompile 42 packages +=== recompile 43 packages - recompile arg-complete 0.1.0 [uses cppo, dune] - recompile astring 0.8.5 [uses ocaml] - recompile base-nnp base [uses base-domains] @@ -227,6 +229,7 @@ The following actions would be performed: - recompile ocamlfind 1.9.6 [uses ocaml] - recompile ordering 3.16.0 [uses ocaml] - recompile pp 1.2.0 [uses ocaml] + - recompile ppx_blob 0.9.0 [uses ocaml] - recompile ppx_derivers 1.2.1 [uses ocaml] - recompile ppx_deriving_hash 0.1.2 [uses dune] - recompile rresult 0.7.0 [uses ocaml] @@ -239,7 +242,7 @@ The following actions would be performed: - recompile uri 4.4.0 [uses angstrom] - recompile yaml 3.2.0 [uses ocaml] - recompile zarith 1.14 [uses ocaml] -=== install 12 packages +=== install 11 packages - install apron v0.9.15 (pinned) [required by goblint] - install base-bytes base [required by goblint] - install camlidl 1.12 (pinned) [required by goblint] @@ -251,4 +254,3 @@ The following actions would be performed: - install ocaml-option-flambda 1 [required by goblint] - install ocaml-option-nnp 1 [required by base-nnp, ocaml-variants] - install ocaml-variants 4.14.2+options [required by goblint] - - install ppx_blob 0.9.0 [required by goblint]