Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH v2 2/2] portage.package.ebuild.config: Always export filtered USE_EXPAND vars
Date: Sat, 21 May 2016 07:35:18
Message-Id: 1463814909-16151-2-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH v2 1/2] portage.package.ebuild.config: Rename iuse_implicit -> iuse_effective by "Michał Górny"
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 bin/ebuild.sh | 6 ----
10 pym/portage/package/ebuild/config.py | 55 ++----------------------------------
11 2 files changed, 3 insertions(+), 58 deletions(-)
12
13 diff --git a/bin/ebuild.sh b/bin/ebuild.sh
14 index 5b3146d..edf885f 100755
15 --- a/bin/ebuild.sh
16 +++ b/bin/ebuild.sh
17 @@ -690,12 +690,6 @@ if ! has "$EBUILD_PHASE" clean cleanrm ; then
18 fi
19 fi
20
21 -# unset USE_EXPAND variables that contain only the special "*" token
22 -for x in ${USE_EXPAND} ; do
23 - [ "${!x}" == "*" ] && unset ${x}
24 -done
25 -unset x
26 -
27 if has nostrip ${FEATURES} ${RESTRICT} || has strip ${RESTRICT}
28 then
29 export DEBUGBUILD=1
30 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
31 index 5f19996..d92f5f6 100644
32 --- a/pym/portage/package/ebuild/config.py
33 +++ b/pym/portage/package/ebuild/config.py
34 @@ -1330,47 +1330,7 @@ class config(object):
35 filtered_var_split.append(x)
36 var_split = filtered_var_split
37
38 - if var_split:
39 - value = ' '.join(var_split)
40 - else:
41 - # Don't export empty USE_EXPAND vars unless the user config
42 - # exports them as empty. This is required for vars such as
43 - # LINGUAS, where unset and empty have different meanings.
44 - # The special '*' token is understood by ebuild.sh, which
45 - # will unset the variable so that things like LINGUAS work
46 - # properly (see bug #459350).
47 - if has_wildcard:
48 - value = '*'
49 - else:
50 - if has_iuse:
51 - already_set = False
52 - # Skip the first 'env' configdict, in order to
53 - # avoid infinite recursion here, since that dict's
54 - # __getitem__ calls the current __getitem__.
55 - for d in self._settings.lookuplist[1:]:
56 - if key in d:
57 - already_set = True
58 - break
59 -
60 - if not already_set:
61 - for x in self._unfiltered_use:
62 - if x[:prefix_len] == prefix:
63 - already_set = True
64 - break
65 -
66 - if already_set:
67 - value = ''
68 - else:
69 - value = '*'
70 - else:
71 - # It's not in IUSE, so just allow the variable content
72 - # to pass through if it is defined somewhere. This
73 - # allows packages that support LINGUAS but don't
74 - # declare it in IUSE to use the variable outside of the
75 - # USE_EXPAND context.
76 - value = None
77 -
78 - return value
79 + return ' '.join(var_split)
80
81 def setcpv(self, mycpv, use_cache=None, mydb=None):
82 """
83 @@ -1727,7 +1687,7 @@ class config(object):
84 self, unfiltered_use, use, self.usemask,
85 portage_iuse, use_expand_split, self._use_expand_dict)
86
87 - use_expand_iuses = {}
88 + use_expand_iuses = dict((k, set()) for k in use_expand_split)
89 for x in portage_iuse:
90 x_split = x.split('_')
91 if len(x_split) == 1:
92 @@ -1735,18 +1695,9 @@ class config(object):
93 for i in range(len(x_split) - 1):
94 k = '_'.join(x_split[:i+1])
95 if k in use_expand_split:
96 - v = use_expand_iuses.get(k)
97 - if v is None:
98 - v = set()
99 - use_expand_iuses[k] = v
100 - v.add(x)
101 + v = use_expand_iuses[k].add(x)
102 break
103
104 - # If it's not in IUSE, variable content is allowed
105 - # to pass through if it is defined somewhere. This
106 - # allows packages that support LINGUAS but don't
107 - # declare it in IUSE to use the variable outside of the
108 - # USE_EXPAND context.
109 for k, use_expand_iuse in use_expand_iuses.items():
110 if k + '_*' in use:
111 use.update( x for x in use_expand_iuse if x not in usemask )
112 --
113 2.8.2

Replies