@@ -33,16 +33,21 @@ Generate a `dune-project` file.
3333Run the solver and generate a lock directory.
3434
3535 $ dune build @ pkg-lock
36+ $ show_solution
3637 Solution for dune. lock:
3738 - bar. 0. 5. 0
3839 - baz. 0. 1. 0
3940 - foo. 0. 0. 1
4041
4142Helper to the name and contents of each file in the lock directory separated by
4243" ---" , sorting by filename for consistency.
43- $ print_all() { find $ {default_lock_dir} -type f | sort | xargs -I{} sh -c " printf '{ } :\n\n '; cat { } ; printf '\n\n ---\n\n '" ; }
44+
45+ $ print_all() {
46+ > ls $ {default_lock_dir} | sort | xargs -I{} sh -c " printf 'dune.lock/{ } :\n\n '; cat ${ default_lock_dir} /{ } ; printf '\n\n ---\n\n '" ;
47+ > }
4448
4549Print the contents of each file in the lockdir:
50+
4651 $ print_all
4752 dune. lock/ bar. pkg:
4853
@@ -82,7 +87,8 @@ Print the contents of each file in the lockdir:
8287
8388
8489Run the solver again preferring oldest versions of dependencies:
85- $ dune pkg lock -- version-preference= oldest
90+ $ dune build @ pkg-lock -- version-preference= oldest
91+ $ show_solution
8692 Solution for dune. lock:
8793 - bar. 0. 4. 0
8894 - baz. 0. 1. 0
@@ -138,9 +144,7 @@ Regenerate the `dune-project` file introducing an unsatisfiable constraint.
138144
139145Run the solver again. This time it will fail .
140146 $ dune build @ pkg-lock
141- Error: Unable to solve dependencies for the following lock directories:
142- Lock directory dune. lock:
143- Couldn't solve the package dependency formula.
147+ Error: Couldn't solve the package dependency formula.
144148 Selected candidates: baz. 0. 1. 0 foo. 0. 0. 1 lockfile_generation_test. dev
145149 - bar -> (problem)
146150 No usable implementations:
@@ -153,6 +157,11 @@ Run the solver again. This time it will fail.
153157 bar. 0. 0. 1:
154158 Package does not satisfy constraints of local package
155159 lockfile_generation_test
160+ -> required by _build/ _private/ default /. lock/ dune. lock/ content
161+ -> required by lock directory environment for context " default"
162+ -> required by base environment for context " default"
163+ -> required by loading findlib for context " default"
164+ -> required by loading the OCaml compiler for context " default"
156165 [1 ]
157166
158167We'll also test how the lockfile generation works with alternate solutions.
@@ -173,10 +182,12 @@ After running this we expact a solution that has either `bar` or `baz` but not
173182both.
174183
175184 $ dune build @ pkg-lock
185+ $ show_solution
176186 Solution for dune. lock:
177- - bar. 0. 5. 0
178187 - bar-or-baz. 0. 0. 1
179- Top level or is simple, but does nested or work? nested-r defines nested or
188+ - bar. 0. 5. 0
189+
190+ Top level OR is simple, but does nested OR work? `nested-or` defines nested OR
180191patterns that can 't be simplified
181192
182193 $ cat > dune-project << EOF
@@ -197,11 +208,13 @@ After runninng we expect the solution to have quux and either baz or quz as
197208well as bar or qux.
198209
199210 $ dune build @ pkg-lock
211+ $ show_solution
200212 Solution for dune. lock:
201213 - bar. 0. 5. 0
202214 - baz. 0. 1. 0
203215 - nested-or. 0. 0. 1
204216 - quux. 0. 0. 1
217+
205218In the dependency formulas, & should bind stronger than | so if we depend on
206219bar and quux or baz, it should pick the first two or the last one , but nothing
207220in between.
@@ -217,6 +230,7 @@ in between.
217230 > EOF
218231
219232 $ dune build @ pkg-lock
233+ $ show_solution
220234 Solution for dune. lock:
221235 - bar. 0. 5. 0
222236 - priorities. 0. 0. 1
@@ -244,6 +258,7 @@ With versions 1 and 3 negated and version 4 removed via version constraint,
244258we'd expect version 2 to be chosen:
245259
246260 $ dune build @ pkg-lock
261+ $ show_solution
247262 Solution for dune. lock:
248263 - negation. 0. 0. 1
249264 - pkg. 2
0 commit comments