Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 4698 | Differences between
and this patch

Collapse All | Expand All

(-)emerge.org (-7 / +26 lines)
Lines 753-758 Link Here
753
		vardbapi=portage.db[myroot]["vartree"].dbapi
753
		vardbapi=portage.db[myroot]["vartree"].dbapi
754
754
755
		myslot=portage.portdb.aux_get(pkgver,["SLOT"])[0]
755
		myslot=portage.portdb.aux_get(pkgver,["SLOT"])[0]
756
		pkg=portage.dep_getkey(pkg)
756
		alleb=portage.portdb.xmatch("match-all",pkg)
757
		alleb=portage.portdb.xmatch("match-all",pkg)
757
		while alleb:
758
		while alleb:
758
			cand=portage.portdb.xmatch("bestmatch-list",pkg,mylist=alleb)
759
			cand=portage.portdb.xmatch("bestmatch-list",pkg,mylist=alleb)
Lines 780-786 Link Here
780
			mymerge=mycheck[1]
781
			mymerge=mycheck[1]
781
		else:
782
		else:
782
			#we're processing a command-line argument; unconditionally merge it even if it's already merged
783
			#we're processing a command-line argument; unconditionally merge it even if it's already merged
783
			mymerge=[depstring]
784
			mymerge=portage.portdb.xmatch("slotmatch-visible",depstring)
785
			if "--update" in myopts:
786
				newmerge=[]
787
				for x in mymerge:
788
					myslot=portage.db["/"]["porttree"].dbapi.aux_get(x[1:],["SLOT"])[0]
789
					if portage.db["/"]["vartree"].hasslot(x[1:], myslot):
790
						newmerge.append(x)
791
				mymerge=newmerge
784
		if "--debug" in myopts:
792
		if "--debug" in myopts:
785
			print "Candidates:",mymerge
793
			print "Candidates:",mymerge
786
		for x in mymerge:
794
		for x in mymerge:
Lines 929-934 Link Here
929
			for x in sysdict.keys():
937
			for x in sysdict.keys():
930
				mylist.append(sysdict[x])
938
				mylist.append(sysdict[x])
931
939
940
		newlist=[]
941
		for x in mylist:
942
			for y in portage.portdb.xmatch("slotmatch-visible",x):
943
				myslot=portage.db["/"]["porttree"].dbapi.aux_get(y[1:],["SLOT"])[0]
944
				if portage.db["/"]["vartree"].hasslot(y[1:], myslot):
945
					newlist.append(y)
946
		mylist=newlist
947
932
		for mydep in mylist:	
948
		for mydep in mylist:	
933
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
949
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
934
			if not myeb:
950
			if not myeb:
Lines 1026-1038 Link Here
1026
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1042
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1027
					addl="  "+yellow("R")+fetch+"  "
1043
					addl="  "+yellow("R")+fetch+"  "
