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 (-6 / +79 lines)
Lines 899-904 Link Here
899
			sys.exit(1)
899
			sys.exit(1)
900
		self.configlist.append(self.mygcfg)
900
		self.configlist.append(self.mygcfg)
901
		self.configdict["conf"]=self.configlist[-1]
901
		self.configdict["conf"]=self.configlist[-1]
902
		self.configdict["conf"]["PUSEDICT"]=grabdict("/etc/portage/package.use")
902
903
903
		for x in incrementals:
904
		for x in incrementals:
904
			if os.environ.has_key(x):
905
			if os.environ.has_key(x):
Lines 927-933 Link Here
927
		self.regenerate()
928
		self.regenerate()
928
	
929
	
929
	def regenerate(self,useonly=0):
930
	def regenerate(self,useonly=0):
930
		global incrementals,usesplit,profiledir
931
		global incrementals,usesplit,pkgusesplit,profiledir
932
933
		# initialize per-package use variables to an empty dictionary
934
		pkgusesplit={}
935
931
		if useonly:
936
		if useonly:
932
			myincrementals=["USE"]
937
			myincrementals=["USE"]
933
		else:
938
		else:
Lines 970-975 Link Here
970
					#now append our new setting
975
					#now append our new setting
971
					if add:
976
					if add:
972
						mysetting.append(add)
977
						mysetting.append(add)
978
					#override per-package use flags
979
					if mykey=="USE" and pkgusesplit!={}:
980
						for y in pkgusesplit:
981
							if add in pkgusesplit[y]:
982
								pkgusesplit[y].remove(add)
983
							if add[0]=="-" and add[1:] in pkgusesplit[y]:
984
								pkgusesplit[y].remove(add[1:])
985
							if add[0]!="-" and "-"+add in pkgusesplit[y]:
986
								pkgusesplit[y].remove("-"+add)
987
988
				# initialize per-package use flags
989
				if mykey=="USE" and curdb.has_key("PUSEDICT"):
990
					for x in curdb["PUSEDICT"]:
991
						if x[0]=="#":
992
							continue
993
						mypkgusesplit=[]
994
						for y in curdb["PUSEDICT"][x]:
995
							if y=="-*" or y=="*":
996
								continue
997
							if y[0]=="-":
998
								z=y[1:]
999
							else:
1000
								z="-"+y
1001
							if y not in mysetting and y not in mypkgusesplit and z not in mypkgusesplit:
1002
								mypkgusesplit.append(y)
1003
						if mypkgusesplit:
1004
							pkgusesplit[x]=mypkgusesplit
1005
					del(curdb["PUSEDICT"])
1006
973
			#store setting in last element of configlist, the original environment:
1007
			#store setting in last element of configlist, the original environment:
974
			self.configlist[-1][mykey]=string.join(mysetting," ")
1008
			self.configlist[-1][mykey]=string.join(mysetting," ")
975
		#cache split-up USE var in a global
1009
		#cache split-up USE var in a global
Lines 994-1000 Link Here
994
					if self.configdict["defaults"]["ARCH"] not in usesplit:
1028
					if self.configdict["defaults"]["ARCH"] not in usesplit:
995
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
1029
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
996
						self.configlist[-1]["USE"]=string.join(usesplit," ")
1030
						self.configlist[-1]["USE"]=string.join(usesplit," ")
997
	
1031
1032
		# Store per-package setting in configlist for display in emerge --info
1033
		self.configlist[-1]["PKGUSE"]=""
1034
		mypkgusesplit=pkgusesplit.copy()
1035
		for x in mypkgusesplit:
1036
			if pkgusesplit[x]==[]:
1037
				del(pkgusesplit[x])
1038
			else:
1039
				self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )"
1040
998
	def __getitem__(self,mykey):
1041
	def __getitem__(self,mykey):
999
		if mykey=="CONFIG_PROTECT_MASK":
1042
		if mykey=="CONFIG_PROTECT_MASK":
1000
			suffix=" /etc/env.d"
1043
			suffix=" /etc/env.d"
