Skip to content

Commit 59dd56f

Browse files
authored
Portable lockdirs by default (#12680)
* Enable portable lockdirs by default Signed-off-by: Stephen Sherratt <[email protected]> * Update tests to expect portable lockdirs Signed-off-by: Stephen Sherratt <[email protected]> * Stop setting feature flag in portable lockdir tests Signed-off-by: Stephen Sherratt <[email protected]> * Update autolock test to allow rebuilds Rebuilds happen because the internal package solution generated when autolocking is specialized to the current platform. This allows building on platforms which portable lockdirs don't support by default, however it means that packages built from a pre-existing portable lockdir need to be rebuilt with the new build plan. Signed-off-by: Stephen Sherratt <[email protected]> --------- Signed-off-by: Stephen Sherratt <[email protected]>
2 parents aa803cf + 77b26c7 commit 59dd56f

File tree

106 files changed

+786
-632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+786
-632
lines changed

boot/configure.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ let default_toggles : (string * [ `Disabled | `Enabled ]) list =
2121
[ "toolchains", `Enabled
2222
; "lock_dev_tool", `Disabled
2323
; "bin_dev_tools", `Disabled
24-
; "portable_lock_dir", `Disabled
24+
; "portable_lock_dir", `Enabled
2525
]
2626
;;
2727

src/dune_rules/setup.defaults.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ let prefix : string option = None
1515
let toolchains = `Enabled
1616
let lock_dev_tool = `Disabled
1717
let bin_dev_tools = `Disabled
18-
let portable_lock_dir = `Disabled
18+
let portable_lock_dir = `Enabled

test/blackbox-tests/test-cases/pkg/additional-constraints-ocaml-system.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ A package that depends on ocaml:
3434

3535
Try solving without additional constraints:
3636
$ add_mock_repo_if_needed
37-
$ dune pkg lock
37+
$ dune_pkg_lock_normalized
3838
Solution for dune.lock:
3939
- ocaml.0.0.1
4040
- ocaml-base-compiler.0.0.1
@@ -51,7 +51,7 @@ Now make a workspace file adding the constarint on ocaml-system:
5151
> EOF
5252

5353
Solve again. This time ocaml-system is chosen.
54-
$ dune pkg lock
54+
$ dune_pkg_lock_normalized
5555
Solution for dune.lock:
5656
- ocaml.0.0.1
5757
- ocaml-system.0.0.1

test/blackbox-tests/test-cases/pkg/additional-constraints.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,9 @@ There are no valid version of foo at the moment:
5151
> (name x)
5252
> (depends foo bar))
5353
> EOF
54-
Error: Unable to solve dependencies for the following lock directories:
55-
Lock directory dune.lock:
54+
Error:
55+
Unable to solve dependencies while generating lock directory: dune.lock
56+
5657
Couldn't solve the package dependency formula.
5758
Selected candidates: bar.1.9.1 x.dev
5859
- foo -> (problem)

test/blackbox-tests/test-cases/pkg/check-dependency-hash.t

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ Start with a project with a single package with no dependencies:
2121
(repositories
2222
(complete false)
2323
(used))
24+
25+
(solved_for_platforms
26+
((arch x86_64)
27+
(os linux))
28+
((arch arm64)
29+
(os linux))
30+
((arch x86_64)
31+
(os macos))
32+
((arch arm64)
33+
(os macos)))
2434
$ dune pkg validate-lockdir
2535

2636
Add a dependency to the project:
@@ -57,6 +67,16 @@ Add a non-local dependency to the package:
5767
(repositories
5868
(complete false)
5969
(used))
70+
71+
(solved_for_platforms
72+
((arch x86_64)
73+
(os linux))
74+
((arch arm64)
75+
(os linux))
76+
((arch x86_64)
77+
(os macos))
78+
((arch arm64)
79+
(os macos)))
6080
$ dune pkg validate-lockdir
6181

6282
Add a second dependency to the project:

test/blackbox-tests/test-cases/pkg/compute-checksums-when-missing.t

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ A file that will comprise the package source:
2626

2727
Replace the path in the lockfile as it would otherwise include the sandbox
2828
path.
29-
$ cat ${default_lock_dir}/foo.pkg
29+
$ cat ${default_lock_dir}/foo.0.0.1.pkg
3030
(version 0.0.1)
3131

3232
(source
@@ -51,10 +51,9 @@ Recreate the foo package with a fake port number to signal that the file will
5151
Package "foo" has source archive which lacks a checksum.
5252
The source archive will be downloaded from: http://0.0.0.0:9000
5353
Dune will compute its own checksum for this source archive.
54-
Warning: Download failed with code 404
5554
Solution for dune.lock:
5655
- foo.0.0.1
57-
$ cat ${default_lock_dir}/foo.pkg
56+
$ cat ${default_lock_dir}/foo.0.0.1.pkg
5857
(version 0.0.1)
5958

6059
(source

test/blackbox-tests/test-cases/pkg/conflict-class.t

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ Local conflict class defined in a local package:
2929
> (lang dune 3.11)
3030
> EOF
3131

32-
$ dune pkg lock
33-
Error: Unable to solve dependencies for the following lock directories:
34-
Lock directory dune.lock:
32+
$ dune_pkg_lock_normalized
33+
Error:
34+
Unable to solve dependencies while generating lock directory: dune.lock
35+
3536
Couldn't solve the package dependency formula.
3637
Selected candidates: foo.dev x.dev foo&x
3738
- bar -> (problem)
@@ -48,9 +49,10 @@ Now the conflict class comes from the opam repository
4849

4950
$ rm foo.opam
5051

51-
$ dune pkg lock
52-
Error: Unable to solve dependencies for the following lock directories:
53-
Lock directory dune.lock:
52+
$ dune_pkg_lock_normalized
53+
Error:
54+
Unable to solve dependencies while generating lock directory: dune.lock
55+
5456
Couldn't solve the package dependency formula.
5557
Selected candidates: foo.0.0.1 x.dev
5658
- bar -> (problem)

test/blackbox-tests/test-cases/pkg/conflicts.t

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ The solver should say no solution rather than just ignoring the conflict.
1717
> (conflicts foo)
1818
> (depends bar))
1919
> EOF
20-
Error: Unable to solve dependencies for the following lock directories:
21-
Lock directory dune.lock:
20+
Error:
21+
Unable to solve dependencies while generating lock directory: dune.lock
22+
2223
Couldn't solve the package dependency formula.
2324
Selected candidates: bar.0.0.1 x.dev
2425
- foo -> (problem)
@@ -42,8 +43,9 @@ There could be more than one conflict and they can have version constraints:
4243
> (conflicts (foo (< 0.2)) (foo2 (< 0.2)))
4344
> (depends bar bar2))
4445
> EOF
45-
Error: Unable to solve dependencies for the following lock directories:
46-
Lock directory dune.lock:
46+
Error:
47+
Unable to solve dependencies while generating lock directory: dune.lock
48+
4749
Couldn't solve the package dependency formula.
4850
Selected candidates: bar.0.0.1 bar2.0.0.1 x.dev
4951
- foo -> (problem)
@@ -69,8 +71,9 @@ disjunction, either package is problematic:
6971

7072
$ mkpkg dune 3.11
7173
$ echo '(lang dune 3.11)' | solve_project 2>&1 | sed -E 's/3.[0-9]+/3.XX/'
72-
Error: Unable to solve dependencies for the following lock directories:
73-
Lock directory dune.lock:
74+
Error:
75+
Unable to solve dependencies while generating lock directory: dune.lock
76+
7477
Couldn't solve the package dependency formula.
7578
Selected candidates: bar.0.0.1 bar2.0.0.1 x.dev
7679
- dune -> dune.3.XX
@@ -86,8 +89,9 @@ Adding a new version of `foo` only resolves one conflict:
8689

8790
$ mkpkg foo 0.2
8891
$ echo '(lang dune 3.11)' | solve_project 2>&1 | sed -E 's/3.[0-9]+/3.XX/'
89-
Error: Unable to solve dependencies for the following lock directories:
90-
Lock directory dune.lock:
92+
Error:
93+
Unable to solve dependencies while generating lock directory: dune.lock
94+
9195
Couldn't solve the package dependency formula.
9296
Selected candidates: bar.0.0.1 bar2.0.0.1 foo.0.2 x.dev
9397
- dune -> dune.3.XX

test/blackbox-tests/test-cases/pkg/constraint-conjunction.t

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ constraints.
1717
- a.0.0.1
1818
- foo.0.0.1
1919

20-
$ cat ${default_lock_dir}/foo.pkg
20+
$ cat ${default_lock_dir}/foo.0.0.1.pkg
2121
(version 0.0.1)
2222

23-
(depends a)
23+
(depends
24+
(all_platforms (a)))

0 commit comments

Comments
 (0)