diff options
-rw-r--r-- | src/pkgcheck/checks/git.py | 6 | ||||
-rw-r--r-- | tests/checks/test_git.py | 15 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/pkgcheck/checks/git.py b/src/pkgcheck/checks/git.py index 7309a08f..aec3b05f 100644 --- a/src/pkgcheck/checks/git.py +++ b/src/pkgcheck/checks/git.py @@ -497,7 +497,11 @@ class GitPkgCommitsCheck(GentooRepoCheck, GitCommitsCheck): yield from self.rename_checks(list(pkg_map["R"])) # run modified package checks if modified := [pkg for pkg in pkg_map["M"] if pkg not in pkg_map["D"]]: - yield from self.modified_checks(modified, list(pkg_map["A"])) + version_modifications = defaultdict(list) + for pkg in modified: + version_modifications[pkg.fullver].append(pkg) + for modified in version_modifications.values(): + yield from self.modified_checks(modified, pkg_map["A"]) for git_pkg in pkgset: # remaining checks are irrelevant for removed packages diff --git a/tests/checks/test_git.py b/tests/checks/test_git.py index 7eb7907a..03687451 100644 --- a/tests/checks/test_git.py +++ b/tests/checks/test_git.py @@ -1,5 +1,6 @@ import os import textwrap +import time from datetime import datetime, timedelta from unittest.mock import patch @@ -736,6 +737,20 @@ class TestGitPkgCommitsCheck(ReportTestCase): self.init_check() self.assertNoReport(self.check, self.source) + def test_modified_added_file(self): + self.child_repo.create_ebuild("cat/pkg-0", homepage="https://gentoo.org") + self.child_git_repo.add_all("cat/pkg: update HOMEPAGE") + time.sleep(1) + self.child_repo.create_ebuild("cat/pkg-1", eapi="7") + self.child_git_repo.add_all("cat/pkg: add 1") + time.sleep(1) + self.child_repo.create_ebuild("cat/pkg-1", eapi="8") + self.child_git_repo.add_all("cat/pkg: bump EAPI") + self.init_check() + r = self.assertReport(self.check, self.source) + expected = git_mod.EAPIChangeWithoutRevbump(pkg=CPV("cat/pkg-1")) + assert r == expected + class TestGitEclassCommitsCheck(ReportTestCase): check_kls = git_mod.GitEclassCommitsCheck |