Gentoo Archives: gentoo-commits

From: Arthur Zamarin <arthurzam@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/pkgcore/pkgcheck:master commit in: src/pkgcheck/checks/, tests/checks/
Date: Sat, 04 Mar 2023 05:59:15
Message-Id: 1677909416.861c24ab76bfc36de2ca80a8375866e4123dc51a.arthurzam@gentoo
1 commit: 861c24ab76bfc36de2ca80a8375866e4123dc51a
2 Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
3 AuthorDate: Sat Mar 4 05:56:56 2023 +0000
4 Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
5 CommitDate: Sat Mar 4 05:56:56 2023 +0000
6 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcheck.git/commit/?id=861c24ab
7
8 StableRequestCheck: ignore version not keyworded for arches
9
10 packages that are not keyworded for relevant arches but keyworded to
11 another arch, were not ignored by the check. This patch fixes that.
12
13 Resolves: https://github.com/pkgcore/pkgcheck/issues/544
14 Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
15
16 src/pkgcheck/checks/stablereq.py | 5 +++++
17 tests/checks/test_stablereq.py | 9 +++++++++
18 2 files changed, 14 insertions(+)
19
20 diff --git a/src/pkgcheck/checks/stablereq.py b/src/pkgcheck/checks/stablereq.py
21 index 57e41a84..be8e2c7f 100644
22 --- a/src/pkgcheck/checks/stablereq.py
23 +++ b/src/pkgcheck/checks/stablereq.py
24 @@ -71,6 +71,7 @@ class StableRequestCheck(GentooRepoCheck):
25 pkg_keywords.update(pkg.keywords)
26
27 if stable_pkg_keywords := {x for x in pkg_keywords if x[0] not in {"-", "~"}}:
28 + keyworded_pkg_keywords = {"~" + x for x in stable_pkg_keywords}
29 for slot, pkgs in sorted(pkg_slotted.items()):
30 slot_keywords = set().union(*(pkg.keywords for pkg in pkgs))
31 stable_slot_keywords = slot_keywords.intersection(stable_pkg_keywords)
32 @@ -79,6 +80,10 @@ class StableRequestCheck(GentooRepoCheck):
33 if stable_pkg_keywords.intersection(pkg.keywords):
34 break
35
36 + # stop if not keyworded for stable
37 + if not keyworded_pkg_keywords.intersection(pkg.keywords):
38 + break
39 +
40 try:
41 match = next(self.modified_repo.itermatch(pkg.versioned_atom))
42 except StopIteration:
43
44 diff --git a/tests/checks/test_stablereq.py b/tests/checks/test_stablereq.py
45 index 43f4380b..efb94b7a 100644
46 --- a/tests/checks/test_stablereq.py
47 +++ b/tests/checks/test_stablereq.py
48 @@ -118,6 +118,15 @@ class TestStableRequestCheck(ReportTestCase):
49 expected = StableRequest("1", ["~amd64"], 30, pkg=VersionedCPV("cat/pkg-2"))
50 assert r == expected
51
52 + def test_unkeyworded_new_pkg(self):
53 + self.parent_repo.create_ebuild("cat/pkg-1", keywords=["amd64"])
54 + self.parent_git_repo.add_all("cat/pkg-1")
55 + self.parent_repo.create_ebuild("cat/pkg-2", keywords=["~x86"])
56 + self.parent_git_repo.add_all("cat/pkg-2")
57 + self.child_git_repo.run(["git", "pull", "origin", "main"])
58 + self.init_check(future=30)
59 + self.assertNoReport(self.check, self.source)
60 +
61 def test_moved_category(self):
62 self.parent_repo.create_ebuild("cat/pkg-1", keywords=["amd64"])
63 self.parent_git_repo.add_all("cat/pkg-1")