diff --git a/tests/no_pins.py b/tests/no_pins.py index 7513c72..6776ca4 100644 --- a/tests/no_pins.py +++ b/tests/no_pins.py @@ -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 @@ -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) diff --git a/tests/sabotage.py b/tests/sabotage.py index ae40674..0e312bb 100644 --- a/tests/sabotage.py +++ b/tests/sabotage.py @@ -296,6 +296,24 @@ ("debian/control caps omx-clap-host-tests with a ceiling again", "debian/control", " omx-clap-host-tests (>= 0.9.0~) ,\n", " omx-clap-host-tests (>= 0.9.0~) ,\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~) ,\n", " omx-clap-host-tests (>= 0.9.0~) ,\n omx-clap-host-tests (<= 0.9) ,\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~) ,\n", " omx-clap-host-tests (>= 0.9.0~) ,\n omx-clap-host-tests (= 0.9.0) ,\n", + "no pin anywhere", "nopins"), + ("debian/control caps omx-clap-host-tests with a '<' ceiling", "debian/control", + " omx-clap-host-tests (>= 0.9.0~) ,\n", " omx-clap-host-tests (>= 0.9.0~) ,\n omx-clap-host-tests (< 0.10) ,\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"),