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 (-11 / +71 lines)
Lines 609-614 Link Here
609
					# since our blocks doesn't match any installed packages,
609
					# since our blocks doesn't match any installed packages,
610
					# it doesn't apply to us and we can ignore it.
610
					# it doesn't apply to us and we can ignore it.
611
				return 1
611
				return 1
612
			if mytype=="multi":
613
				self.digraph.addnode(string.join(mybigkey),myparent)
614
				return 1
612
			if not myparent:
615
			if not myparent:
613
				# command-line specified or part of a world list...
616
				# command-line specified or part of a world list...
614
				if ("self" not in myparams) or (("selective" in myparams) and vardbapi.cpv_exists(mykey)):
617
				if ("self" not in myparams) or (("selective" in myparams) and vardbapi.cpv_exists(mykey)):
Lines 753-758 Link Here
753
		vardbapi=portage.db[myroot]["vartree"].dbapi
756
		vardbapi=portage.db[myroot]["vartree"].dbapi
754
757
755
		myslot=portage.portdb.aux_get(pkgver,["SLOT"])[0]
758
		myslot=portage.portdb.aux_get(pkgver,["SLOT"])[0]
759
		pkg=portage.dep_getkey(pkg)
756
		alleb=portage.portdb.xmatch("match-all",pkg)
760
		alleb=portage.portdb.xmatch("match-all",pkg)
757
		while alleb:
761
		while alleb:
758
			cand=portage.portdb.xmatch("bestmatch-list",pkg,mylist=alleb)
762
			cand=portage.portdb.xmatch("bestmatch-list",pkg,mylist=alleb)
Lines 772-777 Link Here
772
			print
776
			print
773
			print "Parent:   ",myparent
777
			print "Parent:   ",myparent
774
			print "Depstring:",depstring
778
			print "Depstring:",depstring
779
		multiflg=False
775
		if not arg:
780
		if not arg:
776
			#processing dependencies
781
			#processing dependencies
777
			mycheck=portage.dep_check(depstring,self.mydbapi[myroot])
782
			mycheck=portage.dep_check(depstring,self.mydbapi[myroot])
Lines 780-792 Link Here
780
			mymerge=mycheck[1]
785
			mymerge=mycheck[1]
781
		else:
786
		else:
782
			#we're processing a command-line argument; unconditionally merge it even if it's already merged
787
			#we're processing a command-line argument; unconditionally merge it even if it's already merged
783
			mymerge=[depstring]
788
			mymerge=portage.portdb.xmatch("slotmatch-visible",depstring)
789
			if "--update" in myopts:
790
				newmerge=[]
791
				for x in mymerge:
792
					myslot=portage.db["/"]["porttree"].dbapi.aux_get(x[1:],["SLOT"])[0]
793
					if portage.db["/"]["vartree"].hasslot(x[1:], myslot):
794
						newmerge.append(x)
795
				mymerge=newmerge
796
797
			if "--update" not in myopts:
798
				if len(mymerge)>1 and not myparent:
799
					multiflg=True
800
784
		if "--debug" in myopts:
801
		if "--debug" in myopts:
785
			print "Candidates:",mymerge
802
			print "Candidates:",mymerge
803
804
		if not mymerge and not myparent:
805
			print "\nemerge: there are no masked or unmasked ebuilds to satisfy "+arg+"."
806
			return 0
807
786
		for x in mymerge:
808
		for x in mymerge:
787
			if x[0]=="!":
809
			if x[0]=="!":
788
				#add our blocker; it will be ignored later if necessary (if we are remerging the same pkg, for example)
810
				#add our blocker; it will be ignored later if necessary (if we are remerging the same pkg, for example)
789
				myk=["blocks",myroot,x[1:]]
811
				myk=["blocks",myroot,x[1:]]
812
			elif multiflg:
813
				myk=["multi",myroot,x[1:]]
790
			else:
814
			else:
791
				#We are not processing a blocker but a normal dependency
815
				#We are not processing a blocker but a normal dependency
792
				myeb_pkg=None
816
				myeb_pkg=None
Lines 929-934 Link Here
929
			for x in sysdict.keys():
953
			for x in sysdict.keys():
930
				mylist.append(sysdict[x])
954
				mylist.append(sysdict[x])
931
955
956
		newlist=[]
957
		for x in mylist:
958
			for y in portage.portdb.xmatch("slotmatch-visible",x):
959
				myslot=portage.db["/"]["porttree"].dbapi.aux_get(y[1:],["SLOT"])[0]
960
				if portage.db["/"]["vartree"].hasslot(y[1:], myslot):
961
					newlist.append(y)
962
		mylist=newlist
932
		for mydep in mylist:	
963
		for mydep in mylist:	
933
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
964
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
934
			if not myeb:
965
			if not myeb:
Lines 995-1000 Link Here
995
	
1026
	
996
	def display(self,mylist):
1027
	def display(self,mylist):
997
		changelogs=[]
1028
		changelogs=[]
1029
		error=None
998
		for x in mylist:
1030
		for x in mylist:
999
			#print x
1031
			#print x
1000
			fetch=" "
1032
			fetch=" "
Lines 1013-1018 Link Here
1013
						print red("(from pkg "+x[3]+")")
1045
						print red("(from pkg "+x[3]+")")
1014
					else:
