Discard parent profile USE from the expand_map variable before
it is used to evaluate a child profile. This prevents accidents
triggered by USE="${USE} ..." settngs at the top of make.defaults
which caused parent profile USE to override parent profile
package.use settings.

Bug: https://bugs.gentoo.org/771549
Signed-off-by: Zac Medico <zmed...@gentoo.org>
---
 lib/portage/package/ebuild/config.py | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/portage/package/ebuild/config.py 
b/lib/portage/package/ebuild/config.py
index e5ec681af..638c72959 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -612,9 +612,16 @@ class config:
 
                        mygcfg = {}
                        if profiles_complex:
-                               mygcfg_dlists = 
[getconfig(os.path.join(x.location, "make.defaults"),
-                                       tolerant=tolerant, expand=expand_map, 
recursive=x.portage1_directories)
-                                       for x in profiles_complex]
+                               mygcfg_dlists = []
+                               for x in profiles_complex:
+                                       # Prevent accidents triggered by 
USE="${USE} ..." settings
+                                       # at the top of make.defaults which 
caused parent profile
+                                       # USE to override parent profile 
package.use settings.
+                                       expand_map.pop("USE", None)
+                                       mygcfg_dlists.append(
+                                               
getconfig(os.path.join(x.location, "make.defaults"),
+                                               tolerant=tolerant, 
expand=expand_map,
+                                               
recursive=x.portage1_directories))
                                self._make_defaults = mygcfg_dlists
                                mygcfg = stack_dicts(mygcfg_dlists,
                                        incrementals=self.incrementals)
-- 
2.26.2


Reply via email to