Skip to content

Commit

Permalink
No x-maintenance-intent in opam files for dune<3.18
Browse files Browse the repository at this point in the history
Signed-off-by: ArthurW <[email protected]>
Signed-off-by: Marek Kubica <[email protected]>
  • Loading branch information
art-w authored and Leonidas-from-XIV committed Jan 15, 2025
1 parent e777da3 commit 263bf0b
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 85 deletions.
1 change: 0 additions & 1 deletion otherlibs/dune-site/test/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ Test with an opam like installation
]
["dune" "install" "-p" name "--create-install-files" name]
]
x-maintenance-intent: ["(latest)"]

$ dune build -p a --promote-install-files=false @install

Expand Down
1 change: 0 additions & 1 deletion otherlibs/dune-site/test/run_2_9.t
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ Test with an opam like installation
]
["dune" "install" "-p" name "--create-install-files" name]
]
x-maintenance-intent: ["(latest)"]

$ dune build -p a --promote-install-files="false" @install

Expand Down
14 changes: 10 additions & 4 deletions src/dune_rules/opam_create.ml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ let insert_odoc_dep depends =
loop [] depends
;;

let maintenance_intent dune_version info =
if dune_version < (3, 18)
then None
else (
match Package_info.maintenance_intent info with
| None -> Some [ "(latest)" ]
| x -> x)
;;

let opam_fields project (package : Package.t) =
let dune_version = Dune_project.dune_version project in
let package_name = Package.name package in
Expand Down Expand Up @@ -228,10 +237,7 @@ let opam_fields project (package : Package.t) =
in
let list_fields =
[ "maintainer", Package_info.maintainers info
; ( "x-maintenance-intent"
, match Package_info.maintenance_intent info with
| None -> Some [ "(latest)" ]
| x -> x )
; "x-maintenance-intent", maintenance_intent dune_version info
; "authors", Package_info.authors info
; ( "license"
, match Package_info.license info with
Expand Down
1 change: 0 additions & 1 deletion test/blackbox-tests/test-cases/describe/describe.t
Original file line number Diff line number Diff line change
Expand Up @@ -1373,5 +1373,4 @@ opam file listing
\"@doc\" {with-doc}
]
]
x-maintenance-intent: [\"(latest)\"]
"))
1 change: 0 additions & 1 deletion test/blackbox-tests/test-cases/dune-package.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ Install as opam does
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]

$ (cd a; "dune" "build" "-p" a "@install")

Expand Down
105 changes: 34 additions & 71 deletions test/blackbox-tests/test-cases/dune-project-meta/basic-generate.t
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,19 @@ Simple test
The `dune build` should generate the opam file

$ cat >dune-project <<EOF
> (lang dune 3.18)
> (lang dune 1.10)
> (version 1.0.0)
> (name cohttp)
> (source (github mirage/ocaml-cohttp))
> (license ISC)
> (authors "Anil Madhavapeddy" "Rudi Grinberg")
> (maintenance_intent "(latest)")
>
> (generate_opam_files true)
>
> (package
> (name cohttp)
> (synopsis "An OCaml library for HTTP clients and servers")
> (description "A longer description")
> (allow_empty)
> (depends
> (alcotest :with-test)
> (dune (and :build (> 1.5)))
Expand All @@ -35,7 +33,6 @@ The `dune build` should generate the opam file
> A really long multi line description that spans across lines to
> make sure that the rendering of long strings stays compatible.
> ")
> (allow_empty)
> (depends
> (cohttp (>= 1.0.2))
> (conduit-async (>= 1.0.3))
Expand All @@ -49,7 +46,6 @@ The `dune build` should generate the opam file
> A really long description that is supposed to start with a
> newline since it doesn't escape the line break.
> ")
> (allow_empty)
> (depends
> (cohttp (>= 1.0.2))
> (conduit-lwt (>= 1.0.3))
Expand All @@ -62,114 +58,81 @@ The `dune build` should generate the opam file
$ cat cohttp.opam
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "-p" name "@doc"] {with-doc}
]
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
homepage: "https://github.com/mirage/ocaml-cohttp"
license: "ISC"
version: "1.0.0"
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
synopsis: "An OCaml library for HTTP clients and servers"
description: "A longer description"
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
license: "ISC"
homepage: "https://github.com/mirage/ocaml-cohttp"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.18"}
"alcotest" {with-test}
"dune" {build & > "1.5"}
"foo" {dev & > "1.5" & < "2.0"}
"uri" {>= "1.9.0"}
"uri" {< "2.0.0"}
"fieldslib" {> "v0.12"}
"fieldslib" {< "v0.13"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
x-maintenance-intent: ["(latest)"]

$ cat cohttp-async.opam
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "-p" name "@doc"] {with-doc}
]
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
homepage: "https://github.com/mirage/ocaml-cohttp"
license: "ISC"
version: "1.0.0"
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
synopsis: "HTTP client and server for the Async library"
description: """
A really long multi line description that spans across lines to
make sure that the rendering of long strings stays compatible.
"""
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
license: "ISC"
homepage: "https://github.com/mirage/ocaml-cohttp"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.18"}
"cohttp" {>= "1.0.2"}
"conduit-async" {>= "1.0.3"}
"async" {>= "v0.10.0"}
"async" {< "v0.12"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
x-maintenance-intent: ["(latest)"]

$ cat cohttp-lwt.opam
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
build: [
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
["dune" "build" "-p" name "@doc"] {with-doc}
]
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
homepage: "https://github.com/mirage/ocaml-cohttp"
license: "ISC"
version: "1.0.0"
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
synopsis: "HTTP client and server for the Lwt library"
description: """
A really long description that is supposed to start with a
newline since it doesn't escape the line break.
"""
authors: ["Anil Madhavapeddy" "Rudi Grinberg"]
license: "ISC"
homepage: "https://github.com/mirage/ocaml-cohttp"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.18"}
"cohttp" {>= "1.0.2"}
"conduit-lwt" {>= "1.0.3"}
"lwt" {>= "5.0.0"}
"lwt" {< "6.0.0"}
"odoc" {with-doc}
]
build: [
["dune" "subst"] {dev}
[
"dune"
"build"
"-p"
name
"-j"
jobs
"@install"
"@runtest" {with-test}
"@doc" {with-doc}
]
]
dev-repo: "git+https://github.com/mirage/ocaml-cohttp.git"
x-maintenance-intent: ["(latest)"]
3 changes: 0 additions & 3 deletions test/blackbox-tests/test-cases/dune-project-meta/dune-dep.t
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ the doc dependencies:
]
["dune" "install" "-p" name "--create-install-files" name]
]
x-maintenance-intent: ["(latest)"]

$ cat > dune-project <<EOF
> (lang dune 3.0)
Expand All @@ -216,7 +215,6 @@ the doc dependencies:
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]

$ cat > dune-project <<EOF
> (lang dune 3.0)
Expand All @@ -242,4 +240,3 @@ the doc dependencies:
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ Reproduction case for #2927
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]
1 change: 0 additions & 1 deletion test/blackbox-tests/test-cases/dune-project-meta/v11-1.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,3 @@ Generation of opam files with lang dune >= 1.11
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]
1 change: 0 additions & 1 deletion test/blackbox-tests/test-cases/opam-constraints.t
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ constraints.
"@doc" {with-doc}
]
]
x-maintenance-intent: ["(latest)"]

0 comments on commit 263bf0b

Please sign in to comment.