Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 28704
Collapse All | Expand All

(-)portage.py.org (-15 / +35 lines)
Lines 2750-2755 Link Here
2750
		mypos=mypos+1
2750
		mypos=mypos+1
2751
	return deplist
2751
	return deplist
2752
2752
2753
def fixdbentries(old_value, new_value, dbdir):
2754
	"""python replacement for the fixdbentries script, replaces old_value 
2755
	with new_value for package names in files in dbdir."""
2756
	for myfile in [f for f in os.listdir(dbdir) if not f == "CONTENTS"]:
2757
		f = open(dbdir+"/"+myfile, "r")
2758
		mycontent = f.read()
2759
		f.close()
2760
		if not mycontent.count(old_value):
2761
			continue
2762
		mycontent = re.sub(old_value+"$", new_value, mycontent)
2763
		mycontent = re.sub(old_value+"(\s)", new_value+"\1", mycontent)
2764
		mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\1", mycontent)
2765
		mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\1", mycontent)
2766
		f = open(dbdir+"/"+myfile, "w")
2767
		f.write(mycontent)
2768
		f.close()
2769
2753
class packagetree:
2770
class packagetree:
2754
	def __init__(self,virtual,clone=None):
2771
	def __init__(self,virtual,clone=None):
2755
		if clone:
2772
		if clone:
Lines 3174-3184 Link Here
3174
			catfile.write(mynewcat+"\n")
3191
			catfile.write(mynewcat+"\n")
3175
			catfile.close()
3192
			catfile.close()
3176
3193
3177
		mycmd='/usr/lib/portage/bin/fixdbentries'
3194
		fixdbentries(origcp, newcp, self.root+"var/db/pkg/")
3178
		mycmd=mycmd+' "'+origcp+'" '
3195
		#mycmd='/usr/lib/portage/bin/fixdbentries'
3179
		mycmd=mycmd+' "'+newcp+'" '
3196
		#mycmd=mycmd+' "'+origcp+'" '
3180
		mycmd=mycmd+' "'+self.root+"var/db/pkg/"+'" '
3197
		#mycmd=mycmd+' "'+newcp+'" '
3181
		spawn(mycmd,free=1)
3198
		#mycmd=mycmd+' "'+self.root+"var/db/pkg/"+'" '
3199
		#spawn(mycmd,free=1)
3182
	
3200
	
3183
	def cp_list(self,mycp):
3201
	def cp_list(self,mycp):
3184
		mysplit=mycp.split("/")
3202
		mysplit=mycp.split("/")
Lines 4007-4017 Link Here
4007
			mytbz2=xpak.tbz2(tbz2path)
4025
			mytbz2=xpak.tbz2(tbz2path)
4008
			mytbz2.decompose(mytmpdir, cleanup=1)
4026
			mytbz2.decompose(mytmpdir, cleanup=1)
4009
			
4027
			
4010
			mycmd='/usr/lib/portage/bin/fixdbentries'
4028
			fixdbentries(origcp, newcp, mytmpdir)
4011
			mycmd=mycmd+' "'+origcp+'" '
4029
			#mycmd='/usr/lib/portage/bin/fixdbentries'
4012
			mycmd=mycmd+' "'+newcp+'" '
4030
			#mycmd=mycmd+' "'+origcp+'" '
4013
			mycmd=mycmd+' "'+mytmpdir+'" '
4031
			#mycmd=mycmd+' "'+newcp+'" '
4014
			spawn(mycmd,free=1)
4032
			#mycmd=mycmd+' "'+mytmpdir+'" '
4033
			#spawn(mycmd,free=1)
4015
4034
4016
			catfile=open(mytmpdir+"/CATEGORY", "w")
4035
			catfile=open(mytmpdir+"/CATEGORY", "w")
4017
			catfile.write(mynewcat+"\n")
4036
			catfile.write(mynewcat+"\n")
Lines 4046-4056 Link Here
4046
				mylist=string.split(mylist)
4065
				mylist=string.split(mylist)
4047
				if mylist[0] != "move":
4066
				if mylist[0] != "move":
4048
					continue
4067
					continue
4049
				mycmd='/usr/lib/portage/bin/fixdbentries'
4068
				fixdbentries(mylist[1], mylist[2], mytmpdir)
4050
				mycmd=mycmd+' "'+mylist[1]+'" '
4069
				#mycmd='/usr/lib/portage/bin/fixdbentries'
4051
				mycmd=mycmd+' "'+mylist[2]+'" '
4070
				#mycmd=mycmd+' "'+mylist[1]+'" '
4052
				mycmd=mycmd+' "'+mytmpdir+'" '
4071
				#mycmd=mycmd+' "'+mylist[2]+'" '
4053
				spawn(mycmd,free=1)
4072
				#mycmd=mycmd+' "'+mytmpdir+'" '
4073
				#spawn(mycmd,free=1)
4054
			mytbz2.recompose(mytmpdir,cleanup=1)
4074
			mytbz2.recompose(mytmpdir,cleanup=1)
4055
		return 1
4075
		return 1

Return to bug 28704