Index: portage.py =================================================================== RCS file: /var/cvsroot/gentoo-src/portage/pym/portage.py,v retrieving revision 1.524.2.76 diff -u -r1.524.2.76 portage.py --- portage.py 29 May 2005 12:40:08 -0000 1.524.2.76 +++ portage.py 11 Jun 2005 19:34:33 -0000 @@ -1051,6 +1051,11 @@ self.pusedict = {} self.pkeywordsdict = {} self.punmaskdict = {} + # Remove USE_EXPANDed settings from local settings + for use_expand in self["USE_EXPAND"].split(): + for config in ["conf", "env", "backupenv"]: + if self.configdict[config].has_key(use_expand): + del self.configdict[config][use_expand] else: locations = [self["PORTDIR"] + "/profiles", USER_CONFIG_PATH] for ov in self["PORTDIR_OVERLAY"].split(): @@ -3760,7 +3765,13 @@ while mysettings["ARCH"] in mymasks: del mymasks[mymasks.index(mysettings["ARCH"])] - mysplit = portage_dep.use_reduce(mysplit,uselist=myusesplit,masklist=mymasks,matchall=(use=="all"),excludeall=[mysettings["ARCH"]]) + myexcludes = [mysettings["ARCH"]] + use_expands = mysettings["USE_EXPAND"].split() + for use_expand in use_expands: + if mysettings.has_key(use_expand): + for value in mysettings[use_expand].split(): + myexcludes.append(use_expand.lower() + "_" + value) + mysplit = portage_dep.use_reduce(mysplit,uselist=myusesplit,masklist=mymasks,matchall=(use=="all"),excludeall=myexcludes,use_expands=use_expands) else: mysplit = portage_dep.use_reduce(mysplit,uselist=myusesplit,matchall=(use=="all")) Index: portage_dep.py =================================================================== RCS file: /var/cvsroot/gentoo-src/portage/pym/portage_dep.py,v retrieving revision 1.15.2.3 diff -u -r1.15.2.3 portage_dep.py --- portage_dep.py 2 Apr 2005 14:07:59 -0000 1.15.2.3 +++ portage_dep.py 11 Jun 2005 19:34:33 -0000 @@ -56,7 +56,7 @@ mylist = mylist + [subsec] return mylist -def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[]): +def use_reduce(deparray, uselist=[], masklist=[], matchall=0, excludeall=[], use_expands=[]): """Takes a paren_reduce'd array and reduces the use? conditionals out leaving an array with subarrays """ @@ -83,7 +83,7 @@ head = mydeparray.pop(0) if type(head) == types.ListType: - rlist = rlist + [use_reduce(head, uselist, masklist, matchall, excludeall)] + rlist = rlist + [use_reduce(head, uselist, masklist, matchall, excludeall, use_expands)] else: if head[-1] == "?": # Use reduce next group on fail. @@ -110,6 +110,12 @@ ismatch = True for head in newdeparray[:-1]: head = head[:-1] + for use_expand in use_expands: + if head.startswith(use_expand.lower() + "_") and head not in excludeall: + # We have a USE_EXPANDed flag that is not excluded + ismatch = False + break + if head[0] == "!": head = head[1:] if not matchall and head in uselist or head in excludeall: @@ -126,7 +132,7 @@ if ismatch: target = newdeparray[-1] if isinstance(target, list): - rlist += [use_reduce(target, uselist, masklist, matchall, excludeall)] + rlist += [use_reduce(target, uselist, masklist, matchall, excludeall, use_expands)] else: rlist += [target]