diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py index 22780cbe7..7309a08fb 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 @@ def found_pep517_lines(cmp_pkg): 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 5deaad71c..7eb7907a4 100644 --- a/tests/checks/test_git.py +++ b/tests/checks/test_git.py @@ -395,7 +395,7 @@ def _setup(self, tmp_path, tool, make_repo, make_git_repo): 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 @@ def test_python_pep517_change(self): 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 @@ def test_src_uri_change(self): 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)