diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2024-07-13 21:43:45 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2024-07-19 07:53:57 +0300 |
commit | dacab558f73d6c30e38f91dc50c8b89d30010fdc (patch) | |
tree | cdec63ff21c2692cce46fc23a61dc194f2a0b414 | |
parent | PythonCompatCheck: add whitelist for backports (diff) | |
download | pkgcheck-dacab558f73d6c30e38f91dc50c8b89d30010fdc.tar.gz pkgcheck-dacab558f73d6c30e38f91dc50c8b89d30010fdc.tar.bz2 pkgcheck-dacab558f73d6c30e38f91dc50c8b89d30010fdc.zip |
OldPackageNameDep: check for dependency using pkgmoved name
Resolves: https://github.com/pkgcore/pkgcheck/issues/659
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
3 files changed, 37 insertions, 0 deletions
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" |