Gentoo Archives: gentoo-portage-dev

From: Brian Dolbec <dolsen@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] [PATCH] make.defaults: negative incrementals in USE_EXPAND (530222)
Date: Thu, 27 Nov 2014 07:46:21
Message-Id: 20141126234601.2e3700f8.dolsen@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] make.defaults: negative incrementals in USE_EXPAND (530222) by Zac Medico
1 On Wed, 26 Nov 2014 23:33:56 -0800
2 Zac Medico <zmedico@g.o> wrote:
3
4 > Previously, USE_EXPAND variable settings in profile make.defaults only
5 > supported positive incremental settings. This patch adds support for
6 > negative settings like PYTHON_TARGETS="-python3_3", which brings
7 > behavior into alignment with PMS.
8 >
9 > Notably, this patch does not change behavior for settings in
10 > make.conf. In make.conf, settings to USE_EXPAND variables remain
11 > entirely non-incremental. PMS does not govern make.conf behavior.
12 >
13 > X-Gentoo-Bug: 530222
14 > X-Gentoo-Url: https://bugs.gentoo.org/show_bug.cgi?id=530222
15 > ---
16 > pym/portage/package/ebuild/config.py | 23 ++--
17 > .../tests/ebuild/test_use_expand_incremental.py | 132
18 > +++++++++++++++++++++
19 > pym/portage/tests/resolver/ResolverPlayground.py | 10 ++ 3 files
20 > changed, 155 insertions(+), 10 deletions(-) create mode 100644
21 > pym/portage/tests/ebuild/test_use_expand_incremental.py
22 >
23 > diff --git a/pym/portage/package/ebuild/config.py
24 > b/pym/portage/package/ebuild/config.py index bf39487..97c794f 100644
25 > --- a/pym/portage/package/ebuild/config.py
26 > +++ b/pym/portage/package/ebuild/config.py
27 > @@ -2315,6 +2315,7 @@ class config(object):
28 > # is enabled (for sub-profiles).
29 > configdict_defaults = self.configdict['defaults']
30 > if self._make_defaults is not None:
31 > + defaults_use = []
32 > for i, cfg in enumerate(self._make_defaults):
33 > if not cfg:
34 > self.make_defaults_use.append("")
35 > @@ -2332,22 +2333,24 @@ class config(object):
36 > if v is None:
37 > continue
38 > prefix = k.lower() + '_'
39 > - if k in myincrementals:
40 > - for x in v.split():
41 > - if x[:1] ==
42 > '-':
43 > -
44 > expand_use.append('-' + prefix + x[1:])
45 > - else:
46 > -
47 > expand_use.append(prefix + x)
48 > - else:
49 > - for x in v.split():
50 > + for x in v.split():
51 > + if x[:1] == '-':
52 > +
53 > expand_use.append('-' + prefix + x[1:])
54 > + else:
55 > expand_use.append(prefix
56 > + x) +
57 > + defaults_use.extend(expand_use)
58 > + defaults_use.extend(use.split())
59 > +
60 > if expand_use:
61 > expand_use.append(use)
62 > use = ' '.join(expand_use)
63 > self.make_defaults_use.append(use)
64 > self.make_defaults_use =
65 > tuple(self.make_defaults_use)
66 > - configdict_defaults['USE'] = ' '.join(
67 > - stack_lists([x.split() for x in
68 > self.make_defaults_use]))
69 > + # Preserve both positive and negative flags
70 > here, since
71 > + # negative flags may later interact with
72 > other flags pulled
73 > + # in via USE_ORDER.
74 > + configdict_defaults['USE'] = '
75 > '.join(defaults_use) # Set to None so this code only runs once.
76 > self._make_defaults = None
77 >
78
79
80 This code looks fine. As for the test, I know you know what you are
81 doing :)
82
83 LGTM
84
85
86 --
87 Brian Dolbec <dolsen>

Replies