Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 13616 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/lib/python2.2/site-packages/portage.py (-3 / +65 lines)
Lines 787-793 Link Here
787
		self.regenerate()
787
		self.regenerate()
788
	
788
	
789
	def regenerate(self,useonly=0):
789
	def regenerate(self,useonly=0):
790
		global incrementals,usesplit,profiledir
790
		global incrementals,usesplit,pkgusesplit,profiledir
791
		if useonly:
791
		if useonly:
792
			myincrementals=["USE"]
792
			myincrementals=["USE"]
793
		else:
793
		else:
Lines 804-809 Link Here
804
					continue
804
					continue
805
				#variables are already expanded
805
				#variables are already expanded
806
				mysplit=curdb[mykey].split()
806
				mysplit=curdb[mykey].split()
807
				if mykey=="USE":
808
					mysplit=self.parseuse(mysplit)
807
				for x in mysplit:
809
				for x in mysplit:
808
					if x=="-*":
810
					if x=="-*":
809
						# "-*" is a special "minus" var that means "unset all settings".  so USE="-* gnome" will have *just* gnome enabled.
811
						# "-*" is a special "minus" var that means "unset all settings".  so USE="-* gnome" will have *just* gnome enabled.
Lines 837-843 Link Here
837
					if self.configdict["defaults"]["ARCH"] not in usesplit:
839
					if self.configdict["defaults"]["ARCH"] not in usesplit:
838
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
840
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
839
						self.configlist[-1]["USE"]=string.join(usesplit," ")
841
						self.configlist[-1]["USE"]=string.join(usesplit," ")
842
		mypkgusesplit=pkgusesplit
843
		pkgusesplit={}
844
		for x in mypkgusesplit:
845
			mypos=0
846
			while mypos<len(mypkgusesplit[x]):
847
				if mypkgusesplit[x][mypos] in usesplit:
848
					del mypkgusesplit[x][mypos]
849
				else:
850
					mypos=mypos+1
851
			if mypkgusesplit[x]!=[]:
852
				pkgusesplit[x]=mypkgusesplit[x]
840
	
853
	
854
	def parseuse(self,myusesplit,mypos=0):
855
		global pkgusesplit
856
		try:
857
			if pkgusesplit: pass
858
		except:
859
			pkgusesplit={}
860
		while mypos<len(myusesplit):
861
			if myusesplit[mypos]=="(":
862
				firstpos=mypos
863
				mypos=mypos+1
864
				while mypos<len(myusesplit):
865
					if myusesplit[mypos]==")":
866
						if mypos==firstpos+3:
867
							myitems=[myusesplit[mypos-1]]
868
						elif mypos>firstpos+3:
869
							myitems=myusesplit[firstpos+2:mypos]
870
						pkg=myusesplit[firstpos+1]
871
						pkgusesplit[pkg]=[]
872
						for x in myitems:
873
							if x=="-*" or x=="*":
874
								myusesplit[firstpos:mypos+1]=[]
875
								mypos=firstpos-1
876
								break
877
							if x[0]=="-":
878
								y=x[1:]
879
							else:
880
								y="-"+x
881
							if x not in pkgusesplit[pkg] and y not in pkgusesplit[pkg]:
882
								pkgusesplit[pkg].append(x)
883
						myusesplit[firstpos:mypos+1]=[]
884
						mypos=firstpos-1
885
						break
886
					mypos=mypos+1
887
			mypos=mypos+1
888
		return myusesplit
889
841
	def __getitem__(self,mykey):
890
	def __getitem__(self,mykey):
842
		if mykey=="CONFIG_PROTECT_MASK":
891
		if mykey=="CONFIG_PROTECT_MASK":
843
			suffix=" /etc/env.d"
892
			suffix=" /etc/env.d"
Lines 2187-2201 Link Here
2187
		mydep=mydep[1:]
2236
		mydep=mydep[1:]
2188
	return prefix+cpv_expand(mydep,mydb)+postfix
2237
	return prefix+cpv_expand(mydep,mydb)+postfix
2189
2238
2190
def dep_check(depstring,mydbapi,use="yes",mode=None):
2239
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2191
	"""Takes a depend string and parses the condition."""
2240
	"""Takes a depend string and parses the condition."""
2192
	global usesplit
2241
	global usesplit,pkgusesplit
2193
	if use=="all":
2242
	if use=="all":
2194
		#enable everything (for repoman)
2243
		#enable everything (for repoman)
2195
		myusesplit=["*"]
2244
		myusesplit=["*"]
2196
	elif use=="yes":
2245
	elif use=="yes":
2197
		#default behavior
2246
		#default behavior
2198
		myusesplit=usesplit
2247
		myusesplit=usesplit
2248
		if parent and (pkgusesplit!={}):
2249
			myparent=string.split(parent)[2]
2250
			for x in pkgusesplit:
2251
				if string.count(myparent,x,0):
2252
					for y in pkgusesplit[x]:
2253
						if y[0]=="-":
2254
							z=y[1:]
2255
						else:
2256
							z="-"+y
2257
						if z in myusesplit:
2258
							myusesplit.remove(z)
2259
						if y not in myusesplit:
2260
							myusesplit.append(y)
2199
	else:
2261
	else:
2200
		#we are being run by autouse(), don't consult USE vars yet.
2262
		#we are being run by autouse(), don't consult USE vars yet.
2201
		myusesplit=[]
2263
		myusesplit=[]

Return to bug 13616