-
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.
Start copying commands from opam files (#8336)
Very early implementation of copying build and install commands from opam files into lockfiles meant to invite feedback on the general design of this feature before going deeper. Not yet supported: - filters on commands or arguments - string interpolation in commands - package-scoped variables other than `_` (the current package) - executing the actions Not all opam variables are supported yet. Signed-off-by: Stephen Sherratt <stephen@sherra.tt>
- Loading branch information
Showing
4 changed files
with
198 additions
and
8 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
69 changes: 69 additions & 0 deletions
69
test/blackbox-tests/test-cases/pkg/convert-opam-commands.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,69 @@ | ||
Helper shell function that generates an opam file for a package: | ||
$ mkpkg() { | ||
> name=$1 | ||
> mkdir -p mock-opam-repository/packages/$name/$name.0.0.1 | ||
> cat >mock-opam-repository/packages/$name/$name.0.0.1/opam | ||
> } | ||
|
||
Helper shell function to generate a dune-project file and generate lockdir: | ||
$ solve_project() { | ||
> cat >dune-project | ||
> dune pkg lock --opam-repository-path=mock-opam-repository | ||
> } | ||
|
||
Generate a mock opam repository | ||
$ mkdir -p mock-opam-repository | ||
$ cat >mock-opam-repository/repo <<EOF | ||
> opam-version: "2.0" | ||
> EOF | ||
|
||
$ mkpkg standard-dune <<EOF | ||
> opam-version: "2.0" | ||
> build: [ | ||
> ["dune" "subst"] {dev} | ||
> [ | ||
> "dune" | ||
> "build" | ||
> "-p" | ||
> name | ||
> "-j" | ||
> jobs | ||
> "@install" | ||
> "@runtest" {with-test} | ||
> "@doc" {with-doc} | ||
> ] | ||
> ] | ||
> install: [ make "install" ] | ||
> EOF | ||
|
||
$ mkpkg with-unknown-variable <<EOF | ||
> opam-version: "2.0" | ||
> build: [ fake "install" ] | ||
> EOF | ||
|
||
$ solve_project <<EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name x) | ||
> (depends standard-dune)) | ||
> EOF | ||
Solution for dune.lock: | ||
standard-dune.0.0.1 | ||
|
||
|
||
$ cat dune.lock/standard-dune.pkg | ||
(version 0.0.1) | ||
(install (run %{make} install)) | ||
(build (progn (run dune subst) (run dune build -p %{name} -j %{jobs} @install @runtest @doc))) | ||
|
||
$ solve_project <<EOF | ||
> (lang dune 3.8) | ||
> (package | ||
> (name x) | ||
> (depends with-unknown-variable)) | ||
> EOF | ||
Error: Encountered unknown variable "fake" while processing commands for | ||
package with-unknown-variable.0.0.1. | ||
The full command: | ||
fake "install" | ||
[1] |