Lines 1563-1568 Link Here
1563
		settings["PVR"]=mysplit[1]
1606
		settings["PVR"]=mysplit[1]
1564
	else:
1607
	else:
1565
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1608
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1609
1610
	settings["PUSE"]=string.join(dep_getpuse(category+"/"+pf)," ")
1611
1566
	settings["SLOT"]=""
1612
	settings["SLOT"]=""
1567
	if settings.has_key("PATH"):
1613
	if settings.has_key("PATH"):
1568
		mysplit=string.split(settings["PATH"],":")
1614
		mysplit=string.split(settings["PATH"],":")
Lines 2594-2600 Link Here
2594
		mydep=mydep[1:]
2640
		mydep=mydep[1:]
2595
	return prefix+cpv_expand(mydep,mydb)+postfix
2641
	return prefix+cpv_expand(mydep,mydb)+postfix
2596
2642
2597
def dep_check(depstring,mydbapi,use="yes",mode=None):
2643
def dep_getpuse(mypkg):
2644
	global usesplit,pkgusesplit
2645
	if not len(mypkg):
2646
		return []
2647
	mylist=[]
2648
	for mykey in pkgusesplit:
2649
		if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mypkg]):
2650
			for x in pkgusesplit[mykey]:
2651
				if x[0]=="-":
2652
					y=x[1:]
2653
				else:
2654
					y="-"+x
2655
				if y not in mylist and x not in mylist:
2656
					mylist.append(x)
2657
	return mylist
2658
		
2659
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2598
	"""Takes a depend string and parses the condition."""
2660
	"""Takes a depend string and parses the condition."""
2599
	global usesplit
2661
	global usesplit
2600
	if use=="all":
2662
	if use=="all":
Lines 2602-2608 Link Here
2602
		myusesplit=["*"]
2664
		myusesplit=["*"]
2603
	elif use=="yes":
2665
	elif use=="yes":
2604
		#default behavior
2666
		#default behavior
2605
		myusesplit=usesplit
2667
		myusesplit=usesplit[:]
2668
		if parent:
2669
			for x in dep_getpuse(parent.split()[2]):
2670
				if x[0]=="-":
2671
					myusesplit.remove(x[1:])
2672
				else:
2673
					myusesplit.append(x)
2606
	else:
2674
	else:
2607
		#we are being run by autouse(), don't consult USE vars yet.
2675
		#we are being run by autouse(), don't consult USE vars yet.
2608
		myusesplit=[]
2676
		myusesplit=[]
Lines 3824-3829 Link Here
3824
		if mylist==None:
3892
		if mylist==None:
3825
			return []
3893
			return []
3826
		newlist=[]
3894
		newlist=[]
3895
		pkgdict=grabdict("/etc/portage/package.keywords")
3827
		for mycpv in mylist:
3896
		for mycpv in mylist:
3828
			#we need to update this next line when we have fully integrated the new db api
3897
			#we need to update this next line when we have fully integrated the new db api
3829
			auxerr=0
3898
			auxerr=0
Lines 3836-3850 Link Here
3836
				#print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"
3905
				#print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"
3837
				continue
3906
				continue
3838
			mygroups=myaux[0].split()
3907
			mygroups=myaux[0].split()
3908
			pgroups=groups[:]
3839
			match=0
3909
			match=0
3910
			for mykey in pkgdict:
3911
				if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mycpv]):
3912
					pgroups.extend(pkgdict[mykey])
3840
			for gp in mygroups:
3913
			for gp in mygroups:
3841
				if gp=="*":
3914
				if gp=="*":
3842
					match=1
3915
					match=1
3843
					break
3916
					break
3844
				elif "-"+gp in groups:
3917
				elif "-"+gp in pgroups:
3845
					match=0
3918
					match=0
3846
					break
3919
					break
3847
				elif gp in groups:
3920
				elif gp in pgroups:
3848
					match=1
3921
					match=1
3849
					break
3922
					break
3850
			if match:
3923
			if match:

Return to bug 13616