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 (-3 / +70 lines)
Lines 897-902 Link Here
897
			sys.exit(1)
897
			sys.exit(1)
898
		self.configlist.append(self.mygcfg)
898
		self.configlist.append(self.mygcfg)
899
		self.configdict["conf"]=self.configlist[-1]
899
		self.configdict["conf"]=self.configlist[-1]
900
		self.configdict["conf"]["PKGUSE"]=grabdict("/etc/portage/package.use")
900
901
901
		for x in incrementals:
902
		for x in incrementals:
902
			if os.environ.has_key(x):
903
			if os.environ.has_key(x):
Lines 925-931 Link Here
925
		self.regenerate()
926
		self.regenerate()
926
	
927
	
927
	def regenerate(self,useonly=0):
928
	def regenerate(self,useonly=0):
928
		global incrementals,usesplit,profiledir
929
		global incrementals,usesplit,pkgusesplit,profiledir
930
931
		# initialize per-package use variables to an empty dictionary
932
		pkgusesplit={}
933
929
		if useonly:
934
		if useonly:
930
			myincrementals=["USE"]
935
			myincrementals=["USE"]
931
		else:
936
		else:
Lines 968-973 Link Here
968
					#now append our new setting
973
					#now append our new setting
969
					if add:
974
					if add:
970
						mysetting.append(add)
975
						mysetting.append(add)
976
					#override per-package use flags
977
					if mykey=="USE" and pkgusesplit!={}:
978
						for y in pkgusesplit:
979
							if add in pkgusesplit[y]:
980
								pkgusesplit[y].remove(add)
981
							if add[0]=="-" and add[1:] in pkgusesplit[y]:
982
								pkgusesplit[y].remove(add[1:])
983
							if add[0]!="-" and "-"+add in pkgusesplit[y]:
984
								pkgusesplit[y].remove("-"+add)
985
986
				# initialize per-package use flags
987
				if mykey=="USE" and curdb.has_key("PKGUSE"):
988
					for x in curdb["PKGUSE"]:
989
						if x[0]=="#":
990
							continue
991
						mypkgusesplit=[]
992
						for y in curdb["PKGUSE"][x]:
993
							if y=="-*" or y=="*":
994
								continue
995
							if y[0]=="-":
996
								z=y[1:]
997
							else:
998
								z="-"+y
999
							if y not in mysetting and y not in mypkgusesplit and z not in mypkgusesplit:
1000
								mypkgusesplit.append(y)
1001
						if mypkgusesplit:
1002
							pkgusesplit[x]=mypkgusesplit
1003
971
			#store setting in last element of configlist, the original environment:
1004
			#store setting in last element of configlist, the original environment:
972
			self.configlist[-1][mykey]=string.join(mysetting," ")
1005
			self.configlist[-1][mykey]=string.join(mysetting," ")
973
		#cache split-up USE var in a global
1006
		#cache split-up USE var in a global
Lines 993-998 Link Here
993
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
1026
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
994
						self.configlist[-1]["USE"]=string.join(usesplit," ")
1027
						self.configlist[-1]["USE"]=string.join(usesplit," ")
995
	
1028
	
1029
		# Store per-package setting in configlist for display in emerge --info
1030
		self.configlist[-1]["PKGUSE"]=""
1031
		mypkgusesplit=pkgusesplit.copy()
1032
		for x in mypkgusesplit:
1033
			if pkgusesplit[x]==[]:
1034
				del(pkgusesplit[x])
1035
			else:
1036
				self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )"
1037
996
	def __getitem__(self,mykey):
1038
	def __getitem__(self,mykey):
997
		if mykey=="CONFIG_PROTECT_MASK":
1039
		if mykey=="CONFIG_PROTECT_MASK":
998
			suffix=" /etc/env.d"
1040
			suffix=" /etc/env.d"
Lines 1546-1551 Link Here
1546
		settings["PVR"]=mysplit[1]
1588
		settings["PVR"]=mysplit[1]
1547
	else:
1589
	else:
1548
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1590
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1591
1592
	settings["PUSE"]=string.join(dep_getpuse(category+"/"+pf)," ")
1593
1549
	settings["SLOT"]=""
1594
	settings["SLOT"]=""
1550
	if settings.has_key("PATH"):
1595
	if settings.has_key("PATH"):
1551
		mysplit=string.split(settings["PATH"],":")
1596
		mysplit=string.split(settings["PATH"],":")
Lines 2565-2571 Link Here
2565
		mydep=mydep[1:]
2610
		mydep=mydep[1:]
2566
	return prefix+cpv_expand(mydep,mydb)+postfix
2611
	return prefix+cpv_expand(mydep,mydb)+postfix
2567
2612
2568
def dep_check(depstring,mydbapi,use="yes",mode=None):
2613
def dep_getpuse(mypkg):
2614
	global usesplit,pkgusesplit
2615
	if not len(mypkg):
2616
		return []
2617
	mylist=[]
2618
	for x in pkgusesplit:
2619
		if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", x, None, None, [mypkg]):
2620
			for y in pkgusesplit[x]:
2621
				if y[0]=="-":
2622
					z=y[1:]
2623
				else:
2624
					z="-"+y
2625
				if z not in mylist and y not in mylist and z in usesplit:
2626
					mylist.append(y)
2627
	return mylist
2628
		
2629
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2569
	"""Takes a depend string and parses the condition."""
2630
	"""Takes a depend string and parses the condition."""
2570
	global usesplit
2631
	global usesplit
2571
	if use=="all":
2632
	if use=="all":
Lines 2573-2579 Link Here
2573
		myusesplit=["*"]
2634
		myusesplit=["*"]
2574
	elif use=="yes":
2635
	elif use=="yes":
2575
		#default behavior
2636
		#default behavior
2576
		myusesplit=usesplit
2637
		myusesplit=usesplit[:]
2638
		if parent:
2639
			for x in dep_getpuse(parent.split()[2]):
2640
				if x[0]=="-":
2641
					myusesplit.remove(x[1:])
2642
				else:
2643
					myusesplit.append(x)
2577
	else:
2644
	else:
2578
		#we are being run by autouse(), don't consult USE vars yet.
2645
		#we are being run by autouse(), don't consult USE vars yet.
2579
		myusesplit=[]
2646
		myusesplit=[]

Return to bug 13616