From: "Arthur Zamarin" <arthurzam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/
Date: Tue, 29 Aug 2023 17:37:20 +0000 (UTC) [thread overview]
Message-ID: <1693330508.73b2cc0ecf48fec9242823009e0de953981913b3.arthurzam@gentoo> (raw)
commit: 73b2cc0ecf48fec9242823009e0de953981913b3
Author: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
AuthorDate: Tue Aug 29 17:35:08 2023 +0000
Commit: Arthur Zamarin <arthurzam <AT> gentoo <DOT> org>
CommitDate: Tue Aug 29 17:35:08 2023 +0000
URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=73b2cc0e
ebuild.repository: require .group extension for stabilization groups
After further consideration, it seems that the requiring .group extension
will make our life easier, with exact format, and save us from backup
files, readme or similar.
https://github.com/pkgcore/pkgcore/pull/412#discussion_r1307738865
Suggested-by: Michał Górny <mgorny <AT> gentoo.org>
Follows: d00711f2d6cbae14a57088ef78caa3daf72069aa
Signed-off-by: Arthur Zamarin <arthurzam <AT> gentoo.org>
src/pkgcore/ebuild/repository.py | 35 ++++++++++++++++++++---------------
tests/ebuild/test_repository.py | 21 +++++++++++----------
2 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py
index 50f115cc1..49bd72e19 100644
--- a/src/pkgcore/ebuild/repository.py
+++ b/src/pkgcore/ebuild/repository.py
@@ -676,22 +676,27 @@ class UnconfiguredTree(prototype.tree):
@klass.jit_attr
def stabilization_groups(self):
"""Return a mapping of stabilization groups to packages."""
- stabilization_groups = {}
base_dir = pjoin(self.location, "metadata", "stabilization-groups")
- for dirname, _dirs, files in os.walk(base_dir):
- dirbase = dirname.removeprefix(base_dir)
- for file in files:
- pkgs = set()
- for lineno, line in enumerate(readlines_utf8(pjoin(dirname, file)), 1):
- try:
- if line := line.split("#", maxsplit=1)[0].strip():
- pkgs.add(atom(line))
- except ebuild_errors.MalformedAtom as exc:
- logger.error(
- f"{dirname.removeprefix(self.location)}/{file}, line {lineno}: parsing error: {exc}"
- )
- group = f"{dirbase}/{file}".removeprefix("/")
- stabilization_groups[group] = frozenset(pkgs)
+ group_files = {
+ pjoin(dirname, file)
+ .removeprefix(base_dir + "/")
+ .removesuffix(".group"): pjoin(dirname, file)
+ for dirname, _dirs, files in os.walk(base_dir)
+ for file in files
+ if file.endswith(".group")
+ }
+ stabilization_groups = {}
+ for group_name, group_file in group_files.items():
+ pkgs = set()
+ for lineno, line in enumerate(readlines_utf8(group_file), 1):
+ try:
+ if line := line.split("#", maxsplit=1)[0].strip():
+ pkgs.add(atom(line))
+ except ebuild_errors.MalformedAtom as exc:
+ logger.error(
+ f"{group_file.removeprefix(self.location)}, line {lineno}: parsing error: {exc}"
+ )
+ stabilization_groups[group_name] = frozenset(pkgs)
return ImmutableDict(stabilization_groups)
def _regen_operation_helper(self, **kwds):
diff --git a/tests/ebuild/test_repository.py b/tests/ebuild/test_repository.py
index fceb70b37..2ba4eda57 100644
--- a/tests/ebuild/test_repository.py
+++ b/tests/ebuild/test_repository.py
@@ -202,17 +202,18 @@ class TestUnconfiguredTree:
def test_stabilization_groups(self, tmp_path, caplog):
base = tmp_path / "metadata/stabilization-groups"
(base / "pkgcore").mkdir(parents=True)
- (base / "gentoo").write_text(
- textwrap.dedent(
- """\
- # some text here
- dev-python/pkgcore
- dev-python/pytest # comment
- @bad_atom@
- """
- )
+ (base / "gentoo.group").write_text(
+ """\
+ # some text here
+ dev-python/pkgcore
+ dev-python/pytest # comment
+ @bad_atom@
+ """
+ )
+ (base / "pkgcore" / "snakeoil.group").write_text(
+ """dev-python/snakeoil # comment"""
)
- (base / "pkgcore" / "snakeoil").write_text("""dev-python/snakeoil # comment""")
+ (base / "pkgcore" / "pkgdev").write_text("""dev-python/pkgdev # comment""")
mirrors = self.mk_tree(tmp_path).stabilization_groups
assert set(mirrors.keys()) == {"gentoo", "pkgcore/snakeoil"}
assert set(mirrors["gentoo"]) == {
next reply other threads:[~2023-08-29 17:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-29 17:37 Arthur Zamarin [this message]
-- strict thread matches above, loose matches on Subject: below --
2023-12-28 5:27 [gentoo-commits] proj/pkgcore/pkgcore:master commit in: tests/ebuild/, src/pkgcore/ebuild/ Arthur Zamarin
2023-10-23 17:35 Arthur Zamarin
2023-02-02 19:58 Arthur Zamarin
2023-01-17 20:50 Arthur Zamarin
2023-01-02 20:03 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 Arthur Zamarin
2022-12-26 17:28 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=1693330508.73b2cc0ecf48fec9242823009e0de953981913b3.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