Skip to content

Commit

Permalink
OldPackageNameDep: check for dependency using pkgmoved name
Browse files Browse the repository at this point in the history
Resolves: pkgcore#659
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
  • Loading branch information
arthurzam committed Jul 13, 2024
1 parent 722236d commit aabce0a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/pkgcheck/checks/visibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,25 @@ def desc(self):
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 is depending ``${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 source of pkgmove, rename into {self.new_name!r}"


class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check):
"""Visibility dependency scans.
Expand All @@ -250,6 +269,7 @@ class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check):
NonsolvableDepsInExp,
DependencyMoved,
OldPackageName,
OldPackageNameDep,
}
)

Expand Down Expand Up @@ -295,6 +315,11 @@ def feed(self, pkg):
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:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"__class__": "OldPackageNameDep", "category": "VisibilityCheck", "package": "OldPackageNameDep", "version": "0", "attr": "rdepend", "dep": "!VisibilityCheck/OldPackageName", "new_name": "stub/random-pkgname"}
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit aabce0a

Please sign in to comment.