Skip to content

Commit ea78fb2

Browse files
committed
GitPkgCommitsCheck: add check for EAPI change without revbump
Resolves: #557 Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
1 parent 1eb9de2 commit ea78fb2

2 files changed

Lines changed: 29 additions & 3 deletions

File tree

src/pkgcheck/checks/git.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,18 @@ class PythonPEP517WithoutRevbump(results.PackageResult, results.Warning):
183183
desc = "changed DISTUTILS_USE_PEP517 without new revision"
184184

185185

186+
class EAPIChangeWithoutRevbump(results.PackageResult, results.Warning):
187+
"""Package has changed EAPI without revbump.
188+
189+
The package has changed EAPI without a new revision. An EAPI bump
190+
might affect the installed files (EAPI changes, eclass functions
191+
may change behavior, new portage features might be used, etc.).
192+
The change should also be reflected in the vdb's EAPI file.
193+
"""
194+
195+
desc = "changed EAPI without new revision"
196+
197+
186198
class SrcUriChecksumChange(results.PackageResult, results.Error):
187199
"""SRC_URI changing checksum without distfile rename."""
188200

@@ -278,6 +290,7 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck):
278290
SrcUriChecksumChange,
279291
SuspiciousSrcUriChange,
280292
PythonPEP517WithoutRevbump,
293+
EAPIChangeWithoutRevbump,
281294
]
282295
)
283296

@@ -392,6 +405,9 @@ def found_pep517_lines(cmp_pkg):
392405
if found_old_pep517_line ^ found_new_pep517_line:
393406
yield PythonPEP517WithoutRevbump(pkg=new_pkg)
394407

408+
if old_pkg.eapi != new_pkg.eapi:
409+
yield EAPIChangeWithoutRevbump(pkg=new_pkg)
410+
395411
old_slot, new_slot = old_pkg.slot, new_pkg.slot
396412
if old_slot != new_slot:
397413
slotmoves = (

tests/checks/test_git.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def _setup(self, tmp_path, tool, make_repo, make_git_repo):
395395
self.parent_repo = make_repo(self.parent_git_repo.path, repo_id="gentoo", arches=["amd64"])
396396
self.parent_git_repo.add_all("initial commit")
397397
# create a stub pkg and commit it
398-
self.parent_repo.create_ebuild("cat/pkg-0")
398+
self.parent_repo.create_ebuild("cat/pkg-0", eapi="7")
399399
self.parent_git_repo.add_all("cat/pkg-0")
400400

401401
# initialize child repo
@@ -694,6 +694,16 @@ def test_python_pep517_change(self):
694694
expected = git_mod.PythonPEP517WithoutRevbump(pkg=CPV("newcat/newpkg-1"))
695695
assert r == expected
696696

697+
def test_eapi_change(self):
698+
# bump eapi
699+
self.child_repo.create_ebuild("cat/pkg-0", eapi="8")
700+
self.child_git_repo.add_all("cat/pkg-0")
701+
# pull changes to child repo
702+
self.init_check()
703+
r = self.assertReport(self.check, self.source)
704+
expected = git_mod.EAPIChangeWithoutRevbump(pkg=CPV("cat/pkg-0"))
705+
assert r == expected
706+
697707
def test_src_uri_change(self):
698708
distfile = [
699709
"DIST",
@@ -721,8 +731,8 @@ def test_src_uri_change(self):
721731
assert r == git_mod.SuspiciousSrcUriChange(old_url, new_url, distfile[1], pkg=CP("cat/pkg"))
722732
# revert change and check for no report with same mirror url
723733
self.child_git_repo.run(["git", "reset", "--hard", "origin/main"])
724-
self.child_repo.create_ebuild("cat/pkg-1", src_uri=old_url, eapi="8")
725-
self.child_git_repo.add_all("cat/pkg: bump EAPI", signoff=True)
734+
self.child_repo.create_ebuild("cat/pkg-1", src_uri=old_url, homepage="https://gentoo.org")
735+
self.child_git_repo.add_all("cat/pkg: update HOMEPAGE", signoff=True)
726736
self.init_check()
727737
self.assertNoReport(self.check, self.source)
728738

0 commit comments

Comments
 (0)