From dacab558f73d6c30e38f91dc50c8b89d30010fdc Mon Sep 17 00:00:00 2001 From: Arthur Zamarin Date: Sat, 13 Jul 2024 21:43:45 +0300 Subject: OldPackageNameDep: check for dependency using pkgmoved name Resolves: https://github.com/pkgcore/pkgcheck/issues/659 Signed-off-by: Arthur Zamarin --- src/pkgcheck/checks/visibility.py | 25 ++++++++++++++++++++++ .../OldPackageNameDep/expected.json | 4 ++++ .../OldPackageNameDep/OldPackageNameDep-0.ebuild | 8 +++++++ 3 files changed, 37 insertions(+) create mode 100644 testdata/data/repos/visibility/VisibilityCheck/OldPackageNameDep/expected.json create mode 100644 testdata/repos/visibility/VisibilityCheck/OldPackageNameDep/OldPackageNameDep-0.ebuild diff --git a/src/pkgcheck/checks/visibility.py b/src/pkgcheck/checks/visibility.py index 050b923b..bddbbe64 100644 --- a/src/pkgcheck/checks/visibility.py +++ b/src/pkgcheck/checks/visibility.py @@ -231,6 +231,25 @@ class OldPackageName(results.PackageResult, results.Error): return f"package uses old name which is source of pkgmove, rename into {self.new_name!r}" +class OldPackageNameDep(results.VersionResult, results.Error): + """Package depends on old name which is source of pkgmove. + + Package depends on ``${CATEGORY}/${PN}`` which is the source of a + pkgmove. It should be updated to the destination (new name) from + this repository or one of its master repositories. + """ + + def __init__(self, attr: str, dep: str, new_name: str, **kwargs): + super().__init__(**kwargs) + self.attr = attr + self.dep = dep + self.new_name = new_name + + @property + def desc(self): + return f"{self.attr}: {self.dep!r} uses old package name which is the source of a pkgmove, rename into {self.new_name!r}" + + class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check): """Visibility dependency scans. @@ -250,6 +269,7 @@ class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check): NonsolvableDepsInExp, DependencyMoved, OldPackageName, + OldPackageNameDep, } ) @@ -295,6 +315,11 @@ class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check): nonexistent = set() try: for orig_node in visit_atoms(pkg, getattr(pkg, attr)): + if orig_node.key in self.pkgmoves: + yield OldPackageNameDep( + attr, str(orig_node), self.pkgmoves[orig_node.key], pkg=pkg + ) + node = orig_node.no_usedeps if node not in self.query_cache: if node in self.profiles.global_insoluble: diff --git a/testdata/data/repos/visibility/VisibilityCheck/OldPackageNameDep/expected.json b/testdata/data/repos/visibility/VisibilityCheck/OldPackageNameDep/expected.json new file mode 100644 index 00000000..f4451628 --- /dev/null +++ b/testdata/data/repos/visibility/VisibilityCheck/OldPackageNameDep/expected.json @@ -0,0 +1,4 @@ +{"__class__": "OldPackageNameDep", "category": "DependencyMoved", "package": "DependencyMoved", "version": "0", "attr": "bdepend", "dep": ">=stub/old-name-2.71-r6:2.71", "new_name": "stub/stable"} +{"__class__": "OldPackageNameDep", "category": "DependencyMoved", "package": "DependencyMoved", "version": "0", "attr": "rdepend", "dep": "stub/old-name:2", "new_name": "stub/stable"} +{"__class__": "OldPackageNameDep", "category": "DependencyMoved", "package": "DependencyMoved", "version": "0", "attr": "rdepend", "dep": "~stub/old-name-2", "new_name": "stub/stable"} +{"__class__": "OldPackageNameDep", "category": "VisibilityCheck", "package": "OldPackageNameDep", "version": "0", "attr": "rdepend", "dep": "!VisibilityCheck/OldPackageName", "new_name": "stub/random-pkgname"} diff --git a/testdata/repos/visibility/VisibilityCheck/OldPackageNameDep/OldPackageNameDep-0.ebuild b/testdata/repos/visibility/VisibilityCheck/OldPackageNameDep/OldPackageNameDep-0.ebuild new file mode 100644 index 00000000..fc165544 --- /dev/null +++ b/testdata/repos/visibility/VisibilityCheck/OldPackageNameDep/OldPackageNameDep-0.ebuild @@ -0,0 +1,8 @@ +EAPI=7 +DESCRIPTION="Ebuild with pkgmoved dep" +HOMEPAGE="https://github.com/pkgcore/pkgcheck" +SLOT="0" +LICENSE="BSD" +KEYWORDS="~amd64" + +RDEPEND="!VisibilityCheck/OldPackageName" -- cgit v1.2.3-65-gdbad