Skip to content

Commit

Permalink
Merge pull request ocaml#5701 from rjbou/check_installed_undef_default
Browse files Browse the repository at this point in the history
check install: undefined variable default to false
  • Loading branch information
kit-ty-kate authored Oct 30, 2023
2 parents 51b4bb7 + adc0b99 commit c4961ba
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion src/client/opamClient.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
46 changes: 46 additions & 0 deletions tests/reftests/assume-built.test
Original file line number Diff line number Diff line change
Expand Up @@ -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.
### <pin:ongoing/ongoing.opam>
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

0 comments on commit c4961ba

Please sign in to comment.