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 7D6A6158020 for ; Mon, 26 Dec 2022 17:28:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3C023E095F; Mon, 26 Dec 2022 17:28:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 2520AE095F for ; Mon, 26 Dec 2022 17:28:08 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 636013410D9 for ; Mon, 26 Dec 2022 17:28:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 669D77F8 for ; Mon, 26 Dec 2022 17:28:04 +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: <1672075644.c782af0cd25f28f5331aa3930b5b3abfb515398c.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/atom.py src/pkgcore/ebuild/eapi.py X-VCS-Directories: src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: c782af0cd25f28f5331aa3930b5b3abfb515398c X-VCS-Branch: master Date: Mon, 26 Dec 2022 17:28:04 +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: 97561ded-9329-4ffa-a723-d1791e146708 X-Archives-Hash: 8840773320e648fbd18e558ceac5779b commit: c782af0cd25f28f5331aa3930b5b3abfb515398c Author: Brian Harring gmail com> AuthorDate: Mon Dec 26 00:48:56 2022 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Mon Dec 26 17:27:24 2022 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=c782af0c Expand EAPI object declarations of support, wire atom to use it. Specifically, this moves strong blockers, use deps, and slot deps to rely upon the EAPI context of the atom parse. EAPI ultimately has say on this, thus just remove the 15+ year old hardcoded constants and use eapi_obj instead. Signed-off-by: Brian Harring gmail.com> Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/atom.py | 34 +++++++++++++++++++--------------- src/pkgcore/ebuild/eapi.py | 9 +++++++++ 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/src/pkgcore/ebuild/atom.py b/src/pkgcore/ebuild/atom.py index 0bcd76b6c..166d8c7b0 100644 --- a/src/pkgcore/ebuild/atom.py +++ b/src/pkgcore/ebuild/atom.py @@ -136,7 +136,7 @@ class atom(boolean.AndRestriction, metaclass=klass.generic_equality): if not eapi_obj.options.has_use_dep_defaults: raise errors.MalformedAtom( orig_atom, - f"use dep defaults are not allowed in EAPI {eapi_obj}", + f"use dep defaults are not allowed in EAPI {eapi}", ) # use defaults. @@ -202,9 +202,9 @@ class atom(boolean.AndRestriction, metaclass=klass.generic_equality): slot_operator = "=" slot = slot[:-1] slots = slot.split("/", 1) - elif eapi == "0": + elif not eapi_obj.options.has_slot_deps: raise errors.MalformedAtom( - orig_atom, "slot dependencies aren't allowed in EAPI 0" + orig_atom, f"slot dependencies aren't allowed in EAPI {eapi}" ) for chunk in slots: @@ -245,7 +245,11 @@ class atom(boolean.AndRestriction, metaclass=klass.generic_equality): atom = atom[1:] # hackish/slow, but lstrip doesn't take a 'prune this many' arg # open to alternatives - if eapi not in ("0", "1") and atom.startswith("!"): + if atom.startswith("!"): + if not eapi_obj.options.strong_blockers: + raise MalformedAtom( + f"strong blockers are not supported in EAPI {eapi}" + ) atom = atom[1:] sf(self, "blocks_strongly", True) else: @@ -274,17 +278,17 @@ class atom(boolean.AndRestriction, metaclass=klass.generic_equality): sf(self, "op", "") sf(self, "cpvstr", atom) - if eapi == "0": - for x in ("use", "slot"): - if getattr(self, x) is not None: - raise errors.MalformedAtom( - orig_atom, f"{x} atoms aren't supported for EAPI 0" - ) - elif eapi == "1": - if self.use is not None: - raise errors.MalformedAtom( - orig_atom, "use atoms aren't supported for EAPI < 2" - ) + if self.slot is not None and not eapi_obj.options.has_slot_deps: + raise errors.MalformedAtom( + orig_atom, f"{x} SLOT dep atoms aren't supported in EAPI {eapi}" + ) + + elif self.use is not None and not eapi_obj.options.has_use_deps: + raise errors.MalformedAtom( + orig_atom, "use atoms aren't supported for EAPI < 2" + ) + + # note that we're checking eapi, not eapi_obj. eapi_obj defaults to latest PMS if eapi != "-1": if self.repo_id is not None: raise errors.MalformedAtom( diff --git a/src/pkgcore/ebuild/eapi.py b/src/pkgcore/ebuild/eapi.py index 85ba43be7..3754402e0 100644 --- a/src/pkgcore/ebuild/eapi.py +++ b/src/pkgcore/ebuild/eapi.py @@ -52,6 +52,10 @@ eapi_optionals = ImmutableDict( "has_portdir": True, # Controls whether DESTTREE and INSDESTTREE are exported during src_install; see PMS. "has_desttree": True, + # Controls whether atoms support USE dependencies. + "has_use_deps": False, + # Controls wheter atoms support slot dependencies", + "has_slot_deps": False, # Controls whether ROOT, EROOT, D, and ED end with a trailing slash; see PMS. "trailing_slash": os.sep, # Controls whether SYSROOT, ESYSROOT, and BROOT are defined; see PMS. @@ -105,6 +109,8 @@ eapi_optionals = ImmutableDict( "src_uri_renames": False, # Controls whether SRC_URI supports fetch+ and mirror+ prefixes. "src_uri_unrestrict": False, + # Controls whether strong blockers- hard deps of "things are broken after this merge" are supported for atom syntax. + "strong_blockers": False, # Controls whether or not use dependency atoms are able to control their enforced # value relative to another; standard use deps just enforce either on or off; EAPIs # supporting this allow syntax that can enforce (for example) X to be on if Y is on. @@ -646,6 +652,7 @@ eapi1 = EAPI.register( eapi0.options, dict( iuse_defaults=True, + has_slot_deps=True, ), ), ebd_env_options=eapi0._ebd_env_options, @@ -669,6 +676,8 @@ eapi2 = EAPI.register( optionals=_combine_dicts( eapi1.options, dict( + has_use_deps=True, + strong_blockers=True, doman_language_detect=True, transitive_use_atoms=True, src_uri_renames=True,