From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 5BA5F138A1A for ; Tue, 20 Jan 2015 11:19:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id DD3A0E095C; Tue, 20 Jan 2015 11:18:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 71DE7E092D for ; Tue, 20 Jan 2015 11:18:58 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp.gentoo.org (Postfix) with ESMTP id DF23A3406F5; Tue, 20 Jan 2015 11:18:57 +0000 (UTC) X-Virus-Scanned: by amavisd-new using ClamAV at gentoo.org X-Spam-Flag: NO X-Spam-Score: 1.015 X-Spam-Level: * X-Spam-Status: No, score=1.015 tagged_above=-999 required=5.5 tests=[RDNS_DYNAMIC=0.363, SPF_NEUTRAL=0.652] autolearn=no Received: from smtp.gentoo.org ([127.0.0.1]) by localhost (smtp.gentoo.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id baNYYx5eTsPp; Tue, 20 Jan 2015 11:18:52 +0000 (UTC) Received: from localhost.localdomain (94-40-194-152.tktelekom.pl [94.40.194.152]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 82429340691; Tue, 20 Jan 2015 11:18:48 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH] Support USE_EXPAND prefixes in package.use and relevant files Date: Tue, 20 Jan 2015 12:18:43 +0100 Message-Id: <1421752723-2045-1-git-send-email-mgorny@gentoo.org> X-Mailer: git-send-email 2.2.1 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 89731f8a-575d-4d4f-be36-52a5bdbc5239 X-Archives-Hash: 151c2ae07f14255395c71e41124ac43c Support prefixing groups of USE_EXPAND flags with 'USE_EXPAND:' in user configuration package.use and similar files. This provides a convenient way of declaring specifying multiple USE_EXPAND flags and matches the syntax supported by Paludis. Example: dev-util/netbeans NETBEANS_MODULES: php webcommon extide media-libs/mesa osmesa VIDEO_CARDS: intel nouveau --- pym/portage/package/ebuild/_config/UseManager.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py index 3a4ec22..59f474e 100644 --- a/pym/portage/package/ebuild/_config/UseManager.py +++ b/pym/portage/package/ebuild/_config/UseManager.py @@ -202,10 +202,17 @@ class UseManager(object): useflag_re = _get_useflag_re(eapi) for k, v in file_dict.items(): useflags = [] + use_expand_prefix = '' for prefixed_useflag in v: + if extended_syntax and prefixed_useflag[-1] == ":": + use_expand_prefix = prefixed_useflag[:-1].lower() + "_" + continue + if prefixed_useflag[:1] == "-": useflag = prefixed_useflag[1:] + prefixed_useflag = "-" + use_expand_prefix + useflag else: + prefixed_useflag = use_expand_prefix + prefixed_useflag useflag = prefixed_useflag if useflag_re.match(useflag) is None: writemsg(_("--- Invalid USE flag for '%s' in '%s': '%s'\n") % @@ -227,7 +234,18 @@ class UseManager(object): pusedict = grabdict_package( os.path.join(location, file_name), recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False) for k, v in pusedict.items(): - ret.setdefault(k.cp, {})[k] = tuple(v) + l = [] + use_expand_prefix = '' + for flag in v: + if flag[-1] == ":": + use_expand_prefix = flag[:-1].lower() + "_" + continue + if flag[0] == "-": + nv = "-" + use_expand_prefix + flag[1:] + else: + nv = use_expand_prefix + flag + l.append(nv) + ret.setdefault(k.cp, {})[k] = tuple(l) return ret -- 2.2.1