commit:     c3407ae2317199c301863b5ac25c456845bdcb18
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 16 18:42:59 2024 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Wed Jan 17 06:37:35 2024 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=c3407ae2

OldPackageName: new check for package named after old package name

Resolves: https://github.com/pkgcore/pkgcheck/issues/650
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>

 src/pkgcheck/checks/visibility.py                   | 21 +++++++++++++++++++++
 .../VisibilityCheck/OldPackageName/expected.json    |  1 +
 .../OldPackageName/OldPackageName-0.ebuild          |  6 ++++++
 testdata/repos/visibility/profiles/updates/1Q-2024  |  1 +
 4 files changed, 29 insertions(+)

diff --git a/src/pkgcheck/checks/visibility.py 
b/src/pkgcheck/checks/visibility.py
index 874d1bbf..050b923b 100644
--- a/src/pkgcheck/checks/visibility.py
+++ b/src/pkgcheck/checks/visibility.py
@@ -214,6 +214,23 @@ class NonsolvableDepsInExp(NonsolvableDeps):
     _profile = "exp"
 
 
+class OldPackageName(results.PackageResult, results.Error):
+    """Package uses old name which is source of pkgmove.
+
+    Package is using ``${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, new_name: str, **kwargs):
+        super().__init__(**kwargs)
+        self.new_name = new_name
+
+    @property
+    def desc(self):
+        return f"package uses old name which is source of pkgmove, rename into 
{self.new_name!r}"
+
+
 class VisibilityCheck(feeds.EvaluateDepSet, feeds.QueryCache, Check):
     """Visibility dependency scans.
 
@@ -232,6 +249,7 @@ class VisibilityCheck(feeds.EvaluateDepSet, 
feeds.QueryCache, Check):
             NonsolvableDepsInDev,
             NonsolvableDepsInExp,
             DependencyMoved,
+            OldPackageName,
         }
     )
 
@@ -269,6 +287,9 @@ class VisibilityCheck(feeds.EvaluateDepSet, 
feeds.QueryCache, Check):
             # vcs ebuild that better not be visible
             yield from self.check_visibility_vcs(pkg)
 
+        if pkg.key in self.pkgmoves:
+            yield OldPackageName(self.pkgmoves[pkg.key], pkg=pkg)
+
         suppressed_depsets = []
         for attr in (x.lower() for x in pkg.eapi.dep_keys):
             nonexistent = set()

diff --git 
a/testdata/data/repos/visibility/VisibilityCheck/OldPackageName/expected.json 
b/testdata/data/repos/visibility/VisibilityCheck/OldPackageName/expected.json
new file mode 100644
index 00000000..fcc053e4
--- /dev/null
+++ 
b/testdata/data/repos/visibility/VisibilityCheck/OldPackageName/expected.json
@@ -0,0 +1 @@
+{"__class__": "OldPackageName", "category": "VisibilityCheck", "package": 
"OldPackageName", "new_name": "stub/random-pkgname"}

diff --git 
a/testdata/repos/visibility/VisibilityCheck/OldPackageName/OldPackageName-0.ebuild
 
b/testdata/repos/visibility/VisibilityCheck/OldPackageName/OldPackageName-0.ebuild
new file mode 100644
index 00000000..842db9dd
--- /dev/null
+++ 
b/testdata/repos/visibility/VisibilityCheck/OldPackageName/OldPackageName-0.ebuild
@@ -0,0 +1,6 @@
+EAPI=7
+DESCRIPTION="Ebuild with pkgmoved name"
+HOMEPAGE="https://github.com/pkgcore/pkgcheck";
+SLOT="0"
+LICENSE="BSD"
+KEYWORDS="~amd64"

diff --git a/testdata/repos/visibility/profiles/updates/1Q-2024 
b/testdata/repos/visibility/profiles/updates/1Q-2024
index 518e4bf5..dfb9b553 100644
--- a/testdata/repos/visibility/profiles/updates/1Q-2024
+++ b/testdata/repos/visibility/profiles/updates/1Q-2024
@@ -1 +1,2 @@
 move stub/old-name stub/stable
+move VisibilityCheck/OldPackageName stub/random-pkgname

Reply via email to