From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 820EC15800A for ; Mon, 28 Aug 2023 17:49:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AD7922BC013; Mon, 28 Aug 2023 17:49:45 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8D2192BC013 for ; Mon, 28 Aug 2023 17:49:45 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 568B9340BDA for ; Mon, 28 Aug 2023 17:49:44 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 76076B84 for ; Mon, 28 Aug 2023 17:49:42 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1693244588.d00711f2d6cbae14a57088ef78caa3daf72069aa.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/, tests/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/repository.py tests/ebuild/test_repository.py X-VCS-Directories: tests/ebuild/ src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: d00711f2d6cbae14a57088ef78caa3daf72069aa X-VCS-Branch: master Date: Mon, 28 Aug 2023 17:49:42 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a631cf9c-536c-432c-88d9-073001f4d1aa X-Archives-Hash: 5f25b6095f8b5f31fbbf2c37e7b5a504 commit: d00711f2d6cbae14a57088ef78caa3daf72069aa Author: Arthur Zamarin gentoo org> AuthorDate: Mon Aug 28 17:43:08 2023 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Mon Aug 28 17:43:08 2023 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=d00711f2 ebuild.repository: add support for stabilization groups This is a special metadata files that can be used to group packages for stabilization bugs. Resolves: https://github.com/pkgcore/pkgcore/issues/411 Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/repository.py | 24 ++++++++++++++++++++++++ tests/ebuild/test_repository.py | 25 +++++++++++++++++++++++++ 2 files changed, 49 insertions(+) diff --git a/src/pkgcore/ebuild/repository.py b/src/pkgcore/ebuild/repository.py index 164aa0c97..50f115cc1 100644 --- a/src/pkgcore/ebuild/repository.py +++ b/src/pkgcore/ebuild/repository.py @@ -16,6 +16,7 @@ from snakeoil import chksum, klass from snakeoil.bash import read_dict from snakeoil.containers import InvertedContains from snakeoil.data_source import local_source +from snakeoil.fileutils import readlines_utf8 from snakeoil.mappings import ImmutableDict from snakeoil.obj import make_kls from snakeoil.osutils import listdir_dirs, listdir_files, pjoin @@ -34,7 +35,9 @@ from ..restrictions import packages from ..util import packages as pkgutils from . import cpv, digest, ebd, ebuild_src from . import eclass_cache as eclass_cache_mod +from . import errors as ebuild_errors from . import processor, repo_objs, restricts +from .atom import atom from .eapi import get_eapi @@ -670,6 +673,27 @@ class UnconfiguredTree(prototype.tree): pkg_deprecated.update(repo.config.pkg_deprecated) return packages.OrRestriction(*pkg_deprecated) + @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) + return ImmutableDict(stabilization_groups) + def _regen_operation_helper(self, **kwds): return _RegenOpHelper( self, diff --git a/tests/ebuild/test_repository.py b/tests/ebuild/test_repository.py index 85a248d8d..fceb70b37 100644 --- a/tests/ebuild/test_repository.py +++ b/tests/ebuild/test_repository.py @@ -199,6 +199,31 @@ class TestUnconfiguredTree: atom("