Skip to content

Commit

Permalink
The conflicts field's filter does not support package variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate authored and rjbou committed Jul 10, 2023
1 parent 10aaa0f commit 397d218
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ users)
## Source

## Lint
* E29: The conflicts field's filter does not support package variables [#5535 @kit-ty-kate]

## Repository

Expand Down
5 changes: 3 additions & 2 deletions src/state/opamFileTools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <> []));
(*
Expand Down
6 changes: 4 additions & 2 deletions tests/reftests/lint.test
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
### <lint.opam>
opam-version: "2.0"
Expand All @@ -159,7 +159,9 @@ dev-repo: "hg+https://[email protected]"
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
### <lint.opam>
opam-version: "2.0"
Expand Down

0 comments on commit 397d218

Please sign in to comment.