diff --git a/master_changes.md b/master_changes.md index 5208994bd3f..b3798a7fc80 100644 --- a/master_changes.md +++ b/master_changes.md @@ -27,6 +27,7 @@ users) ## Install * [BUG] On install driven by `.install` file, track intermediate directories too, in order to have them suppressed at package removal [#5691 @rjbou - fix #5688] * [BUG] With `--assume-built`, resolve variables in depends filter according switch & global environment, not only depends predefined variables [#570 @rjbou - fix #5698] + * [BUG] Handle undefined variables defaults to false in dependencies formula resolution for assume built [#5701 rjbou] ## Remove @@ -119,6 +120,7 @@ users) * dot-install: generalise inner script & use less generic filenames [#5691 @rjbou] * dot-install: add a test for removal of non specified in .install empty directories [#5701 @rjbou] * Add test in assume-built for depends with switch variable filters [#5700 @rjbou] + * Add undefined variable handling in assume built test [#5701 @rjbou] ### Engine * With real path resolved for all opam temp dir, remove `/private` from mac temp dir regexp [#5654 @rjbou] diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index cd2863966ad..7d44490cf71 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -1096,7 +1096,7 @@ let check_installed ~build ~post t atoms = let cnf_formula = OpamSwitchState.opam t pkg |> OpamFile.OPAM.depends - |> OpamFilter.filter_formula (env pkg) + |> OpamFilter.filter_formula ~default:false (env pkg) |> OpamFormula.to_cnf in let missing_conj = diff --git a/tests/reftests/assume-built.test b/tests/reftests/assume-built.test index df81624afae..ee021b5f611 100644 --- a/tests/reftests/assume-built.test +++ b/tests/reftests/assume-built.test @@ -225,3 +225,49 @@ The following actions will be performed: -> installed ongoing.1.0 Done. ### test -f ./ongoing/installed +### : assume built & undefined opam file variables : +### OPAMSTRICT=0 +### opam unpin ongoing +Ok, ongoing is no longer pinned to git+file://${BASEDIR}/ongoing#master (version 1.0) +The following actions will be performed: +=== remove 1 package + - remove ongoing 1.0 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> removed ongoing.1.0 +Done. +### +opam-version: "2.0" +depends: [ + "qux" + "foo" { not-defined } +] +build: [ + [ "test" "-f" "ongoing.txt" ] + [ "sh" "-c" "cat ongoing.txt > out" ] +] +install: [ + [ "test" "-f" "out" ] + [ "test" "-f" "out2" ] { not-defined } + [ "touch" "installed"] +] +### git -C ongoing clean -fdqx +### opam pin ./ongoing -n +Package ongoing does not exist, create as a NEW package? [y/n] y +ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version dev) +### touch ongoing/out +### opam install ongoing --assume-built --with-test + +<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><> +[NOTE] Ignoring uncommitted changes in ${BASEDIR}/ongoing (`--working-dir' not specified or specified with no argument). +[ongoing.dev] synchronised (no changes) + +The following actions will be performed: +=== install 1 package + - install ongoing dev (pinned) + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> retrieved ongoing.dev (no changes) +-> installed ongoing.dev +Done. +### test -f ./ongoing/installed