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

Collapse All | Expand All

(-)pym.orig/portage.py (-16 / +38 lines)
Lines 4918-4926 Link Here
4918
				sys.exit(123)
4937
				sys.exit(123)
4919
4938
4920
		if pkgfiles:
4939
		if pkgfiles:
4921
			mykeys=pkgfiles.keys()
4940
			#unmerge-speedup: filter pkgfiles to remove obviously non-existing objects.
4922
			mykeys.sort()
4941
			# Should be useful for unmerging already deleted kernel sources trees, etc. 
4923
			mykeys.reverse()
4942
			myorigkeys=pkgfiles.keys()
4943
			mynormdict={}
4944
			for realobj in myorigkeys:
4945
				obj=os.path.normpath(realobj)
4946
				if obj[:2]=="//":
4947
					obj=obj[1:]
4948
				mynormdict[obj]=realobj
4949
			mynormkeys=mynormdict.keys()
4950
			mynormkeys.sort()
4951
			mykeys=[]
4952
			while len(mynormkeys):
4953
				obj=mynormkeys.pop(0)
4954
				mykeys[:0]=[obj]
4955
				realobj=mynormdict[obj]
4956
				if pkgfiles[realobj][0]=="dir" and not os.path.exists(obj):
4957
					# non existing dir -> forget his contents
4958
					while len(mynormkeys):
4959
						nextobj=mynormkeys[0]
4960
						if nextobj[:len(obj)+1]==obj+"/":
4961
							# this is some contents
4962
							del mynormkeys[0]
4963
							del mynormdict[nextobj]
4964
						else:
4965
							# end of the contents
4966
							break
4924
4967
4925
			self.updateprotect()
4968
			self.updateprotect()
4926
4969
Lines 4929-4943 Link Here
4929
			mysyms=[]
4973
			mysyms=[]
4930
			modprotect="/lib/modules/"
4974
			modprotect="/lib/modules/"
4931
			for obj in mykeys:
4975
			for obj in mykeys:
4932
				obj=os.path.normpath(obj)
4976
				realobj=mynormdict.pop(obj)
4933
				if obj[:2]=="//":
4934
					obj=obj[1:]
4935
				if not os.path.exists(obj):
4977
				if not os.path.exists(obj):
4936
					if not os.path.islink(obj):
4978
					if not os.path.islink(obj):
4937
						#we skip this if we're dealing with a symlink
4979
						#we skip this if we're dealing with a symlink
4938
						#because os.path.exists() will operate on the
4980
						#because os.path.exists() will operate on the
4939
						#link target rather than the link itself.
4981
						#link target rather than the link itself.
4940
						print "--- !found "+str(pkgfiles[obj][0]), obj
4982
						print "--- !found "+str(pkgfiles[realobj][0]), obj
4941
						continue
4983
						continue
4942
				# next line includes a tweak to protect modules from being unmerged,
4984
				# next line includes a tweak to protect modules from being unmerged,
4943
				# but we don't protect modules from being overwritten if they are
4985
				# but we don't protect modules from being overwritten if they are
Lines 4945-4977 Link Here
4945
				# functionality for /lib/modules. For portage-ng both capabilities
4987
				# functionality for /lib/modules. For portage-ng both capabilities
4946
				# should be able to be independently specified.
4988
				# should be able to be independently specified.
4947
				if self.isprotected(obj) or ((len(obj) > len(modprotect)) and (obj[0:len(modprotect)]==modprotect)):
4989
				if self.isprotected(obj) or ((len(obj) > len(modprotect)) and (obj[0:len(modprotect)]==modprotect)):
4948
					print "--- cfgpro "+str(pkgfiles[obj][0]), obj
4990
					print "--- cfgpro "+str(pkgfiles[realobj][0]), obj
4949
					continue
4991
					continue
4950
4992
4951
				lstatobj=os.lstat(obj)
4993
				lstatobj=os.lstat(obj)
4952
				lmtime=str(lstatobj[ST_MTIME])
4994
				lmtime=str(lstatobj[ST_MTIME])
4953
				if (pkgfiles[obj][0] not in ("dir","fif","dev","sym")) and (lmtime != pkgfiles[obj][1]):
4995
				if (pkgfiles[realobj][0] not in ("dir","fif","dev","sym")) and (lmtime != pkgfiles[realobj][1]):
4954
					print "--- !mtime", pkgfiles[obj][0], obj
4996
					print "--- !mtime", pkgfiles[realobj][0], obj
4955
					continue
4997
					continue
4956
4998
4957
				if pkgfiles[obj][0]=="dir":
4999
				if pkgfiles[realobj][0]=="dir":
4958
					if not os.path.isdir(obj):
5000
					if not os.path.isdir(obj):
4959
						print "--- !dir  ","dir", obj
5001
						print "--- !dir  ","dir", obj
4960
						continue
5002
						continue
4961
					mydirs.append(obj)
5003
					mydirs.append(obj)
4962
				elif pkgfiles[obj][0]=="sym":
5004
				elif pkgfiles[realobj][0]=="sym":
4963
					if not os.path.islink(obj):
5005
					if not os.path.islink(obj):
4964
						print "--- !sym  ","sym", obj
5006
						print "--- !sym  ","sym", obj
4965
						continue
5007
						continue
4966
					mysyms.append(obj)
5008
					mysyms.append(obj)
4967
				elif pkgfiles[obj][0]=="obj":
5009
				elif pkgfiles[realobj][0]=="obj":
4968
					if not os.path.isfile(obj):
5010
					if not os.path.isfile(obj):
4969
						print "--- !obj  ","obj", obj
5011
						print "--- !obj  ","obj", obj
4970
						continue
5012
						continue
4971
					mymd5=perform_md5(obj, calc_prelink=1)
5013
					mymd5=perform_md5(obj, calc_prelink=1)
4972
					# string.lower is needed because db entries used to be in upper-case.  The
5014
					# string.lower is needed because db entries used to be in upper-case.  The
4973
					# string.lower allows for backwards compatibility.
5015
					# string.lower allows for backwards compatibility.
4974
					if mymd5 != string.lower(pkgfiles[obj][2]):
5016
					if mymd5 != string.lower(pkgfiles[realobj][2]):
4975
						print "--- !md5  ","obj", obj
5017
						print "--- !md5  ","obj", obj
4976
						continue
5018
						continue
4977
					try:
5019
					try:
Lines 4979-4985 Link Here
4979
					except (OSError,IOError),e:
5021
					except (OSError,IOError),e:
4980
						pass		
5022
						pass		
4981
					print "<<<       ","obj",obj
5023
					print "<<<       ","obj",obj
4982
				elif pkgfiles[obj][0]=="fif":
5024
				elif pkgfiles[realobj][0]=="fif":
4983
					if not S_ISFIFO(lstatobj[ST_MODE]):
5025
					if not S_ISFIFO(lstatobj[ST_MODE]):
4984
						print "--- !fif  ","fif", obj
5026
						print "--- !fif  ","fif", obj
4985
						continue
5027
						continue
Lines 4988-4994 Link Here
4988
					except (OSError,IOError),e:
5030
					except (OSError,IOError),e:
4989
						pass
5031
						pass
4990
					print "<<<       ","fif",obj
5032
					print "<<<       ","fif",obj
4991
				elif pkgfiles[obj][0]=="dev":
5033
				elif pkgfiles[realobj][0]=="dev":
4992
					print "---       ","dev",obj
5034
					print "---       ","dev",obj
4993
5035
4994
			#Now, we need to remove symlinks and directories.  We'll repeatedly
5036
			#Now, we need to remove symlinks and directories.  We'll repeatedly

Return to bug 35931