1028
				elif (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific_cat(x[2]):
1044
				elif (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific_cat(x[2]):
1029
					myoldbest=portage.best(portage.db[x[1]]["vartree"].dbapi.match(portage.pkgsplit(x[2])[0]))
1030
1031
					try:
1032
						myoldslot=portage.db[portage.root]["vartree"].getslot(myoldbest)
1033
					except:
1034
						myoldslot=None
1035
					mynewslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1045
					mynewslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1046
					mypkg=portage.catpkgsplit(x[2])
1047
					myoldbest=portage.slotmatch(portage.db[x[1]]["vartree"].dbapi.match(portage.pkgsplit(x[2])[0]),mynewslot)
1048
					if myoldbest:
1049
						try:
1050
							myoldslot=portage.db[portage.root]["vartree"].getslot(myoldbest)
1051
						except:
1052
							myoldslot=None
1053
					else:
1054
							myoldslot=None
1036
1055
1037
					addl="   "+fetch
1056
					addl="   "+fetch
1038
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
1057
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
(-)portage.py.org (-1 / +53 lines)
Lines 2679-2684 Link Here
2679
			p2=catpkgsplit(bestmatch)[1:]
2679
			p2=catpkgsplit(bestmatch)[1:]
2680
	return bestmatch		
2680
	return bestmatch		
2681
2681
2682
def slotmatch(mymatches,slot=None):
2683
	"accepts None arguments; assumes matches are valid."
2684
2685
	if mymatches==None:
2686
		return "" 
2687
	if not len(mymatches):
2688
		return ""
2689
2690
	tmpmatch={}
2691
	for x in mymatches:
2692
		if slot:
2693
			myslot=db["/"]["vartree"].getslot(x)
2694
		else:
2695
			myslot=db["/"]["porttree"].dbapi.aux_get(x,["SLOT"])[0]
2696
		if not tmpmatch.has_key(myslot):
2697
			tmpmatch[myslot]=x
2698
		else:
2699
			p1=catpkgsplit(x)[1:]
2700
			p2=catpkgsplit(tmpmatch[myslot])[1:]
2701
			if pkgcmp(p1,p2)>0:
2702
				tmpmatch[myslot]=x
2703
2704
	if slot:
2705
		if tmpmatch.has_key(slot):
2706
			return tmpmatch[slot]
2707
		else:
2708
			return ""
2709
2710
	slotmatch=[]
2711
	for x in tmpmatch:
2712
		slotmatch.append("="+tmpmatch[x])
2713
2714
	slotmatch.sort()
2715
	return slotmatch		
2716
2682
class portagetree:
2717
class portagetree:
2683
	def __init__(self,root="/",virtual=None,clone=None):
2718
	def __init__(self,root="/",virtual=None,clone=None):
2684
		global portdb
2719
		global portdb
Lines 3248-3253 Link Here
3248
		except:
3283
		except:
3249
			pass
3284
			pass
3250
		return ""
3285
		return ""
3286
3287
	def hasslot(self,mycatpkg,myslot):
3288
		"Has a slot for a catpkg; assume it exists."
3289
		mysplit=catpkgsplit(mycatpkg)
3290
		mydirlist=listdir(self.root+"var/db/pkg/"+mysplit[0])
3291
		for x in mydirlist:
3292
			if x[:len(mysplit[1])+1]==mysplit[1]+"-":
3293
				slotfile=open(self.root+"var/db/pkg/"+mysplit[0]+"/"+x+"/SLOT","r")
3294
				slotvar=string.split(slotfile.readline())[0]
3295
				slotfile.close()
3296
				if (slotvar==myslot):
3297
					return 1
3298
3299
		return 0
3251
	
3300
	
3252
	def hasnode(self,mykey):
3301
	def hasnode(self,mykey):
3253
		"""Does the particular node (cat/pkg key) exist?"""
3302
		"""Does the particular node (cat/pkg key) exist?"""
Lines 3713-3722 Link Here
3713
		elif level=="match-all":
3762
		elif level=="match-all":
3714
			#match *all* visible *and* masked packages
3763
			#match *all* visible *and* masked packages
3715
			myval=self.match2(mydep,mykey,self.cp_list(mykey))
3764
			myval=self.match2(mydep,mykey,self.cp_list(mykey))
3765
		elif level=="slotmatch-visible":
3766
			#match *all* visible each SLOT
3767
			myval=slotmatch(self.xmatch("match-visible",None,mydep,mykey))
3716
		else:
3768
		else:
3717
			print "ERROR: xmatch doesn't handle",level,"query!"
3769
			print "ERROR: xmatch doesn't handle",level,"query!"
3718
			raise KeyError
3770
			raise KeyError
3719
		if self.frozen and (level not in ["match-list","bestmatch-list"]):
3771
		if self.frozen and (level not in ["match-list","bestmatch-list","slotmatch-visible"]):
3720
			self.xcache[level][mydep]=myval
3772
			self.xcache[level][mydep]=myval
3721
		return myval
3773
		return myval
3722
3774

Return to bug 4698