diff --git a/.github/scripts/solvers.sh b/.github/scripts/solvers.sh index d8b95244868..68d6cb11dbb 100644 --- a/.github/scripts/solvers.sh +++ b/.github/scripts/solvers.sh @@ -3,6 +3,7 @@ . .github/scripts/preamble.sh export OPAMYES=1 +export OPAMCONFIRMLEVEL=unsafe-yes export OCAMLRUNPARAM=b # All environment variable are overwritten in job description @@ -23,6 +24,7 @@ case "$SOLVER" in ;; esac +opam update --depexts opam switch create $SOLVER ocaml-system || true opam install $PKGS opam install . --deps diff --git a/master_changes.md b/master_changes.md index e8c64dd8e30..2f0f487246a 100644 --- a/master_changes.md +++ b/master_changes.md @@ -46,7 +46,7 @@ Prefixes used to help generate release notes, changes, and blog posts: * ## Lint - * + * W68: add warning for missing license field [#4766 @kit-ty-kate - partial fix #4598] ## Lock * diff --git a/src/state/opamFileTools.ml b/src/state/opamFileTools.ml index 31c5db910d5..f77d3f40d70 100644 --- a/src/state/opamFileTools.ml +++ b/src/state/opamFileTools.ml @@ -869,6 +869,9 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t = | Some urlf -> (OpamFile.URL.checksum urlf <> []) && url_is_archive <> Some true); + cond 68 `Warning + "Missing field 'license'" + (t.license = []); ] in format_errors @ diff --git a/tests/reftests/dune.inc b/tests/reftests/dune.inc index 53b5b400bec..1ef0a60c4a2 100644 --- a/tests/reftests/dune.inc +++ b/tests/reftests/dune.inc @@ -203,6 +203,23 @@ %{targets} (run ./run.exe %{bin:opam} %{dep:legacy-local.test} %{read-lines:testing-env})))) +(alias + (name reftest-lint) + (action + (diff lint.test lint.out))) + +(alias + (name reftest) + (deps (alias reftest-lint))) + +(rule + (targets lint.out) + (deps root-N0REP0) + (action + (with-stdout-to + %{targets} + (run ./run.exe %{bin:opam} %{dep:lint.test} %{read-lines:testing-env})))) + (alias (name reftest-opamroot-versions) (action diff --git a/tests/reftests/lint.test b/tests/reftests/lint.test new file mode 100644 index 00000000000..30e4e2f66e0 --- /dev/null +++ b/tests/reftests/lint.test @@ -0,0 +1,29 @@ +N0REP0 +### +opam-version: "2.0" +name: "lint" +version: "1.0" +synopsis: "A word" +description: "Two words." +maintainer: "opam-devel@lists.ocaml.org" +authors: [ "Z" "A" "R" ] +homepage: "x" +bug-reports: "x" +depends: [ + "ocaml" {>= "4.02.3"} + "base-unix" + "base-bigarray" + "ocamlgraph" + "re" {>= "1.5.0"} + "dune" {>= "1.2.1"} + "cppo" {build} +] +conflicts: ["extlib-compat"] +build: [ + [ "./configure" ] + [ make ] +] +dev-repo: "git+https://github.com/ocaml/opam.git" +### opam lint ./lint.opam +${BASEDIR}/lint.opam: Warnings. + warning 68: Missing field 'license' diff --git a/tests/reftests/show.test b/tests/reftests/show.test index a163a6ad706..a9eb2ad787f 100644 --- a/tests/reftests/show.test +++ b/tests/reftests/show.test @@ -126,6 +126,7 @@ synopsis: "A word" description: "Two words." maintainer: "opam-devel@lists.ocaml.org" authors: [ "Z" "A" "R" ] +license: "ISC" homepage: "x" bug-reports: "x" depends: [ @@ -151,6 +152,7 @@ synopsis: "A word" description: "Two words." maintainer: "opam-devel@lists.ocaml.org" authors: ["A" "R" "Z"] +license: "ISC" homepage: "x" bug-reports: "x" depends: [ @@ -182,6 +184,7 @@ bug-reports "x" dev-repo "git+https://github.com/ocaml/opam.git" authors "A" "R" "Z" maintainer "opam-devel@lists.ocaml.org" +license "ISC" depends "base-bigarray" "base-unix" "ocamlgraph" @@ -200,6 +203,7 @@ synopsis: "A word" description: "Two words." maintainer: "opam-devel@lists.ocaml.org" authors: ["A" "R" "Z"] +license: "ISC" homepage: "x" bug-reports: "x" depends: [ @@ -233,6 +237,7 @@ synopsis: "A word" description: "Two words." maintainer: "opam-devel@lists.ocaml.org" authors: ["Z" "A" "R"] +license: "ISC" homepage: "x" bug-reports: "x" depends: [ @@ -265,6 +270,7 @@ bug-reports "x" dev-repo "git+https://github.com/ocaml/opam.git" authors "Z" "A" "R" maintainer "opam-devel@lists.ocaml.org" +license "ISC" depends "ocaml" {>= "4.02.3"} "base-unix" "base-bigarray" diff --git a/tests/reftests/upgrade-format.test b/tests/reftests/upgrade-format.test index 3280541ac15..119b1dfa423 100644 --- a/tests/reftests/upgrade-format.test +++ b/tests/reftests/upgrade-format.test @@ -2,6 +2,7 @@ ### opam-version: "1.2" version: "2.0.7" +license: "ISC" maintainer: "opam-devel@lists.ocaml.org" authors: [ "Vincent Bernardoff " @@ -51,6 +52,7 @@ authors: [ "Ralf Treinen " "Frederic Tuong " ] +license: "ISC" homepage: "https://opam.ocaml.org/" bug-reports: "https://github.com/ocaml/opam/issues" depends: [