From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/
Date: Sat, 11 Mar 2023 07:14:16 +0000 (UTC) [thread overview]
Message-ID: <1678518629.7410c137c57c645b5e502f279eb183a14d7ef216.arthurzam@gentoo> (raw)
commit: 7410c137c57c645b5e502f279eb183a14d7ef216
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 11 07:10:29 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Sat Mar 11 07:10:29 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=7410c137
GitPkgCommitsCheck: fix modification check for added ebuild in pkgset
When commit range has modification for multiple versions, with one of
them modifying a newly added version in the same range, it wouldn't find
the correct base commit and fail. Fix it by grouping based on fullver.
The test is special with time.sleep, since I need the commits be in
different seconds, otherwise the sorting by time might be bad.
Resolves: https://github.com/pkgcore/pkgcheck/issues/563
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcheck/checks/git.py | 6 +++++-
tests/checks/test_git.py | 15 +++++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
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
next reply other threads:[~2023-03-11 7:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-11 7:14 Arthur Zamarin [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-01-16 12:17 [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/ Arthur Zamarin
2024-03-07 16:06 Arthur Zamarin
2023-07-15 8:52 Arthur Zamarin
2023-03-05 17:13 Arthur Zamarin
2023-03-04 5:59 Arthur Zamarin
2023-01-21 9:46 Arthur Zamarin
2023-01-20 20:47 Arthur Zamarin
2022-11-26 11:47 Arthur Zamarin
2022-11-26 11:47 Arthur Zamarin
2022-10-28 13:34 Arthur Zamarin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1678518629.7410c137c57c645b5e502f279eb183a14d7ef216.arthurzam@gentoo \
--to=arthurzam@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox