From 397d218182950c0e6f66c1528ac7692c7cd2691b Mon Sep 17 00:00:00 2001 From: Kate Date: Wed, 3 May 2023 14:46:54 +0100 Subject: [PATCH] The conflicts field's filter does not support package variables --- master_changes.md | 1 + src/state/opamFileTools.ml | 5 +++-- tests/reftests/lint.test | 6 ++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/master_changes.md b/master_changes.md index 72bb38d1c41..dec266f1958 100644 --- a/master_changes.md +++ b/master_changes.md @@ -45,6 +45,7 @@ users) ## Source ## Lint + * E29: The conflicts field's filter does not support package variables [#5535 @kit-ty-kate] ## Repository diff --git a/src/state/opamFileTools.ml b/src/state/opamFileTools.ml index 34b855f3103..ebc816467af 100644 --- a/src/state/opamFileTools.ml +++ b/src/state/opamFileTools.ml @@ -363,12 +363,13 @@ let t_lint ?check_extra_files ?(check_upstream=false) ?(all=false) t = (unk_flags <> [])); (let filtered_vars = OpamFilter.variables_of_filtered_formula t.depends @ - OpamFilter.variables_of_filtered_formula t.depopts + OpamFilter.variables_of_filtered_formula t.depopts @ + OpamFilter.variables_of_filtered_formula t.conflicts |> List.filter (fun v -> not (OpamVariable.Full.is_global v)) |> List.map OpamVariable.Full.to_string in cond 29 `Error - "Package dependencies mention package variables" + "Package dependencies or conflicts mention package variables" ~detail:filtered_vars (filtered_vars <> [])); (* diff --git a/tests/reftests/lint.test b/tests/reftests/lint.test index 56713a19f6a..55a665637e0 100644 --- a/tests/reftests/lint.test +++ b/tests/reftests/lint.test @@ -145,7 +145,7 @@ bug-reports: "https://nobug" depends: "foo" {_:innervar} ### opam lint ./lint.opam ${BASEDIR}/lint.opam: Errors. - error 29: Package dependencies mention package variables: "_:innervar" + error 29: Package dependencies or conflicts mention package variables: "_:innervar" # Return code 1 # ### opam-version: "2.0" @@ -159,7 +159,9 @@ dev-repo: "hg+https://to@li.nt" bug-reports: "https://nobug" conflicts: "foo" {_:innervar} ### opam lint ./lint.opam -${BASEDIR}/lint.opam: Passed. +${BASEDIR}/lint.opam: Errors. + error 29: Package dependencies or conflicts mention package variables: "_:innervar" +# Return code 1 # ### : E31: Fields 'depends' and 'depopts' refer to the same package names ### opam-version: "2.0"