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 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"]["PUSEDICT"]=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("PUSEDICT"):
988
					for x in curdb["PUSEDICT"]:
989
						if x[0]=="#":
990
							continue
991
						mypkgusesplit=[]
992
						for y in curdb["PUSEDICT"][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
					del(curdb["PUSEDICT"])
1004
971
			#store setting in last element of configlist, the original environment:
1005
			#store setting in last element of configlist, the original environment:
972
			self.configlist[-1][mykey]=string.join(mysetting," ")
1006
			self.configlist[-1][mykey]=string.join(mysetting," ")
973
		#cache split-up USE var in a global
1007
		#cache split-up USE var in a global
Lines 992-998 Link Here
992
					if self.configdict["defaults"]["ARCH"] not in usesplit:
1026
					if self.configdict["defaults"]["ARCH"] not in usesplit:
993
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
1027
						usesplit.insert(0,self.configdict["defaults"]["ARCH"])
994
						self.configlist[-1]["USE"]=string.join(usesplit," ")
1028
						self.configlist[-1]["USE"]=string.join(usesplit," ")
995
	
1029
1030
		# Store per-package setting in configlist for display in emerge --info
1031
		self.configlist[-1]["PKGUSE"]=""
1032
		mypkgusesplit=pkgusesplit.copy()
1033
		for x in mypkgusesplit:
1034
			if pkgusesplit[x]==[]:
1035
				del(pkgusesplit[x])
1036
			else:
1037
				self.configlist[-1]["PKGUSE"]=self.configlist[-1]["PKGUSE"]+"( "+x+" => "+string.join(pkgusesplit[x]," ")+" )"
1038
996
	def __getitem__(self,mykey):
1039
	def __getitem__(self,mykey):
997
		if mykey=="CONFIG_PROTECT_MASK":
1040
		if mykey=="CONFIG_PROTECT_MASK":
998
			suffix=" /etc/env.d"
1041
			suffix=" /etc/env.d"
Lines 1546-1551 Link Here
1546
		settings["PVR"]=mysplit[1]
1589
		settings["PVR"]=mysplit[1]
1547
	else:
1590
	else:
1548
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1591
		settings["PVR"]=mysplit[1]+"-"+mysplit[2]
1592
1593
	settings["PUSE"]=string.join(dep_getpuse(category+"/"+pf)," ")
1594
1549
	settings["SLOT"]=""
1595
	settings["SLOT"]=""
1550
	if settings.has_key("PATH"):
1596
	if settings.has_key("PATH"):
1551
		mysplit=string.split(settings["PATH"],":")
1597
		mysplit=string.split(settings["PATH"],":")
Lines 2565-2571 Link Here
2565
		mydep=mydep[1:]
2611
		mydep=mydep[1:]
2566
	return prefix+cpv_expand(mydep,mydb)+postfix
2612
	return prefix+cpv_expand(mydep,mydb)+postfix
2567
2613
2568
def dep_check(depstring,mydbapi,use="yes",mode=None):
2614
def dep_getpuse(mypkg):
2615
	global usesplit,pkgusesplit
2616
	if not len(mypkg):
2617
		return []
2618
	mylist=[]
2619
	for mykey in pkgusesplit:
2620
		if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mypkg]):
2621
			for x in pkgusesplit[mykey]:
2622
				if x[0]=="-":
2623
					y=x[1:]
2624
				else:
2625
					y="-"+x
2626
				if y not in mylist and x not in mylist:
2627
					mylist.append(x)
2628
	return mylist
2629
		
2630
def dep_check(depstring,mydbapi,use="yes",mode=None,parent=None):
2569
	"""Takes a depend string and parses the condition."""
2631
	"""Takes a depend string and parses the condition."""
2570
	global usesplit
2632
	global usesplit
2571
	if use=="all":
2633
	if use=="all":
Lines 2573-2579 Link Here
2573
		myusesplit=["*"]
2635
		myusesplit=["*"]
2574
	elif use=="yes":
2636
	elif use=="yes":
2575
		#default behavior
2637
		#default behavior
2576
		myusesplit=usesplit
2638
		myusesplit=usesplit[:]
2639
		if parent:
2640
			for x in dep_getpuse(parent.split()[2]):
2641
				if x[0]=="-":
2642
					myusesplit.remove(x[1:])
2643
				else:
2644
					myusesplit.append(x)
2577
	else:
2645
	else:
2578
		#we are being run by autouse(), don't consult USE vars yet.
2646
		#we are being run by autouse(), don't consult USE vars yet.
2579
		myusesplit=[]
2647
		myusesplit=[]
Lines 3773-3778 Link Here
3773
		if mylist==None:
3841
		if mylist==None:
3774
			return []
3842
			return []
3775
		newlist=[]
3843
		newlist=[]
3844
		pkgdict=grabdict("/etc/portage/package.keywords")
3776
		for mycpv in mylist:
3845
		for mycpv in mylist:
3777
			#we need to update this next line when we have fully integrated the new db api
3846
			#we need to update this next line when we have fully integrated the new db api
3778
			auxerr=0
3847
			auxerr=0
Lines 3785-3799 Link Here
3785
				#print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"
3854
				#print "!!! No KEYWORDS for "+str(mycpv)+" -- Untested Status"
3786
				continue
3855
				continue
3787
			mygroups=myaux[0].split()
3856
			mygroups=myaux[0].split()
3857
			pgroups=groups[:]
3788
			match=0
3858
			match=0
3859
			for mykey in pkgdict:
3860
				if db["/"]["porttree"].dbapi.xmatch("bestmatch-list", mykey, None, None, [mycpv]):
3861
					pgroups.extend(pkgdict[mykey])
3789
			for gp in mygroups:
3862
			for gp in mygroups:
3790
				if gp=="*":
3863
				if gp=="*":
3791
					match=1
3864
					match=1
3792
					break
3865
					break
3793
				elif "-"+gp in groups:
3866
				elif "-"+gp in pgroups:
3794
					match=0
3867
					match=0
3795
					break
3868
					break
3796
				elif gp in groups:
3869
				elif gp in pgroups:
3797
					match=1
3870
					match=1
3798
					break
3871
					break
3799
			if match:
3872
			if match:

Return to bug 13616