Skip to content
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
9 changes: 5 additions & 4 deletions tests/no_pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ def scan(root):


def declared(root):
"""the floors and ceilings of DEP in the spec and in debian/control"""
"""the floors and ceilings of DEP in the spec and in debian/control; a ceiling is any `<`, `<=` or `=` (an exact pin
caps the range as much as a `<` does; debian `<<`, `<=`, `<` and `=` likewise)"""
out = []
spec = open(os.path.join(root, "packaging", "plugin-hostd.spec")).read()
fl = re.findall(r"^BuildRequires:\s*%s\s*>=\s*(\S+)" % re.escape(DEP), spec, re.M)
ce = re.findall(r"^BuildRequires:\s*%s\s*<\s*(\S+)" % re.escape(DEP), spec, re.M)
ce = re.findall(r"^BuildRequires:\s*%s\s*(?:<=|<|=)\s*(\S+)" % re.escape(DEP), spec, re.M)
out.append(("packaging/plugin-hostd.spec", fl, ce))
ctl = open(os.path.join(root, "debian", "control")).read()
fl = re.findall(r"%s\s*\(>=\s*([^)~\s]+)~?\)" % re.escape(DEP), ctl)
ce = re.findall(r"%s\s*\(<<\s*([^)~\s]+)~?\)" % re.escape(DEP), ctl)
ce = re.findall(r"%s\s*\((?:<<|<=|<|=)\s*([^)~\s]+)~?\)" % re.escape(DEP), ctl)
out.append(("debian/control", fl, ce))
return out

Expand All @@ -64,7 +65,7 @@ def check_declared(root):
bad.append("%s declares %s with %d floors (one is the rule)" % (where, DEP, len(fl)))
continue
if ce:
bad.append("%s caps %s below %s: a dependency is a floor only, never a ceiling" % (where, DEP, ce[0]))
bad.append("%s caps or pins %s at %s: a dependency is a floor only, never a ceiling" % (where, DEP, ce[0]))
pairs.append(fl[0])
if len(set(pairs)) > 1:
bad.append("the spec and debian/control disagree on the floor: %s" % pairs)
Expand Down
18 changes: 18 additions & 0 deletions tests/sabotage.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,24 @@
("debian/control caps omx-clap-host-tests with a ceiling again", "debian/control",
" omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n", " omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n omx-clap-host-tests (<< 0.8~),\n",
"no pin anywhere", "nopins"),
("the spec caps omx-clap-host-tests with a '<=' ceiling", "packaging/plugin-hostd.spec",
"BuildRequires: omx-clap-host-tests >= 0.9.0\n", "BuildRequires: omx-clap-host-tests >= 0.9.0\nBuildRequires: omx-clap-host-tests <= 0.9\n",
"no pin anywhere", "nopins"),
("the spec caps omx-clap-host-tests with an exact '=' ceiling", "packaging/plugin-hostd.spec",
"BuildRequires: omx-clap-host-tests >= 0.9.0\n", "BuildRequires: omx-clap-host-tests >= 0.9.0\nBuildRequires: omx-clap-host-tests = 0.9.0\n",
"no pin anywhere", "nopins"),
("the spec caps omx-clap-host-tests with a '<' ceiling", "packaging/plugin-hostd.spec",
"BuildRequires: omx-clap-host-tests >= 0.9.0\n", "BuildRequires: omx-clap-host-tests >= 0.9.0\nBuildRequires: omx-clap-host-tests < 0.10\n",
"no pin anywhere", "nopins"),
("debian/control caps omx-clap-host-tests with a '<=' ceiling", "debian/control",
" omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n", " omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n omx-clap-host-tests (<= 0.9) <!nocheck>,\n",
"no pin anywhere", "nopins"),
("debian/control caps omx-clap-host-tests with an exact '=' ceiling", "debian/control",
" omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n", " omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n omx-clap-host-tests (= 0.9.0) <!nocheck>,\n",
"no pin anywhere", "nopins"),
("debian/control caps omx-clap-host-tests with a '<' ceiling", "debian/control",
" omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n", " omx-clap-host-tests (>= 0.9.0~) <!nocheck>,\n omx-clap-host-tests (< 0.10) <!nocheck>,\n",
"no pin anywhere", "nopins"),
("a workflow pins omx-clap-core by a ref variable again", ".github/workflows/ci.yml",
"permissions:\n contents: read\n", "permissions:\n contents: read\n\nenv:\n OMX_CLAP_HOST_REF: v0.4.0\n",
"no pin anywhere", "nopins"),
Expand Down
Loading