aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2024-07-19 09:21:53 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2024-07-19 09:21:53 +0300
commit04c8872e3a47e5ad32690c0483bc5c4001ee8412 (patch)
treec7ebb925392a54a9d098d4a2c3e03752216ac732
parentOldPackageNameDep: check for dependency using pkgmoved name (diff)
downloadpkgcheck-04c8872e3a47e5ad32690c0483bc5c4001ee8412.tar.gz
pkgcheck-04c8872e3a47e5ad32690c0483bc5c4001ee8412.tar.bz2
pkgcheck-04c8872e3a47e5ad32690c0483bc5c4001ee8412.zip
BadDependency: catch := slot operator in PDEPEND
Resolves: https://github.com/pkgcore/pkgcheck/issues/693 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgcheck/checks/metadata.py13
-rw-r--r--tests/checks/test_metadata.py7
2 files changed, 16 insertions, 4 deletions
diff --git a/src/pkgcheck/checks/metadata.py b/src/pkgcheck/checks/metadata.py
index 2cbb8985..3c3b4bf9 100644
--- a/src/pkgcheck/checks/metadata.py
+++ b/src/pkgcheck/checks/metadata.py
@@ -942,10 +942,15 @@ class DependencyCheck(Check):
if all(map(self.deprecated, pkgs)):
deprecated[attr].add(atom)
- if in_or_restriction and atom.slot_operator == "=":
- yield BadDependency(
- attr, atom, "= slot operator used inside || block", pkg=pkg
- )
+ if atom.slot_operator == "=":
+ if in_or_restriction:
+ yield BadDependency(
+ attr, atom, "= slot operator used inside || block", pkg=pkg
+ )
+ elif attr == "pdepend" and not atom.blocks:
+ # prohibited by PMS at the "Slot dependencies" section
+ msg = "':=' operator is invalid in"
+ yield BadDependency(attr, atom, msg, pkg=pkg)
if pkg.eapi.options.has_use_dep_defaults and atom.use is not None:
missing_use_deps = self._check_use_deps(attr, atom)
diff --git a/tests/checks/test_metadata.py b/tests/checks/test_metadata.py
index f6c2f00b..be5ae182 100644
--- a/tests/checks/test_metadata.py
+++ b/tests/checks/test_metadata.py
@@ -928,6 +928,13 @@ class TestDependencyCheck(use_based(), misc.ReportTestCase):
assert "= slot operator used in blocker" in str(r)
assert f'{attr.upper()}="!dev-libs/foo:="' in str(r)
+ if attr == "PDEPEND":
+ # check for := in PDEPEND
+ r = self.assertReport(chk, mk_pkg(eapi="5", depset="dev-libs/foo:="))
+ assert isinstance(r, metadata.BadDependency)
+ assert "':=' operator" in str(r)
+ assert f'{attr.upper()}="dev-libs/foo:="' in str(r)
+
# check for missing package revisions
self.assertNoReport(chk, mk_pkg("=dev-libs/foo-1-r0"))
r = self.assertReport(chk, mk_pkg(eapi="6", depset="=dev-libs/foo-1"))