aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-08-29 20:35:08 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2023-08-29 20:35:08 +0300
commit73b2cc0ecf48fec9242823009e0de953981913b3 (patch)
tree048722edbb14045cf2226d2d7ca0aee88d0f7a04 /src
parentebuild.repository: add support for stabilization groups (diff)
downloadpkgcore-73b2cc0ecf48fec9242823009e0de953981913b3.tar.gz
pkgcore-73b2cc0ecf48fec9242823009e0de953981913b3.tar.bz2
pkgcore-73b2cc0ecf48fec9242823009e0de953981913b3.zip
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@gentoo.org> Follows: d00711f2d6cbae14a57088ef78caa3daf72069aa Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'src')
-rw-r--r--src/pkgcore/ebuild/repository.py35
1 files changed, 20 insertions, 15 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):