From ea75c93ec958288aa9fa37ab267e88093c4ba963 Mon Sep 17 00:00:00 2001 From: Kate Date: Thu, 23 Jul 2020 13:50:35 +0100 Subject: [PATCH 1/2] Opam file generation: Use {dev} instead of {pinned} when calling dune subst Signed-off-by: Kate --- CHANGES.md | 3 +++ src/dune/opam_create.ml | 24 ++++++++++++++--- .../test-cases/dune-project-meta/main/run.t | 27 +++++++++++++++++++ 3 files changed, 50 insertions(+), 4 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 096a16d804f..f1eed086627 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -43,6 +43,9 @@ next individual executables when they're part of an `executables` stanza group (#3644, @rgrinberg) +- Use `{dev}` rather than `{pinned}` in the generated `.opam` file. (#3647, + @kit-ty-kate) + 2.6.1 (02/07/2020) ------------------ diff --git a/src/dune/opam_create.ml b/src/dune/opam_create.ml index 6f3325b4822..67438bac820 100644 --- a/src/dune/opam_create.ml +++ b/src/dune/opam_create.ml @@ -13,7 +13,7 @@ let default_build_command = [ "dune" "build" "-p" name "@doc"] {with-doc} ] |})) - and from_1_11 = + and from_1_11_before_2_7 = lazy (Opam_file.parse_value (Lexbuf.from_string ~fname:"" @@ -26,14 +26,30 @@ let default_build_command = "@doc" {with-doc} ] ] +|})) + and from_2_7 = + lazy + (Opam_file.parse_value + (Lexbuf.from_string ~fname:"" + {| +[ + [ "dune" "subst" ] {dev} + [ "dune" "build" "-p" name "-j" jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] +] |})) in fun project -> Lazy.force ( if Dune_project.dune_version project < (1, 11) then - before_1_11 - else - from_1_11 ) + before_1_11 + else if Dune_project.dune_version project < (2, 7) then + from_1_11_before_2_7 + else + from_2_7 ) let package_fields { Package.synopsis diff --git a/test/blackbox-tests/test-cases/dune-project-meta/main/run.t b/test/blackbox-tests/test-cases/dune-project-meta/main/run.t index 3e046b55e57..962a9d36401 100644 --- a/test/blackbox-tests/test-cases/dune-project-meta/main/run.t +++ b/test/blackbox-tests/test-cases/dune-project-meta/main/run.t @@ -397,3 +397,30 @@ Same with version of the language >= 2.6, we now add the constraint: depends: [ "dune" {>= "2.6"} ] + +When the version of the language >= 2.7 we use dev instead of pinned +when calling dune subst: + + $ cat > dune-project < (lang dune 2.7) + > (name foo) + > (generate_opam_files true) + > (package (name foo)) + > EOF + + $ dune build foo.opam + $ grep -A13 ^build: foo.opam + build: [ + ["dune" "subst"] {dev} + [ + "dune" + "build" + "-p" + name + "-j" + jobs + "@install" + "@runtest" {with-test} + "@doc" {with-doc} + ] + ] From 36d75ceb7fefb49e6a93c8216fd9dd296cdd53bc Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 25 Jul 2020 18:33:43 -0700 Subject: [PATCH 2/2] Switch from pinned to dev in dune's own packages Signed-off-by: Rudi Grinberg --- dune-action-plugin.opam | 2 +- dune-build-info.opam | 2 +- dune-configurator.opam | 2 +- dune-glob.opam | 2 +- dune-private-libs.opam | 2 +- dune-private-libs.opam.template | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dune-action-plugin.opam b/dune-action-plugin.opam index 9c59ec5fd30..3906e0f89ac 100644 --- a/dune-action-plugin.opam +++ b/dune-action-plugin.opam @@ -24,7 +24,7 @@ depends: [ ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/dune-build-info.opam b/dune-build-info.opam index 31284a73fd2..73e9aa4ab51 100644 --- a/dune-build-info.opam +++ b/dune-build-info.opam @@ -20,7 +20,7 @@ depends: [ ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/dune-configurator.opam b/dune-configurator.opam index c57df215af9..d273340d6da 100644 --- a/dune-configurator.opam +++ b/dune-configurator.opam @@ -22,7 +22,7 @@ depends: [ ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/dune-glob.opam b/dune-glob.opam index 67f1a3bf12e..5a339f0cb55 100644 --- a/dune-glob.opam +++ b/dune-glob.opam @@ -15,7 +15,7 @@ depends: [ ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/dune-private-libs.opam b/dune-private-libs.opam index 4f745b5d4a9..45cc4d9a9f3 100644 --- a/dune-private-libs.opam +++ b/dune-private-libs.opam @@ -22,7 +22,7 @@ depends: [ ] dev-repo: "git+https://github.com/ocaml/dune.git" build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build" diff --git a/dune-private-libs.opam.template b/dune-private-libs.opam.template index b25400dae4c..44877d421e9 100644 --- a/dune-private-libs.opam.template +++ b/dune-private-libs.opam.template @@ -1,5 +1,5 @@ build: [ - ["dune" "subst"] {pinned} + ["dune" "subst"] {dev} [ "dune" "build"