From: Brian Dolbec <dolsen@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Subject: Re: [gentoo-portage-dev] [PATCH] UseManager: handle newlines for USE_EXPAND prefixes (bug 546512)
Date: Tue, 21 Apr 2015 16:21:24 -0700 [thread overview]
Message-ID: <20150421162124.28734421.dolsen@gentoo.org> (raw)
In-Reply-To: <1429473519-18251-1-git-send-email-zmedico@gentoo.org>
On Sun, 19 Apr 2015 12:58:39 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> From: Albert Safin <xzfcpw@gmail.com>
>
> 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 <dolsen>
prev parent reply other threads:[~2015-04-21 23:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-19 19:58 [gentoo-portage-dev] [PATCH] UseManager: handle newlines for USE_EXPAND prefixes (bug 546512) Zac Medico
2015-04-21 23:21 ` Brian Dolbec [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150421162124.28734421.dolsen@gentoo.org \
--to=dolsen@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox