commit:     ea78fb2ea4bf99253d31afea9b6141f8ffc5b6dc
Author:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  5 17:51:56 2023 +0000
Commit:     Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sun Mar  5 17:51:56 2023 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=ea78fb2e

GitPkgCommitsCheck: add check for EAPI change without revbump

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

 src/pkgcheck/checks/git.py | 16 ++++++++++++++++
 tests/checks/test_git.py   | 16 +++++++++++++---
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py
index 22780cbe..7309a08f 100644
--- a/src/pkgcheck/checks/git.py
+++ b/src/pkgcheck/checks/git.py
@@ -183,6 +183,18 @@ class PythonPEP517WithoutRevbump(results.PackageResult, 
results.Warning):
     desc = "changed DISTUTILS_USE_PEP517 without new revision"
 
 
+class EAPIChangeWithoutRevbump(results.PackageResult, results.Warning):
+    """Package has changed EAPI without revbump.
+
+    The package has changed EAPI without a new revision. An EAPI bump
+    might affect the installed files (EAPI changes, eclass functions
+    may change behavior, new portage features might be used, etc.).
+    The change should also be reflected in the vdb's EAPI file.
+    """
+
+    desc = "changed EAPI without new revision"
+
+
 class SrcUriChecksumChange(results.PackageResult, results.Error):
     """SRC_URI changing checksum without distfile rename."""
 
@@ -278,6 +290,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
             SrcUriChecksumChange,
             SuspiciousSrcUriChange,
             PythonPEP517WithoutRevbump,
+            EAPIChangeWithoutRevbump,
         ]
     )
 
@@ -392,6 +405,9 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
             if found_old_pep517_line ^ found_new_pep517_line:
                 yield PythonPEP517WithoutRevbump(pkg=new_pkg)
 
+        if old_pkg.eapi != new_pkg.eapi:
+            yield EAPIChangeWithoutRevbump(pkg=new_pkg)
+
         old_slot, new_slot = old_pkg.slot, new_pkg.slot
         if old_slot != new_slot:
             slotmoves = (

diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py
index 5deaad71..7eb7907a 100644
--- a/tests/checks/test_git.py
+++ b/tests/checks/test_git.py
@@ -395,7 +395,7 @@ class TestGitPkgCommitsCheck(ReportTestCase):
         self.parent_repo = make_repo(self.parent_git_repo.path, 
repo_id="gentoo", arches=["amd64"])
         self.parent_git_repo.add_all("initial commit")
         # create a stub pkg and commit it
-        self.parent_repo.create_ebuild("cat/pkg-0")
+        self.parent_repo.create_ebuild("cat/pkg-0", eapi="7")
         self.parent_git_repo.add_all("cat/pkg-0")
 
         # initialize child repo
@@ -694,6 +694,16 @@ class TestGitPkgCommitsCheck(ReportTestCase):
         expected = 
git_mod.PythonPEP517WithoutRevbump(pkg=CPV("newcat/newpkg-1"))
         assert r == expected
 
+    def test_eapi_change(self):
+        # bump eapi
+        self.child_repo.create_ebuild("cat/pkg-0", eapi="8")
+        self.child_git_repo.add_all("cat/pkg-0")
+        # pull changes to child repo
+        self.init_check()
+        r = self.assertReport(self.check, self.source)
+        expected = git_mod.EAPIChangeWithoutRevbump(pkg=CPV("cat/pkg-0"))
+        assert r == expected
+
     def test_src_uri_change(self):
         distfile = [
             "DIST",
@@ -721,8 +731,8 @@ class TestGitPkgCommitsCheck(ReportTestCase):
         assert r == git_mod.SuspiciousSrcUriChange(old_url, new_url, 
distfile[1], pkg=CP("cat/pkg"))
         # revert change and check for no report with same mirror url
         self.child_git_repo.run(["git", "reset", "--hard", "origin/main"])
-        self.child_repo.create_ebuild("cat/pkg-1", src_uri=old_url, eapi="8")
-        self.child_git_repo.add_all("cat/pkg: bump EAPI", signoff=True)
+        self.child_repo.create_ebuild("cat/pkg-1", src_uri=old_url, 
homepage="https://gentoo.org";)
+        self.child_git_repo.add_all("cat/pkg: update HOMEPAGE", signoff=True)
         self.init_check()
         self.assertNoReport(self.check, self.source)
 

Reply via email to