Skip to content

Commit c4961ba

Browse files
authored
Merge pull request #5701 from rjbou/check_installed_undef_default
check install: undefined variable default to false
2 parents 51b4bb7 + adc0b99 commit c4961ba

File tree

3 files changed

+49
-1
lines changed

3 files changed

+49
-1
lines changed

master_changes.md

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ users)
2727
## Install
2828
* [BUG] On install driven by `.install` file, track intermediate directories too, in order to have them suppressed at package removal [#5691 @rjbou - fix #5688]
2929
* [BUG] With `--assume-built`, resolve variables in depends filter according switch & global environment, not only depends predefined variables [#570 @rjbou - fix #5698]
30+
* [BUG] Handle undefined variables defaults to false in dependencies formula resolution for assume built [#5701 rjbou]
3031

3132
## Remove
3233

@@ -119,6 +120,7 @@ users)
119120
* dot-install: generalise inner script & use less generic filenames [#5691 @rjbou]
120121
* dot-install: add a test for removal of non specified in .install empty directories [#5701 @rjbou]
121122
* Add test in assume-built for depends with switch variable filters [#5700 @rjbou]
123+
* Add undefined variable handling in assume built test [#5701 @rjbou]
122124

123125
### Engine
124126
* With real path resolved for all opam temp dir, remove `/private` from mac temp dir regexp [#5654 @rjbou]

src/client/opamClient.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1096,7 +1096,7 @@ let check_installed ~build ~post t atoms =
10961096
let cnf_formula =
10971097
OpamSwitchState.opam t pkg
10981098
|> OpamFile.OPAM.depends
1099-
|> OpamFilter.filter_formula (env pkg)
1099+
|> OpamFilter.filter_formula ~default:false (env pkg)
11001100
|> OpamFormula.to_cnf
11011101
in
11021102
let missing_conj =

tests/reftests/assume-built.test

+46
Original file line numberDiff line numberDiff line change
@@ -225,3 +225,49 @@ The following actions will be performed:
225225
-> installed ongoing.1.0
226226
Done.
227227
### test -f ./ongoing/installed
228+
### : assume built & undefined opam file variables :
229+
### OPAMSTRICT=0
230+
### opam unpin ongoing
231+
Ok, ongoing is no longer pinned to git+file://${BASEDIR}/ongoing#master (version 1.0)
232+
The following actions will be performed:
233+
=== remove 1 package
234+
- remove ongoing 1.0
235+
236+
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
237+
-> removed ongoing.1.0
238+
Done.
239+
### <pin:ongoing/ongoing.opam>
240+
opam-version: "2.0"
241+
depends: [
242+
"qux"
243+
"foo" { not-defined }
244+
]
245+
build: [
246+
[ "test" "-f" "ongoing.txt" ]
247+
[ "sh" "-c" "cat ongoing.txt > out" ]
248+
]
249+
install: [
250+
[ "test" "-f" "out" ]
251+
[ "test" "-f" "out2" ] { not-defined }
252+
[ "touch" "installed"]
253+
]
254+
### git -C ongoing clean -fdqx
255+
### opam pin ./ongoing -n
256+
Package ongoing does not exist, create as a NEW package? [y/n] y
257+
ongoing is now pinned to git+file://${BASEDIR}/ongoing#master (version dev)
258+
### touch ongoing/out
259+
### opam install ongoing --assume-built --with-test
260+
261+
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
262+
[NOTE] Ignoring uncommitted changes in ${BASEDIR}/ongoing (`--working-dir' not specified or specified with no argument).
263+
[ongoing.dev] synchronised (no changes)
264+
265+
The following actions will be performed:
266+
=== install 1 package
267+
- install ongoing dev (pinned)
268+
269+
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
270+
-> retrieved ongoing.dev (no changes)
271+
-> installed ongoing.dev
272+
Done.
273+
### test -f ./ongoing/installed

0 commit comments

Comments
 (0)