N0REP0
### # Needed for extra file check
### OPAMSTRICT=0
### opam switch create linting --empty
### # needed for check upstream checks
### <one-more-file>
and it also has content
### tar czf an-archive.tgz one-more-file
### ::::::::::::::::::::::
### : Test --warn option :
### ::::::::::::::::::::::
### <lint.opam>
opam-version: "2.0"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
           warning 25: Missing field 'authors'
           warning 35: Missing field 'homepage'
           warning 36: Missing field 'bug-reports'
             error 57: Synopsis must not be empty
           warning 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=+25
${BASEDIR}/lint.opam: Warnings.
           warning 25: Missing field 'authors'
### opam lint ./lint.opam --warn=-25
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
           warning 35: Missing field 'homepage'
           warning 36: Missing field 'bug-reports'
             error 57: Synopsis must not be empty
           warning 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=+25-25
${BASEDIR}/lint.opam: Passed.
### opam lint ./lint.opam --warn=+20..50
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
           warning 25: Missing field 'authors'
           warning 35: Missing field 'homepage'
           warning 36: Missing field 'bug-reports'
# Return code 1 #
### opam lint ./lint.opam --warn=-20..40
${BASEDIR}/lint.opam: Errors.
             error 57: Synopsis must not be empty
           warning 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=+25+25+30..38
${BASEDIR}/lint.opam: Warnings.
           warning 25: Missing field 'authors'
           warning 35: Missing field 'homepage'
           warning 36: Missing field 'bug-reports'
### opam lint ./lint.opam --warn=+50..38+23+25
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
           warning 25: Missing field 'authors'
# Return code 1 #
### opam lint ./lint.opam --warn=-25-25-30..38
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
             error 57: Synopsis must not be empty
           warning 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=@0..99
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
             error 25: Missing field 'authors'
             error 35: Missing field 'homepage'
             error 36: Missing field 'bug-reports'
             error 57: Synopsis must not be empty
             error 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=@0..99
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
             error 25: Missing field 'authors'
             error 35: Missing field 'homepage'
             error 36: Missing field 'bug-reports'
             error 57: Synopsis must not be empty
             error 68: Missing field 'license'
# Return code 1 #
### opam lint ./lint.opam --warn=+25@25
${BASEDIR}/lint.opam: Errors.
             error 25: Missing field 'authors'
# Return code 1 #
### opam lint ./lint.opam --warn=+20..40@30..40
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
           warning 25: Missing field 'authors'
             error 35: Missing field 'homepage'
             error 36: Missing field 'bug-reports'
# Return code 1 #
### ::::::::::::::
### : Test lints :
### ::::::::::::::
### : W20: Field 'opam-version' refers to the patch version of opam, it should be of the form MAJOR.MINOR
### : E21: Field 'opam-version' doesn't match the current version, validation may not be accurate
### <lint.opam>
opam-version: "2.0.256"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
           warning 20: Field 'opam-version' refers to the patch version of opam, it should be of the form MAJOR.MINOR: "2.0.256"
             error 21: Field 'opam-version' doesn't match the current version, validation may not be accurate: "2.0.256"
