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