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 (-5 / +67 lines)
Lines 895-900 Link Here
895
			sys.exit(1)
895
			sys.exit(1)
896
		self.configlist.append(self.mygcfg)
896
		self.configlist.append(self.mygcfg)
897
		self.configdict["conf"]=self.configlist[-1]
897
		self.configdict["conf"]=self.configlist[-1]
898
		self.configdict["conf"]["PKGUSE"]=grabdict("/etc/portage/package.use")
898
899
899
		for x in incrementals:
900
		for x in incrementals:
900
			if os.environ.has_key(x):
901
			if os.environ.has_key(x):
Lines 923-929 Link Here
923
		self.regenerate()
924
		self.regenerate()
924
	
925
	
925
	def regenerate(self,useonly=0):
926
	def regenerate(self,useonly=0):
926
		global incrementals,usesplit,profiledir
927
		global incrementals,usesplit,pkgusesplit,profiledir
928
929
		# initialize per-package use variables to an empty dictionary
930
		pkgusesplit={}
931
927
		if useonly:
932
		if useonly:
928
			myincrementals=["USE"]
933
			myincrementals=["USE"]
929
		else:
934
		else:
Lines 966-971 Link Here
966
					#now append our new setting
971
					#now append our new setting
967
					if add:
972
					if add:
968
						mysetting.append(add)
973
						mysetting.append(add)
974
					#override per-package use flags
975
					if mykey=="USE" and pkgusesplit!={}:
976
						for y in pkgusesplit:
977
							if add in pkgusesplit[y]:
978
								pkgusesplit[y].remove(add)
979
							if add[0]=="-" and add[1:] in pkgusesplit[y]:
980
								pkgusesplit[y].remove(add[1:])
981
							if add[0]!="-" and "-"+add in pkgusesplit[y]:
982
								pkgusesplit[y].remove("-"+add)
983
984
				# initialize per-package use flags
985
				if mykey=="USE" and curdb.has_key("PKGUSE"):
986
					for x in curdb["PKGUSE"]:
987
						if x[0]=="#":
988
							continue
989
						mypkgusesplit=[]
990
						for y in curdb["PKGUSE"][x]:
991
							if y=="-*" or y=="*":
992
								continue
993
							if y[0]=="-":
994
								z=y[1:]
995
							else:
996
								z="-"+y
997
							if y not in mysetting and y not in mypkgusesplit and z not in mypkgusesplit:
998
								mypkgusesplit.append(y)
999
						if mypkgusesplit:
1000
							pkgusesplit[x]=mypkgusesplit
1001
969
			#store setting in last element of configlist, the original environment:
1002
			#store setting in last element of configlist, the original environment:
970
			self.configlist[-1][mykey]=string.join(mysetting," ")
1003
			self.configlist[-1][mykey]=string.join(mysetting," ")
971
		#cache split-up USE var in a global
1004
		#cache split-up USE var in a global
Lines 991-996 Link Here
991
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
1024
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
992
						self.configlist[-1]["USE"]=string.join(usesplit," ")
1025
						self.configlist[-1]["USE"]=string.join(usesplit," ")
993
	
1026
	
1027
		# Store per-package setting in configlist for display in emerge --info
1028
		self.configlist[-1]["PKGUSE"]=""
1029
		mypkgusesplit=pkgusesplit.copy()
1030
		for x in mypkgusesplit:
1031
			if pkgusesplit[x]==[]:
1032
				del(pkgusesplit[x])
1033
			else:
1034
				self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )"
1035
994
	def __getitem__(self,mykey):
1036
	def __getitem__(self,mykey):
995
		if mykey=="CONFIG_PROTECT_MASK":
1037
		if mykey=="CONFIG_PROTECT_MASK":
996
			suffix=" /etc/env.d"
1038
			suffix=" /etc/env.d"
Lines 1501-1507 Link Here
1501
				actionmap[mydo]["args"][1])
1543
				actionmap[mydo]["args"][1])
1502
1544
1503
def doebuild(myebuild,mydo,myroot,debug=0,listonly=0,fetchonly=0):
1545
def doebuild(myebuild,mydo,myroot,debug=0,listonly=0,fetchonly=0):
1504
	global settings
1546
	global settings,pkgusesplit
1505
1547
1506
	if mydo not in ["help","clean","prerm","postrm","preinst","postinst",
1548
	if mydo not in ["help","clean","prerm","postrm","preinst","postinst",
1507
	                "config","touch","setup","depend","fetch","digest",
1549
	                "config","touch","setup","depend","fetch","digest",
Lines 1545-1550 Link Here
1545
		settings["PVR"]=mysplit[1]
1587
		settings["PVR"]=mysplit[1]
1546
	else:
1588
	else:
1547
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1589
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1590
1591
	if pkgusesplit.has_key(category+"/"+mysplit[0]):
1592
		settings["PUSE"]=string.join(pkgusesplit[category+"/"+mysplit[0]], ' ')
1593
	else:
1594
		settings["PUSE"]=""
1595
1548
	settings["SLOT"]=""
1596
	settings["SLOT"]=""
1549
	if settings.has_key("PATH"):
1597
	if settings.has_key("PATH"):
1550
		mysplit=string.split(settings["PATH"],":")
1598
		mysplit=string.split(settings["PATH"],":")
Lines 2564-2578 Link Here
2564
		mydep=mydep[1:]
2612
		mydep=mydep[1:]
2565
	return prefix+cpv_expand(mydep,mydb)+postfix
2613
	return prefix+cpv_expand(mydep,mydb)+postfix
2566
2614
2567
def dep_check(depstring,mydbapi,use="yes",mode=None):
2615
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2568
	"""Takes a depend string and parses the condition."""
2616
	"""Takes a depend string and parses the condition."""
2569
	global usesplit
2617
	global usesplit,pkgusesplit
2570
	if use=="all":
2618
	if use=="all":
2571
		#enable everything (for repoman)
2619
		#enable everything (for repoman)
2572
		myusesplit=["*"]
2620
		myusesplit=["*"]
2573
	elif use=="yes":
2621
	elif use=="yes":
2574
		#default behavior
2622
		#default behavior
2575
		myusesplit=usesplit
2623
		myusesplit=usesplit[:]
2624
		if parent and (pkgusesplit!={}):
2625
			myparent=parent.split()[2]
2626
			for x in pkgusesplit:
2627
				if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", x, None, None, [myparent]):
2628
					for y in pkgusesplit[x]:
2629
						if y[0]=="-":
2630
							z=y[1:]
2631
						else:
2632
							z="-"+y
2633
						if z in myusesplit:
2634
							myusesplit.remove(z)
2635
						if y not in myusesplit:
2636
							myusesplit.append(y)
2637
2576
	else:
2638
	else:
2577
		#we are being run by autouse(), don't consult USE vars yet.
2639
		#we are being run by autouse(), don't consult USE vars yet.
2578
		myusesplit=[]
2640
		myusesplit=[]

Return to bug 13616