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 5145A138CA2 for ; Tue, 21 Apr 2015 23:21:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B42A6E07A3; Tue, 21 Apr 2015 23:21:28 +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 331BEE06FE for ; Tue, 21 Apr 2015 23:21:28 +0000 (UTC) Received: from big_daddy.dol-sen.ca (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 4656D340B49 for ; Tue, 21 Apr 2015 23:21:27 +0000 (UTC) Date: Tue, 21 Apr 2015 16:21:24 -0700 From: Brian Dolbec To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] UseManager: handle newlines for USE_EXPAND prefixes (bug 546512) Message-ID: <20150421162124.28734421.dolsen@gentoo.org> In-Reply-To: <1429473519-18251-1-git-send-email-zmedico@gentoo.org> References: <1429473519-18251-1-git-send-email-zmedico@gentoo.org> Organization: Gentoo 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 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 46bbb88c-a0eb-4689-81e3-a28600c726d3 X-Archives-Hash: 30d3194d04415d5711df3f2866b82d8b On Sun, 19 Apr 2015 12:58:39 -0700 Zac Medico wrote: > From: Albert Safin > > Since commit b65e1fc5fe723bd07bf034f6e08878fa3eb033cb, USE_EXPAND > prefixes affected subsequent lines of the same atom in package.use. > > Fixes: b65e1fc5fe72 ("Support USE_EXPAND prefixes in package.use and > relevant files") X-Gentoo-Bug: 546512 > X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=546512 > --- > pym/portage/package/ebuild/_config/UseManager.py | 8 +++++++- > pym/portage/util/__init__.py | 10 +++++++--- > 2 files changed, 14 insertions(+), 4 deletions(-) > > diff --git a/pym/portage/package/ebuild/_config/UseManager.py > b/pym/portage/package/ebuild/_config/UseManager.py index > a93ea5c..6041802 100644 --- > a/pym/portage/package/ebuild/_config/UseManager.py +++ > b/pym/portage/package/ebuild/_config/UseManager.py @@ -208,6 +208,9 > @@ class UseManager(object): useflags = [] > use_expand_prefix = '' > for prefixed_useflag in v: > + if extended_syntax and > prefixed_useflag == "\n": > + use_expand_prefix = "" > + continue > if extended_syntax and > prefixed_useflag[-1] == ":": use_expand_prefix = > prefixed_useflag[:-1].lower() + "_" continue > @@ -236,11 +239,14 @@ class UseManager(object): > ret = ExtendedAtomDict(dict) > if user_config: > pusedict = grabdict_package( > - os.path.join(location, file_name), > recursive=1, allow_wildcard=True, allow_repo=True, verify_eapi=False) > + os.path.join(location, file_name), > recursive=1, newlines=1, allow_wildcard=True, allow_repo=True, > verify_eapi=False) for k, v in pusedict.items(): l = [] > use_expand_prefix = '' > for flag in v: > + if flag == "\n": > + use_expand_prefix = > "" > + continue > if flag[-1] == ":": > use_expand_prefix = > flag[:-1].lower() + "_" continue > diff --git a/pym/portage/util/__init__.py > b/pym/portage/util/__init__.py index 4b82e71..48cd1b7 100644 > --- a/pym/portage/util/__init__.py > +++ b/pym/portage/util/__init__.py > @@ -340,7 +340,7 @@ def stack_lists(lists, incremental=1, > remember_source_file=False, else: > return list(new_list) > > -def grabdict(myfilename, juststrings=0, empty=0, recursive=0, > incremental=1): +def grabdict(myfilename, juststrings=0, empty=0, > recursive=0, incremental=1, newlines=0): """ > This function grabs the lines in a file, normalizes > whitespace and returns lines in a dictionary > @@ -354,6 +354,8 @@ def grabdict(myfilename, juststrings=0, empty=0, > recursive=0, incremental=1): @type recursive: Boolean (integer) > @param incremental: Append to the return list, don't > overwrite @type incremental: Boolean (integer) > + @param newlines: Append newlines > + @type newlines: Boolean (integer) > @rtype: Dictionary > @return: > 1. Returns the lines in a file in a dictionary, for example: > @@ -379,6 +381,8 @@ def grabdict(myfilename, juststrings=0, empty=0, > recursive=0, incremental=1): continue > if len(myline) < 1 and empty == 1: > continue > + if newlines: > + myline.append("\n") > if incremental: > newdict.setdefault(myline[0], > []).extend(myline[1:]) else: > @@ -424,7 +428,7 @@ def read_corresponding_eapi_file(filename, > default="0"): return default > return eapi > > -def grabdict_package(myfilename, juststrings=0, recursive=0, > +def grabdict_package(myfilename, juststrings=0, recursive=0, > newlines=0, allow_wildcard=False, allow_repo=False, > allow_build_id=False, verify_eapi=False, eapi=None, eapi_default="0"): > """ Does the same thing as grabdict except it validates keys > @@ -438,7 +442,7 @@ def grabdict_package(myfilename, juststrings=0, > recursive=0, atoms = {} > for filename in file_list: > d = grabdict(filename, juststrings=False, > - empty=True, recursive=False, > incremental=True) > + empty=True, recursive=False, > incremental=True, newlines=newlines) if not d: > continue > if verify_eapi and eapi is None: yeah, LGTM -- Brian Dolbec