# Return code 1 #
### : E22: Some fields are present but empty; remove or fill them
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
doc: ""
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 22: Some fields are present but empty; remove or fill them: "doc"
# Return code 1 #
### : E23: Missing field 'maintainer'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 23: Missing field 'maintainer'
# Return code 1 #
### : E24: Field 'maintainer' has the old default value
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "contact@ocamlpro.com"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 24: Field 'maintainer' has the old default value
# Return code 1 #
### : W25: Missing field 'authors'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 25: Missing field 'authors'
### : W26: No field 'install', but a field 'remove': install instructions probably part of 'build'. Use the 'install' field or a .install file
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
remove: [ "true" ]
build: [ "true" ]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 26: No field 'install', but a field 'remove': install instructions probably part of 'build'. Use the 'install' field or a .install file
### : E28: Unknown package flags found
### #ERROR: unreachable as there is a cleanup of unknown flags
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
flags: [unkn conf]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### opam show ./lint.opam --just-file --field flags --normalise
conf
### opam lint ./lint.opam --strict
${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 or conflicts mention package variables
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" {_:innervar}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             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: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
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>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo"
depopts: "foo"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 31: Fields 'depends' and 'depopts' refer to the same package names: "foo"
# Return code 1 #
### : E32: Field 'ocaml-version:' and variable 'ocaml-version' are deprecated, use a dependency towards the 'ocaml' package instead for availability, and the 'ocaml:version' package variable for scripts
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
ocaml-version: [<"3.12"]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 32: Field 'ocaml-version:' and variable 'ocaml-version' are deprecated, use a dependency towards the 'ocaml' package instead for availability, and the 'ocaml:version' package variable for scripts
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { ocaml-version = "3.12"}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 32: Field 'ocaml-version:' and variable 'ocaml-version' are deprecated, use a dependency towards the 'ocaml' package instead for availability, and the 'ocaml:version' package variable for scripts
# Return code 1 #
### : E33: Field 'os' is deprecated, use 'available' and the 'os' variable instead
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
os: "jayceos"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 33: Field 'os' is deprecated, use 'available' and the 'os' variable instead
# Return code 1 #
### : E34: Field 'available:' contains references to package-local variables. It should only be determined from global configuration variables
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
available: _:version = "0.1"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 34: Field 'available:' contains references to package-local variables. It should only be determined from global configuration variables: "_:version"
# Return code 1 #
### : W35: Missing field 'homepage'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 35: Missing field 'homepage'
### : W36: Missing field 'bug-reports'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 36: Missing field 'bug-reports'
### : W37: Missing field 'dev-repo'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
bug-reports: "https://nobug"
url {
  src:"an-archive.tgz"
  checksum: "md5=00000000000000000000000000000000"
}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 37: Missing field 'dev-repo'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
bug-reports: "https://nobug"
### # no url doesn't trigger the lint warning
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### : E39: Command 'make' called directly, use the built-in variable instead
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
build: [ "make" ]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 39: Command 'make' called directly, use the built-in variable instead
# Return code 1 #
### : W41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
messages: "foo" { bar:innerenv }
### opam lint ./lint.opam
${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"
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
messages: "foo" { bar:installed }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: [
  "dependency"
  "guarded-dependency" {os = ""}
]
build: [
  ["false"] {no-dependency-installed-only:installed}
  ["true"] {dependency:installed}
  ["%{guarded-dependency:share}%"] {guarded-dependency:installed}
  ["%{guarded-dependency:share}%"] {guarded-dependency:installed & guarded-dependency:share != ""}
  ["%{no-dependency-unguarded:share}%"] {no-dependency-unguarded:installed | no-dependency-unguarded:share != ""}
  ["%{guarded-dependency:share}%" {guarded-dependency:installed}]
  ["%{guarded-dependency:share}%%{no-dependency-guarded:share}%" {no-dependency-guarded:installed}] {guarded-dependency:installed}
  ["%{guarded-dependency:share}%%{no-dependency-unguarded:share}%%{no-dependency-guarded:share}%" {no-dependency-guarded:installed}] {guarded-dependency:installed}
]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 41: Some packages are mentioned in package scripts or features, but there is no dependency or depopt toward them: "no-dependency-guarded", "no-dependency-installed-only", "no-dependency-unguarded"
### : 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"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 42: The 'dev-repo:' field doesn't use version control. You should use URLs of the form "git://", "git+https://", "hg+https://"...
# Return code 1 #
### : E43: Conjunction used in 'conflicts:' field. Only '|' is allowed
### #ERROR: unreachable as there is a cleanup of conflicts: conjunction are transformed as disjunction
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
conflicts: "foo" & "bar"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### opam show ./lint.opam --just-file --field conflicts --normalise
["foo" "bar"]
### opam lint ./lint.opam --strict
${BASEDIR}/lint.opam: Errors.
             error  3: File format error in 'conflicts' at line 10, column 0: Conflicts must be a disjunction, '&' is not supported (treated as '|').
# Return code 1 #
### : W44: The 'plugin' package flag is set but the package name doesn't begin with 'opam-'
### <lint.opam>
opam-version: "2.0"
name: "lint"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
flags: plugin
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 44: The 'plugin' package flag is set but the package name doesn't begin with 'opam-'
### : E45: Unclosed variable interpolations in strings
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
post-messages: "installed version %{version"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 45: Unclosed variable interpolations in strings: "%{version"
# Return code 1 #
### : E46: Package is flagged "conf" but has source, install or remove instructions
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
flags: conf
install : [ "install" ]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 46: Package is flagged "conf" but has source, install or remove instructions
# Return code 1 #
### : W47: Synopsis should start with a capital and not end with a dot
### <lint.opam>
opam-version: "2.0"
synopsis: "a word"
description: "a words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 47: Synopsis should start with a capital and not end with a dot
### : W48: The fields 'build-test:' and 'build-doc:' are deprecated, and should be replaced by uses of the 'with-test' and 'with-doc' filter variables in the 'build:' and 'install:' fields, and by the newer 'run-test:' field
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
build-test : ["test"]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 48: The fields 'build-test:' and 'build-doc:' are deprecated, and should be replaced by uses of the 'with-test' and 'with-doc' filter variables in the 'build:' and 'install:' fields, and by the newer 'run-test:' field
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
build-doc : ["doc"]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 48: The fields 'build-test:' and 'build-doc:' are deprecated, and should be replaced by uses of the 'with-test' and 'with-doc' filter variables in the 'build:' and 'install:' fields, and by the newer 'run-test:' field
### : W49: The following URLs don't use version control but look like version control URLs
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "https://to@li.nt.git"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 42: The 'dev-repo:' field doesn't use version control. You should use URLs of the form "git://", "git+https://", "hg+https://"...
           warning 49: The following URLs don't use version control but look like version control URLs: "https://to@li.nt.git"
# Return code 1 #
### : W50: The 'post' flag doesn't make sense with build or optional dependencies
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: [ "foo" {build & post} ]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 50: The 'post' flag doesn't make sense with build or optional dependencies
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depopts: "foo" {post}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 50: The 'post' flag doesn't make sense with build or optional dependencies
### : E51: The behaviour for negated dependency flags 'build' or 'post' is unspecified
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { !build }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 51: The behaviour for negated dependency flags 'build' or 'post' is unspecified
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { !post }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 51: The behaviour for negated dependency flags 'build' or 'post' is unspecified
# Return code 1 #
### : E52: Package is needlessly flagged "light-uninstall", since it has no remove instructions
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
flags: light-uninstall
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 52: Package is needlessly flagged "light-uninstall", since it has no remove instructions
# Return code 1 #
### : E53: Mismatching 'extra-files:' field
### <pkg:lint.1>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
extra-files: [ "more-file-bad-md5" "md5=00000000000000000000000000000000" ]
### <REPO/packages/lint/lint.1/more-file-bad-md5>
and there is content!
### <pkg:lint.2>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### <pkg:lint.2:more-file-good-md5>
and there is content!
### opam lint --package lint.1
<default>/lint.1: Errors.
             error 53: Mismatching 'extra-files:' field: "more-file-bad-md5"
# Return code 1 #
### opam lint --package lint.2
<default>/lint.2: Passed.
### OPAMREPOSITORYTARRING=1
### opam update default

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] no changes from file://${BASEDIR}/REPO
### opam lint --package lint.1
<default>/lint.1: Errors.
             error 53: Mismatching 'extra-files:' field: "more-file-bad-md5"
# Return code 1 #
### opam lint --package lint.2
<default>/lint.2: Passed.
### OPAMREPOSITORYTARRING=0
### : W54: External dependencies should not contain spaces nor empty string
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depexts: ""
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 54: External dependencies should not contain spaces nor empty string: ""
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depexts: "a package"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 54: External dependencies should not contain spaces nor empty string: "a package"
### : E55: Non-normalised OS or arch string being tested
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depexts: ["foo"] { arch = "i486" }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 55: Non-normalised OS or arch string being tested: "i486 (use x86_32 instead)"
# Return code 1 #
### : E57: Synopsis must not be empty
### <lint.opam>
opam-version: "2.0"
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 57: Synopsis must not be empty
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
synopsis: ""
description: ""
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 57: Synopsis must not be empty
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
description: "a words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 57: Synopsis must not be empty
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
synopsis: ""
description: "a words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 57: Synopsis must not be empty
# Return code 1 #
### : W58: Found variable, predefined one
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { test }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 58: Found `test` variable, predefined one is `with-test`
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { doc }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 58: Found `doc` variable, predefined one is `with-doc`
### : W59: url doesn't contain a checksum
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url { src:"an-archive.tgz" }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 59: url doesn't contain a checksum
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Warnings.
           warning 59: url doesn't contain a checksum
### # package with conf flag
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url { src:"an-archive.tgz" }
flags: conf
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 46: Package is flagged "conf" but has source, install or remove instructions
# Return code 1 #
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Errors.
             error 46: Package is flagged "conf" but has source, install or remove instructions
# Return code 1 #
### # package with git url
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url { src:"git+https://a/repo" }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Passed.
### # package with local url
### <repo/stuff>
something
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### <add-url.sh>
basedir=`echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g"`
cat << EOF >> lint.opam
url { src:"file://$basedir/an-archive" }
EOF
### sh add-url.sh
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Passed.
### # package with local archive url
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### <add-url.sh>
basedir=`echo "$BASEDIR" | sed "s/\\\\\\\\/\\\\\\\\\\\\\\\\/g"`
cat << EOF >> lint.opam
url {
  src:"file://$basedir/an-archive.tgz"
  checksum: "md5=$(openssl md5 an-archive.tgz | cut -f2 -d' ')"
  }
EOF
### sh add-url.sh
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Passed.
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Passed.
### : E60: Upstream check failed
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url { src:"another-archive.tgz" }
### opam lint ./lint.opam --check-upstream
${BASEDIR}/lint.opam: Errors.
           warning 59: url doesn't contain a checksum
             error 60: Upstream check failed: "Source not found: ${BASEDIR}/another-archive.tgz"
# Return code 1 #
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url {
  src:"an-archive.tgz"
  checksum:"md5=00000000000000000000000000000000"
}
### opam lint ./lint.opam --check-upstream | grep -v md5
${BASEDIR}/lint.opam: Errors.
             error 60: Upstream check failed: "The archive doesn't match checksum:
              ."
# Return code 1 #
### : W61: `with-test` variable in `run-test` is out of scope, it will be ignored
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
run-test: [ "test-it" { with-test } ]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 61: `with-test` variable in `run-test` is out of scope, it will be ignored
### : W62: License doesn't adhere to the SPDX standard, see https://spdx.org/licenses/
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "DTFWYW"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 62: License doesn't adhere to the SPDX standard, see https://spdx.org/licenses/ : "DTFWYW"
### : E65: URLs must be absolute
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "git+file://./../to@li.nt"
bug-reports: "https://nobug"
url {
  src:"file://./my/url/path"
  checksum: "md5=00000000000000000000000000000000"
  mirrors: [
    "file:///good/mirror"
    "file:///wrong/../mirror"
    "file:///another/./mirror/"
  ]
}
extra-source "relative" {
  src:"file:///my/./../extrasource/path"
  checksum: "md5=00000000000000000000000000000000"
}
extra-source "notrelative" {
  src:"file:///my/extrasource..path.patch"
  checksum: "md5=00000000000000000000000000000000"
}
pin-depends: [
  [ "pinned.1" "file:///my/../pinned/package" ]
]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 65: URLs must be absolute: "./my/url/path", "/wrong/../mirror", "./../to@li.nt", "/my/./../extrasource/path", "/my/../pinned/package"
# Return code 1 #
### : W66: String that can't be resolved to bool in filtered package formula
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
depends: "foo" { "a-given-version" }
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 66: String that can't be resolved to bool in filtered package formula: ""a-given-version" in 'foo {"a-given-version"}'"
### : E67: Checksum specified with a non archive url
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url {
  src:"git+https://git.url/repo"
  checksum:"md5=00000000000000000000000000000000"
}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 67: Checksum specified with a non archive url: "git+https://git.url/repo - md5=00000000000000000000000000000000"
# Return code 1 #
### : W68: Missing field 'license'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 68: Missing field 'license'
### : W69: Package name in variable in string interpolation contains several '+'
### <lint.opam>
opam-version: "2.0"
name: "conf-g++"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
messages: [
  "foo" { "%{?conf-c++:installed:}%" }
  "bar" { "%{conf-g++:installed}%" }
  "baz" { "%{abc+xyz+jkl:installed}%" }
]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Warnings.
           warning 69: Package name in variable in string interpolation contains several '+', use: "'?conf-g++:installed:' instead of 'conf-g++:installed'"
### : E70: Field 'extra-files' contains duplicated files
### <pkg:lint.3>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
### <REPO/packages/lint/lint.3/files/single-file>
file
### <REPO/packages/lint/lint.3/files/double-file>
file
### <REPO/packages/lint/lint.3/files/quadra-file>
file
### <hash.sh>
set -ue
path=REPO/packages/lint/lint.3
md5=`openssl md5 "$path/files/single-file" | cut -f2 -d' '`
cat << EOF >> "$path/opam"
extra-files:[
  ["single-file" "md5=$md5"]
  ["double-file" "md5=$md5"]
  ["double-file" "md5=$md5"]
  ["quadra-file" "md5=$md5"]
  ["quadra-file" "md5=$md5"]
  ["quadra-file" "md5=$md5"]
  ["quadra-file" "md5=$md5"]
]
EOF
### sh hash.sh
### opam update

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
[default] synchronised from file://${BASEDIR}/REPO
Now run 'opam upgrade' to apply any package updates.
### opam lint --package lint.3
<default>/lint.3: Errors.
             error 70: Field 'extra-files' contains duplicated files: "double-file: 2 occurences", "quadra-file: 4 occurences"
# Return code 1 #
### : several extra-source
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
extra-source "double-file" {
  src:"https://git.url/repo.tgz"
  checksum:"md5=00000000000000000000000000000000"
}
extra-source "single-file" {
  src:"https://git.url/repo.tgz"
  checksum:"md5=00000000000000000000000000000000"
}
extra-source "double-file" {
  src:"https://git.url/repo.tgz"
  checksum:"md5=00000000000000000000000000000000"
}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error  3: File format error in 'extra-source': Duplicate section extra-source
# Return code 1 #
### : E71: Field 'url.checksum' contains duplicated checksums
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
url {
  src:"an-archive.tgz"
  checksum:[
  "md5=00000000000000000000000000000000"
  "md5=11111111111111111111111111111111"
  "sha256=2222222222222222222222222222222222222222222222222222222222222222"
  "sha256=3333333333333333333333333333333333333333333333333333333333333333"
  "sha256=4444444444444444444444444444444444444444444444444444444444444444"
  "sha512=55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
  ]
}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 71: Field 'url.checksum' contains duplicated checksums: "md5: 2 occurences", "sha256: 3 occurences"
# Return code 1 #
### : E72: Field 'extra-sources' contains duplicated checksums
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
extra-source "double-file" {
  src:"https://git.url/repo.tgz"
  checksum:[
  "md5=00000000000000000000000000000000"
  "md5=11111111111111111111111111111111"
  "sha256=2222222222222222222222222222222222222222222222222222222222222222"
  "sha256=3333333333333333333333333333333333333333333333333333333333333333"
  "sha256=4444444444444444444444444444444444444444444444444444444444444444"
  "sha512=55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
  ]
}
extra-source "double-file2" {
  src:"https://git.url/repo.tgz"
  checksum:[
  "md5=00000000000000000000000000000000"
  "md5=11111111111111111111111111111111"
  ]
}
extra-source "double-file3" {
  src:"https://git.url/repo.tgz"
  checksum:[
  "md5=00000000000000000000000000000000"
  "sha256=3333333333333333333333333333333333333333333333333333333333333333"
  "sha512=55555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555555"
  ]
}
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 72: Field 'extra-sources' contains duplicated checksums: "double-file have md5: 2 occurences and sha256: 3 occurences", "double-file2 have md5: 2 occurences"
# Return code 1 #
### : E73: Field 'extra-files' contains path with '..'
### <lint.opam>
opam-version: "2.0"
synopsis: "A word"
description: "Two words."
authors: "the testing team"
homepage: "egapemoh"
maintainer: "maint@tain.er"
license: "ISC"
dev-repo: "hg+https://to@li.nt"
bug-reports: "https://nobug"
extra-source "double-file" {
  src:"https://git.url/repo.tgz"
  checksum:"md5=00000000000000000000000000000000"
}
extra-files: [
  [ "./relative/path"            "md5=00000000000000000000000000000000"]
  [ "/absolute/../relative/path" "md5=00000000000000000000000000000000"]
  [ "/absolute/path"             "md5=00000000000000000000000000000000"]
  [ "extra-files..patch.patch"   "md5=00000000000000000000000000000000"]
]
### opam lint ./lint.opam
${BASEDIR}/lint.opam: Errors.
             error 53: Mismatching 'extra-files:' field: "./relative/path", "/absolute/../relative/path", "/absolute/path", "extra-files..patch.patch"
             error 73: Field 'extra-files' contains path with '..': "/absolute/../relative/path"
# Return code 1 #
### :::::::::::::::::::::
### : Test parse errors :
### :::::::::::::::::::::
### :1: future opam versions
### <pin:future/pin-at-two-one.opam>
opam-version: "2.1"
### <pin:future/pin-at-two-two.opam>
opam-version: "2.2"
### <pin:future/pin-at-two-three.opam>
opam-version: "2.3"
### <pin:future/pin-at-future.opam>
opam-version: "50.0"
### opam lint future/pin-at-two-one.opam
${BASEDIR}/future/pin-at-two-one.opam: Errors.
             error  2: File format error: unsupported or missing file format version; should be 2.0 or older
# Return code 1 #
### opam lint future/pin-at-two-two.opam
${BASEDIR}/future/pin-at-two-two.opam: Errors.
             error  2: File format error: unsupported or missing file format version; should be 2.0 or older
# Return code 1 #
### opam lint future/pin-at-two-three.opam
${BASEDIR}/future/pin-at-two-three.opam: Errors.
             error  2: File format error: unsupported or missing file format version; should be 2.0 or older
# Return code 1 #
### opam lint future/pin-at-future.opam
${BASEDIR}/future/pin-at-future.opam: Errors.
             error  2: File format error: unsupported or missing file format version; should be 2.0 or older
# Return code 1 #
### :2: future opam versions with parse error
### <junk.sh>
echo GARBAGE>>"$1"
### sh junk.sh future/pin-at-two-one.opam
### sh junk.sh future/pin-at-two-two.opam
### sh junk.sh future/pin-at-two-three.opam
### sh junk.sh future/pin-at-future.opam
### opam lint future/pin-at-two-one.opam
${BASEDIR}/future/pin-at-two-one.opam: Errors.
             error  2: File format error at line 11, column 0: Parse error
# Return code 1 #
### opam lint future/pin-at-two-two.opam
${BASEDIR}/future/pin-at-two-two.opam: Errors.
             error  2: File format error at line 11, column 0: Parse error
# Return code 1 #
### opam lint future/pin-at-two-three.opam
${BASEDIR}/future/pin-at-two-three.opam: Errors.
             error  2: File format error at line 11, column 0: Parse error
# Return code 1 #
### opam lint future/pin-at-future.opam
${BASEDIR}/future/pin-at-future.opam: Errors.
             error  2: File format error: unsupported or missing file format version; should be 2.0 or older
# Return code 1 #
