Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The conflicts field's filter does not support package variables: update lint #5535

Merged
merged 2 commits into from
Jul 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 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 Expand Up @@ -91,6 +92,8 @@ users)
## Reftests
### Tests
* Admin: add a full test [#5385 @rjbou]
* Lint
* E29: Add conflicts test and simplify W41 to no more trigger E29 [#5535 @rjbou]

### Engine

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
25 changes: 19 additions & 6 deletions tests/reftests/lint.test
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ conf
${BASEDIR}/lint.opam: Errors.
error 3: File format error in 'flags' at line 10, column 0: Unknown package flags unkn ignored
# Return code 1 #
### : E29: Package dependencies mention package variables
### : E29: Package dependencies or conflicts mention package variables
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
Expand All @@ -145,7 +145,22 @@ 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"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "[email protected]"
license: "ISC"
dev-repo: "hg+https://[email protected]"
bug-reports: "https://nobug"
conflicts: "foo" {_:innervar}
### opam lint ./lint.opam
${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>
Expand Down Expand Up @@ -294,12 +309,10 @@ maintainer: "[email protected]"
license: "ISC"
dev-repo: "hg+https://[email protected]"
bug-reports: "https://nobug"
depends: "foo" { bar:innerenv }
messages: "foo" { bar:innerenv }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
error 29: Package dependencies mention package variables: "bar:innerenv"
${BASEDIR}/lint.opam: Warnings.
warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "bar"
# Return code 1 #
### : E42: The 'dev-repo:' field doesn't use version control. You should use URLs of the form "git://", "git+https://", "hg+https://"...
### <lint.opam>
opam-version: "2.0"
Expand Down