1046
					else:
1015
						print
1047
						print
1048
			elif x[0]=="multi":
1049
				error="multi"
1050
				addl=""+red("B")+"  "+fetch+"  "
1051
				resolved=portage.db[x[1]]["vartree"].resolve_key(x[2])
1052
				myslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1053
				print "["+x[0]+" "+addl+"]",red(resolved),"["+myslot+"]"
1016
			else:
1054
			else:
1017
				if x[3]=="nomerge":
1055
				if x[3]=="nomerge":
1018
					continue
1056
					continue
Lines 1026-1038 Link Here
1026
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1064
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1027
					addl="  "+yellow("R")+fetch+"  "
1065
					addl="  "+yellow("R")+fetch+"  "
1028
				elif (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific_cat(x[2]):
1066
				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]
1067
					mynewslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1068
					mypkg=portage.catpkgsplit(x[2])
1069
					myoldbest=portage.slotmatch(portage.db[x[1]]["vartree"].dbapi.match(portage.pkgsplit(x[2])[0]),mynewslot)
1070
					if myoldbest:
1071
						try:
1072
							myoldslot=portage.db[portage.root]["vartree"].getslot(myoldbest)
1073
						except:
1074
							myoldslot=None
1075
					else:
1076
							myoldslot=None
1036
1077
1037
					addl="   "+fetch
1078
					addl="   "+fetch
1038
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
1079
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
Lines 1058-1064 Link Here
1058
					myoldbest=blue("["+myoldbest+"]")
1099
					myoldbest=blue("["+myoldbest+"]")
1059
1100
1060
				iuse=""
1101
				iuse=""
1102
				slot=''
1061
				if "--verbose" in myopts:
1103
				if "--verbose" in myopts:
1104
					slot="["+portage.portdb.aux_get(x[2],["SLOT"])[0]+"]"
1062
					for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "):
1105
					for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "):
1063
						try:
1106
						try:
1064
							if (portage.usesplit.index(ebuild_iuse) >= 0) :
1107
							if (portage.usesplit.index(ebuild_iuse) >= 0) :
Lines 1089-1097 Link Here
1089
						if (oldlp-len(myprint)) > 0:
1132
						if (oldlp-len(myprint)) > 0:
1090
							myprint=myprint+" "*(oldlp-len(myprint))
1133
							myprint=myprint+" "*(oldlp-len(myprint))
1091
						myprint=myprint+myoldbest
1134
						myprint=myprint+myoldbest
1092
						myprint=myprint+darkgreen("  to "+x[1])+" "+iuse
1135
						myprint=myprint+darkgreen("  to "+x[1])+" "+slot+" "+iuse
1093
					else:
1136
					else:
1094
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+iuse
1137
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+slot+" "+iuse
1095
				else:
1138
				else:
1096
					if "--columns" in myopts:
1139
					if "--columns" in myopts:
1097
						myprint="["+x[0]+" "+addl+"] "+darkgreen(xs[0])
1140
						myprint="["+x[0]+" "+addl+"] "+darkgreen(xs[0])
Lines 1100-1108 Link Here
1100
						myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
1143
						myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
1101
						if (oldlp-len(myprint)) > 0:
1144
						if (oldlp-len(myprint)) > 0:
1102
							myprint=myprint+(" "*(oldlp-len(myprint)))
1145
							myprint=myprint+(" "*(oldlp-len(myprint)))
1103
						myprint=myprint+myoldbest+"  "+iuse
1146
						myprint=myprint+myoldbest+" "+slot+" "+iuse
1104
					else:
1147
					else:
1105
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+iuse
1148
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+slot+" "+iuse
1106
				print myprint
1149
				print myprint
1107
1150
1108
			mysplit=portage.pkgsplit(x[2])
1151
			mysplit=portage.pkgsplit(x[2])
Lines 1126-1131 Link Here
1126
							print
1169
							print
1127
			del mysplit
1170
			del mysplit
1128
1171
1172
		if error:
1173
			if error=="multi":
1174
				print 
1175
				print "You need to select one version"
1176
				print "Example, \"emerge ="+x[2]+"\""
1177
				print "You can install both of them, if you emerge twice."
1178
1179
		
1129
 		if "--changelog" in myopts:
1180
 		if "--changelog" in myopts:
1130
 			print
1181
 			print
1131
 			for revision,text in changelogs:
1182
 			for revision,text in changelogs:
Lines 1196-1201 Link Here
1196
					if ("--pretend" not in myopts):
1247
					if ("--pretend" not in myopts):
1197
						sys.exit(1)
1248
						sys.exit(1)
1198
1249
1250
				if x[0]=="multi":
1251
					print "\n!!! Error: the "+x[2]+" package conflicts with another package."
1252
					print   "!!!        It is necessary to specify a version."
1253
					print   "!!!        Example, \"emerge ="+x[2]+"\""
1254
					print   "!!!        Please use 'emerge --pretend' to determine packages."
1255
					print
1256
					if ("--pretend" not in myopts):
1257
						sys.exit(1)
1258
1199
		if ("--resume" in myopts):
1259
		if ("--resume" in myopts):
1200
			# We're resuming.
1260
			# We're resuming.
1201
			print green("*** Resuming merge...")
1261
			print green("*** Resuming merge...")
(-)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