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 (-13 / +76 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 689-695 Link Here
689
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
692
		if edepend.has_key("PDEPEND") and edepend["PDEPEND"]:
690
			# Post Depend -- Add to the list without a parent, as it depends
693
			# Post Depend -- Add to the list without a parent, as it depends
691
			# on a package being present AND must be built after that package.
694
			# on a package being present AND must be built after that package.
692
			if not self.select_dep(myroot,edepend["PDEPEND"]):
695
			if not self.select_dep(myroot,edepend["PDEPEND"],pdepend=True):
693
				return 0
696
				return 0
694
			
697
			
695
		return 1
698
		return 1
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 766-777 Link Here
766
				break
770
				break
767
			alleb.remove(cand)
771
			alleb.remove(cand)
768
772
769
	def select_dep(self,myroot,depstring,myparent=None,arg=None):
773
	def select_dep(self,myroot,depstring,myparent=None,arg=None,pdepend=None):
770
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
774
		"given a dependency string, create the appropriate depgraph and return 1 on success and 0 on failure"
771
		if "--debug" in myopts:
775
		if "--debug" in myopts:
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
			if depstring[0] in ['>','<','=']:
789
				mymerge=[depstring]
790
			else:
791
				mymerge=portage.portdb.xmatch("slotmatch-visible",depstring)
792
			if "--update" in myopts:
793
				newmerge=[]
794
				for x in mymerge:
795
					myslot=portage.db["/"]["porttree"].dbapi.aux_get(x[1:],["SLOT"])[0]
796
					if portage.db["/"]["vartree"].hasslot(x[1:], myslot):
797
						newmerge.append(x)
798
				mymerge=newmerge
799
800
			if "--update" not in myopts:
801
				if len(mymerge)>1 and not myparent:
802
					multiflg=True
803
784
		if "--debug" in myopts:
804
		if "--debug" in myopts:
785
			print "Candidates:",mymerge
805
			print "Candidates:",mymerge
806
807
		if not mymerge and not myparent and not pdepend:
808
			print "\nemerge: there are no masked or unmasked ebuilds to satisfy "+arg+"."
809
			return 0
810
786
		for x in mymerge:
811
		for x in mymerge:
787
			if x[0]=="!":
812
			if x[0]=="!":
788
				#add our blocker; it will be ignored later if necessary (if we are remerging the same pkg, for example)
813
				#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:]]
814
				myk=["blocks",myroot,x[1:]]
815
			elif multiflg:
816
				myk=["multi",myroot,x[1:]]
790
			else:
817
			else:
791
				#We are not processing a blocker but a normal dependency
818
				#We are not processing a blocker but a normal dependency
792
				myeb_pkg=None
819
				myeb_pkg=None
Lines 929-934 Link Here
929
			for x in sysdict.keys():
956
			for x in sysdict.keys():
930
				mylist.append(sysdict[x])
957
				mylist.append(sysdict[x])
931
958
959
		newlist=[]
960
		for x in mylist:
961
			for y in portage.portdb.xmatch("slotmatch-visible",x):
962
				myslot=portage.db["/"]["porttree"].dbapi.aux_get(y[1:],["SLOT"])[0]
963
				if portage.db["/"]["vartree"].hasslot(y[1:], myslot):
964
					newlist.append(y)
965
		mylist=newlist
932
		for mydep in mylist:	
966
		for mydep in mylist:	
933
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
967
			myeb=portage.portdb.xmatch("bestmatch-visible",mydep)
934
			if not myeb:
968
			if not myeb:
Lines 995-1000 Link Here
995
	
1029
	
996
	def display(self,mylist):
1030
	def display(self,mylist):
997
		changelogs=[]
1031
		changelogs=[]
1032
		error=None
998
		for x in mylist:
1033
		for x in mylist:
999
			#print x
1034
			#print x
1000
			fetch=" "
1035
			fetch=" "
Lines 1013-1018 Link Here
1013
						print red("(from pkg "+x[3]+")")
1048
						print red("(from pkg "+x[3]+")")
1014
					else:
1049
					else:
1015
						print
1050
						print
1051
			elif x[0]=="multi":
1052
				error="multi"
1053
				addl=""+red("B")+"  "+fetch+"  "
1054
				resolved=portage.db[x[1]]["vartree"].resolve_key(x[2])
1055
				myslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1056
				print "["+x[0]+" "+addl+"]",red(resolved),"["+myslot+"]"
1016
			else:
1057
			else:
1017
				if x[3]=="nomerge":
1058
				if x[3]=="nomerge":
1018
					continue
1059
					continue
Lines 1026-1038 Link Here
1026
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1067
				if (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific(x[2]):
1027
					addl="  "+yellow("R")+fetch+"  "
1068
					addl="  "+yellow("R")+fetch+"  "
1028
				elif (not "--emptytree" in myopts) and portage.db[x[1]]["vartree"].exists_specific_cat(x[2]):
1069
				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]
1070
					mynewslot=portage.portdb.aux_get(x[2],["SLOT"])[0]
1071
					mypkg=portage.catpkgsplit(x[2])
1072
					myoldbest=portage.slotmatch(portage.db[x[1]]["vartree"].dbapi.match(portage.pkgsplit(x[2])[0]),mynewslot)
1073
					if myoldbest:
1074
						try:
1075
							myoldslot=portage.db[portage.root]["vartree"].getslot(myoldbest)
1076
						except:
1077
							myoldslot=None
1078
					else:
1079
							myoldslot=None
1036
1080
1037
					addl="   "+fetch
1081
					addl="   "+fetch
1038
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
1082
					if (myoldslot==mynewslot) and portage.pkgcmp(portage.pkgsplit(x[2]), portage.pkgsplit(myoldbest)) < 0:
Lines 1058-1064 Link Here
1058
					myoldbest=blue("["+myoldbest+"]")
1102
					myoldbest=blue("["+myoldbest+"]")
1059
1103
1060
				iuse=""
1104
				iuse=""
1105
				slot=''
1061
				if "--verbose" in myopts:
1106
				if "--verbose" in myopts:
1107
					slot="S["+portage.portdb.aux_get(x[2],["SLOT"])[0]+"]"
1062
					for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "):
1108
					for ebuild_iuse in string.split(portage.portdb.aux_get(x[2],["IUSE"])[0], " "):
1063
						try:
1109
						try:
1064
							if (portage.usesplit.index(ebuild_iuse) >= 0) :
1110
							if (portage.usesplit.index(ebuild_iuse) >= 0) :
Lines 1089-1097 Link Here
1089
						if (oldlp-len(myprint)) > 0:
1135
						if (oldlp-len(myprint)) > 0:
1090
							myprint=myprint+" "*(oldlp-len(myprint))
1136
							myprint=myprint+" "*(oldlp-len(myprint))
1091
						myprint=myprint+myoldbest
1137
						myprint=myprint+myoldbest
1092
						myprint=myprint+darkgreen("  to "+x[1])+" "+iuse
1138
						myprint=myprint+darkgreen("  to "+x[1])+" "+slot+" "+iuse
1093
					else:
1139
					else:
1094
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+iuse
1140
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+darkgreen("to "+x[1])+" "+slot+" "+iuse
1095
				else:
1141
				else:
1096
					if "--columns" in myopts:
1142
					if "--columns" in myopts:
1097
						myprint="["+x[0]+" "+addl+"] "+darkgreen(xs[0])
1143
						myprint="["+x[0]+" "+addl+"] "+darkgreen(xs[0])
Lines 1100-1108 Link Here
1100
						myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
1146
						myprint=myprint+green(" ["+xs[1]+xs[2]+"] ")
1101
						if (oldlp-len(myprint)) > 0:
1147
						if (oldlp-len(myprint)) > 0:
1102
							myprint=myprint+(" "*(oldlp-len(myprint)))
1148
							myprint=myprint+(" "*(oldlp-len(myprint)))
1103
						myprint=myprint+myoldbest+"  "+iuse
1149
						myprint=myprint+myoldbest+" "+slot+" "+iuse
1104
					else:
1150
					else:
1105
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+iuse
1151
						myprint="["+x[0]+" "+addl+"] "+darkgreen(x[2])+" "+myoldbest+" "+slot+" "+iuse
1106
				print myprint
1152
				print myprint
1107
1153
1108
			mysplit=portage.pkgsplit(x[2])
1154
			mysplit=portage.pkgsplit(x[2])
Lines 1126-1131 Link Here
1126
							print
1172
							print
1127
			del mysplit
1173
			del mysplit
1128
1174
1175
		if error:
1176
			if error=="multi":
1177
				print 
1178
				print "You need to select one version"
1179
				print "Example, \"emerge ="+x[2]+"\""
1180
				print "You can install both of them, if you emerge twice."
1181
1182
		
1129
 		if "--changelog" in myopts:
1183
 		if "--changelog" in myopts:
1130
 			print
1184
 			print
1131
 			for revision,text in changelogs:
1185
 			for revision,text in changelogs:
Lines 1196-1201 Link Here
1196
					if ("--pretend" not in myopts):
1250
					if ("--pretend" not in myopts):
1197
						sys.exit(1)
1251
						sys.exit(1)
1198
1252
1253
				if x[0]=="multi":
1254
					print "\n!!! Error: the "+x[2]+" package conflicts with another package."
1255
					print   "!!!        It is necessary to specify a version."
1256
					print   "!!!        Example, \"emerge ="+x[2]+"\""
1257
					print   "!!!        Please use 'emerge --pretend' to determine packages."
1258
					print
1259
					if ("--pretend" not in myopts):
1260
						sys.exit(1)
1261
1199
		if ("--resume" in myopts):
1262
		if ("--resume" in myopts):
1200
			# We're resuming.
1263
			# We're resuming.
1201
			print green("*** Resuming merge...")
1264
			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