Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, bin/
Date: Mon, 05 Feb 2018 19:25:38
Message-Id: 1517858714.fa3f1ba8153644e07be3215d8862522a0de12134.mgorny@gentoo
1 commit: fa3f1ba8153644e07be3215d8862522a0de12134
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat May 21 06:54:19 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Feb 5 19:25:14 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fa3f1ba8
7
8 portage.package.ebuild.config: Always export filtered USE_EXPAND vars
9
10 Ensure that all USE_EXPAND variables are always exported with filtered
11 USE flags inside, even if none of those flags are declared in IUSE.
12 This is the behavior required for EAPI 5+ by the PMS.
13
14 Since the behavior for earlier EAPIs is left undefined and having
15 different behavior would be confusing to users, apply it in earlier
16 EAPIs as well.
17
18 Bug: https://bugs.gentoo.org/582140
19 Closes: https://github.com/gentoo/portage/pull/254
20 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
21
22 bin/ebuild.sh | 8 +-----
23 pym/portage/package/ebuild/config.py | 55 ++----------------------------------
24 2 files changed, 4 insertions(+), 59 deletions(-)
25
26 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
27 index 4a80fdd06..d63b0a0ba 100755
28 --- a/bin/ebuild.sh
29 +++ b/bin/ebuild.sh
30 @@ -1,5 +1,5 @@
31 #!/bin/bash
32 -# Copyright 1999-2015 Gentoo Foundation
33 +# Copyright 1999-2018 Gentoo Foundation
34 # Distributed under the terms of the GNU General Public License v2
35
36 # Prevent aliases from causing portage to act inappropriately.
37 @@ -704,12 +704,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
38 fi
39 fi
40
41 -# unset USE_EXPAND variables that contain only the special "*" token
42 -for x in ${USE_EXPAND} ; do
43 - [ "${!x}" == "*" ] && unset ${x}
44 -done
45 -unset x
46 -
47 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
48 then
49 export DEBUGBUILD=1
50
51 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
52 index 35cf4f614..432520ba8 100644
53 --- a/pym/portage/package/ebuild/config.py
54 +++ b/pym/portage/package/ebuild/config.py
55 @@ -1359,47 +1359,7 @@ class config(object):
56 filtered_var_split.append(x)
57 var_split = filtered_var_split
58
59 - if var_split:
60 - value = ' '.join(var_split)
61 - else:
62 - # Don't export empty USE_EXPAND vars unless the user config
63 - # exports them as empty. This is required for vars such as
64 - # LINGUAS, where unset and empty have different meanings.
65 - # The special '*' token is understood by ebuild.sh, which
66 - # will unset the variable so that things like LINGUAS work
67 - # properly (see bug #459350).
68 - if has_wildcard:
69 - value = '*'
70 - else:
71 - if has_iuse:
72 - already_set = False
73 - # Skip the first 'env' configdict, in order to
74 - # avoid infinite recursion here, since that dict's
75 - # __getitem__ calls the current __getitem__.
76 - for d in self._settings.lookuplist[1:]:
77 - if key in d:
78 - already_set = True
79 - break
80 -
81 - if not already_set:
82 - for x in self._unfiltered_use:
83 - if x[:prefix_len] == prefix:
84 - already_set = True
85 - break
86 -
87 - if already_set:
88 - value = ''
89 - else:
90 - value = '*'
91 - else:
92 - # It's not in IUSE, so just allow the variable content
93 - # to pass through if it is defined somewhere. This
94 - # allows packages that support LINGUAS but don't
95 - # declare it in IUSE to use the variable outside of the
96 - # USE_EXPAND context.
97 - value = None
98 -
99 - return value
100 + return ' '.join(var_split)
101
102 def _setcpv_recursion_gate(f):
103 """
104 @@ -1775,7 +1735,7 @@ class config(object):
105 self, unfiltered_use, use, self.usemask,
106 portage_iuse, use_expand_split, self._use_expand_dict)
107
108 - use_expand_iuses = {}
109 + use_expand_iuses = dict((k, set()) for k in use_expand_split)
110 for x in portage_iuse:
111 x_split = x.split('_')
112 if len(x_split) == 1:
113 @@ -1783,18 +1743,9 @@ class config(object):
114 for i in range(len(x_split) - 1):
115 k = '_'.join(x_split[:i+1])
116 if k in use_expand_split:
117 - v = use_expand_iuses.get(k)
118 - if v is None:
119 - v = set()
120 - use_expand_iuses[k] = v
121 - v.add(x)
122 + use_expand_iuses[k].add(x)
123 break
124
125 - # If it's not in IUSE, variable content is allowed
126 - # to pass through if it is defined somewhere. This
127 - # allows packages that support LINGUAS but don't
128 - # declare it in IUSE to use the variable outside of the
129 - # USE_EXPAND context.
130 for k, use_expand_iuse in use_expand_iuses.items():
131 if k + '_*' in use:
132 use.update( x for x in use_expand_iuse if x not in usemask )