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

(-)portage.py.orig (-6 / +73 lines)
Lines 55-62 Link Here
55
	sys.stderr.write(red("*** Please add this user to the portage group if you wish to use portage.\n"))
55
	sys.stderr.write(red("*** Please add this user to the portage group if you wish to use portage.\n"))
56
	sys.stderr.write("\n")
56
	sys.stderr.write("\n")
57
57
58
incrementals=["USE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
58
incrementals=["USE","PKGUSE","FEATURES","ACCEPT_KEYWORDS","ACCEPT_LICENSE","CONFIG_PROTECT_MASK","CONFIG_PROTECT","PRELINK_PATH","PRELINK_PATH_MASK"]
59
stickies=["KEYWORDS_ACCEPT","USE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"]
59
stickies=["KEYWORDS_ACCEPT","USE","PKGUSE","CFLAGS","CXXFLAGS","MAKEOPTS","EXTRA_ECONF","EXTRA_EMAKE"]
60
60
61
def getcwd():
61
def getcwd():
62
	"this fixes situations where the current directory doesn't exist"
62
	"this fixes situations where the current directory doesn't exist"
Lines 887-893 Link Here
887
		self.regenerate()
887
		self.regenerate()
888
	
888
	
889
	def regenerate(self,useonly=0):
889
	def regenerate(self,useonly=0):
890
		global incrementals,usesplit,profiledir
890
		global incrementals,usesplit,pkgusesplit,profiledir
891
		if useonly:
891
		if useonly:
892
			myincrementals=["USE"]
892
			myincrementals=["USE"]
893
		else:
893
		else:
Lines 904-909 Link Here
904
					continue
904
					continue
905
				#variables are already expanded
905
				#variables are already expanded
906
				mysplit=curdb[mykey].split()
906
				mysplit=curdb[mykey].split()
907
				if mykey=="USE":
908
					mysplit=self.parseuse(mysplit)
907
				for x in mysplit:
909
				for x in mysplit:
908
					if x=="-*":
910
					if x=="-*":
909
						# "-*" is a special "minus" var that means "unset all settings".  so USE="-* gnome" will have *just* gnome enabled.
911
						# "-*" is a special "minus" var that means "unset all settings".  so USE="-* gnome" will have *just* gnome enabled.
Lines 920-925 Link Here
920
						if mysetting[y]==remove:
922
						if mysetting[y]==remove:
921
							#we found a previously-defined variable; add it to our dellist for later removal.
923
							#we found a previously-defined variable; add it to our dellist for later removal.
922
							dellist.append(mysetting[y])
924
							dellist.append(mysetting[y])
925
923
					for y in dellist:
926
					for y in dellist:
924
						while y in mysetting:
927
						while y in mysetting:
925
							mysetting.remove(y)
928
							mysetting.remove(y)
Lines 933-939 Link Here
933
		for x in string.split(self.configlist[-1]["USE"]):
936
		for x in string.split(self.configlist[-1]["USE"]):
934
			if x not in self.usemask:
937
			if x not in self.usemask:
935
				usesplit.append(x)
938
				usesplit.append(x)
939
940
		mypkgusesplit=pkgusesplit
941
		pkgusesplit={}
942
		for x in mypkgusesplit:
943
			mypos=0
944
			while mypos<len(mypkgusesplit[x]):
945
				if mypkgusesplit[x][mypos] in usesplit:
946
					del mypkgusesplit[x][mypos]
947
				else:
948
					mypos=mypos+1
949
			if mypkgusesplit[x]!=[]:
950
				pkgusesplit[x]=mypkgusesplit[x]
951
952
		self.configlist[-1]["PKGUSE"]=""
953
		for x in pkgusesplit:
954
			self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )"
936
		
955
		
956
	def parseuse(self,myusesplit,mypos=0):
957
		global pkgusesplit
958
		try:
959
			if pkgusesplit: pass
960
		except:
961
			pkgusesplit={}
962
		while mypos<len(myusesplit):
963
			if myusesplit[mypos]=="(":
964
				firstpos=mypos
965
				mypos=mypos+1
966
				while mypos<len(myusesplit):
967
					if myusesplit[mypos]==")":
968
						if mypos==firstpos+3:
969
							myitems=[myusesplit[mypos-1]]
970
						elif mypos>firstpos+3:
971
							myitems=myusesplit[firstpos+2:mypos]
972
						pkg=myusesplit[firstpos+1]
973
						pkgusesplit[pkg]=[]
974
						for x in myitems:
975
							if x=="-*" or x=="*":
976
								myusesplit[firstpos:mypos+1]=[]
977
								mypos=firstpos-1
978
								break
979
							if x[0]=="-":
980
								y=x[1:]
981
							else:
982
								y="-"+x
983
							if x not in pkgusesplit[pkg] and y not in pkgusesplit[pkg]:
984
								pkgusesplit[pkg].append(x)
985
						myusesplit[firstpos:mypos+1]=[]
986
						mypos=firstpos-1
987
						break
988
					mypos=mypos+1
989
			mypos=mypos+1
990
		return myusesplit
991
937
		# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
992
		# Pre-Pend ARCH variable to USE settings so '-*' in env doesn't kill arch.
938
		if profiledir:
993
		if profiledir:
939
			if self.configdict["defaults"].has_key("ARCH"):
994
			if self.configdict["defaults"].has_key("ARCH"):
Lines 2507-2521 Link Here
2507
		mydep=mydep[1:]
2562
		mydep=mydep[1:]
2508
	return prefix+cpv_expand(mydep,mydb)+postfix
2563
	return prefix+cpv_expand(mydep,mydb)+postfix
2509
2564
2510
def dep_check(depstring,mydbapi,use="yes",mode=None):
2565
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2511
	"""Takes a depend string and parses the condition."""
2566
	"""Takes a depend string and parses the condition."""
2512
	global usesplit
2567
	global usesplit,pkgusesplit
2513
	if use=="all":
2568
	if use=="all":
2514
		#enable everything (for repoman)
2569
		#enable everything (for repoman)
2515
		myusesplit=["*"]
2570
		myusesplit=["*"]
2516
	elif use=="yes":
2571
	elif use=="yes":
2517
		#default behavior
2572
		#default behavior
2518
		myusesplit=usesplit
2573
		myusesplit=usesplit[:]
2574
		if parent and (pkgusesplit!={}):
2575
			myparent=pkgsplit(parent.split()[2])[0]
2576
			if pkgusesplit.has_key(myparent):
2577
				for x in pkgusesplit[myparent]:
2578
					if x[0]=="-":
2579
						y=x[1:]
2580
					else:
2581
						y="-"+x
2582
					if y in myusesplit:
2583
						myusesplit.remove(y)
2584
					if x not in myusesplit:
2585
						myusesplit.append(x)
2519
	else:
2586
	else:
2520
		#we are being run by autouse(), don't consult USE vars yet.
2587
		#we are being run by autouse(), don't consult USE vars yet.
2521
		myusesplit=[]
2588
		myusesplit=[]

Return to bug 13616