-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(pkg): set [post = true] when solving (#10752)
Signed-off-by: Rudi Grinberg <me@rgrinberg.com>
- Loading branch information
Showing
10 changed files
with
218 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
test/blackbox-tests/test-cases/pkg/compiler-post-dependencies.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Exercise dune resolving the post dependencies found in compiler packages. | ||
|
||
$ . ./helpers.sh | ||
$ mkrepo | ||
|
||
$ cat >dune-workspace << EOF | ||
> (lang dune 3.16) | ||
> (lock_dir | ||
> (path dune.lock) | ||
> (repositories mock) | ||
> (solver_env | ||
> (os linux))) | ||
> EOF | ||
|
||
$ mkpkg host-system-other | ||
|
||
$ mkpkg system-mingw << EOF | ||
> available: os = "win32" | ||
> EOF | ||
|
||
$ mkpkg ocaml << EOF | ||
> depends: [ | ||
> "ocaml-base-compiler" | ||
> ] | ||
> EOF | ||
|
||
This package has a dependency cycle with the "ocaml" package, broken | ||
by the use of post dependencies. It also contains a formula with no | ||
solutions when the "post" variable is set to "false" on non-windows | ||
systems. Opam evaluates dependency formulae with post=true and then | ||
does further filtering to remove post dependencies from dependency | ||
lists to prevent circular dependencies at package build time. | ||
$ mkpkg ocaml-base-compiler << EOF | ||
> depends: [ | ||
> "ocaml" {post} | ||
> (("arch-x86_64" {os = "win32" & arch = "x86_64"} & "system-mingw" & | ||
> "mingw-w64-shims" {os-distribution = "cygwin" & build}) | | ||
> ("arch-x86_32" {os = "win32"} & "ocaml-option-bytecode-only" & | ||
> "system-mingw" & | ||
> "mingw-w64-shims" {os-distribution = "cygwin" & build}) | | ||
> "host-system-other" {os != "win32" & post}) | ||
> ] | ||
> EOF | ||
|
||
$ solve ocaml-base-compiler | ||
Solution for dune.lock: | ||
- host-system-other.0.0.1 | ||
- ocaml.0.0.1 | ||
- ocaml-base-compiler.0.0.1 | ||
|
||
Ensure that packages can be resolved at build time. This checks that | ||
the dependency cycle between the "ocaml" and "ocaml-base-compiler" | ||
packages is successfully broken by the use of post dependencies. | ||
$ dune build |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
Solving for post dependencies: | ||
|
||
$ . ./helpers.sh | ||
$ mkrepo | ||
|
||
$ mkpkg bar | ||
|
||
$ mkpkg foo <<EOF | ||
> depends: [ "bar" {post} ] | ||
> EOF | ||
|
||
We don't need bar, but we still include it: | ||
|
||
$ solve foo | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.0.0.1 | ||
|
||
$ cat dune.lock/foo.pkg dune.lock/bar.pkg | ||
(version 0.0.1) | ||
(version 0.0.1) | ||
|
||
Self dependency | ||
|
||
$ mkpkg foo <<EOF | ||
> depends: [ "foo" {post} ] | ||
> EOF | ||
|
||
$ solve foo | ||
Solution for dune.lock: | ||
- foo.0.0.1 | ||
|
||
$ cat dune.lock/foo.pkg | ||
(version 0.0.1) | ||
|
||
Using post to break cycle: | ||
|
||
$ mkpkg foo <<EOF | ||
> depends: [ "bar" {post} ] | ||
> EOF | ||
|
||
$ mkpkg bar <<EOF | ||
> depends: [ "foo" ] | ||
> EOF | ||
|
||
$ solve bar | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.0.0.1 | ||
|
||
$ cat dune.lock/foo.pkg dune.lock/bar.pkg | ||
(version 0.0.1) | ||
(version 0.0.1) | ||
|
||
(depends foo) | ||
|
||
post "cycle": | ||
|
||
$ mkpkg foo <<EOF | ||
> depends: [ "bar" {post} ] | ||
> EOF | ||
|
||
$ mkpkg bar <<EOF | ||
> depends: [ "foo" {post} ] | ||
> EOF | ||
|
||
$ solve foo | ||
Solution for dune.lock: | ||
- bar.0.0.1 | ||
- foo.0.0.1 | ||
|
||
$ cat dune.lock/foo.pkg dune.lock/bar.pkg | ||
(version 0.0.1) | ||
(version 0.0.1) | ||
|
||
In depopts: | ||
|
||
$ mkpkg foo <<EOF | ||
> depopts: [ "bar" {post} ] | ||
> EOF | ||
|
||
$ mkpkg bar | ||
|
||
$ solve foo | ||
Solution for dune.lock: | ||
- foo.0.0.1 |