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

(-)/usr/lib/portage/pym/portage.py.orig (-6 / +67 lines)
Lines 5905-5911 Link Here
5905
			mysymlinks = filter(os.path.islink, listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False))
5905
			mysymlinks = filter(os.path.islink, listdir(srcroot, recursive=1, filesonly=0, followSymlinks=False))
5906
			myfilelist.extend(mysymlinks)
5906
			myfilelist.extend(mysymlinks)
5907
5907
5908
			stopmerge=False
5909
			starttime=time.time()
5908
			starttime=time.time()
5910
			i=0
5909
			i=0
5911
5910
Lines 5924-5929 Link Here
5924
							vartree=self.vartree))
5923
							vartree=self.vartree))
5925
5924
5926
			print green("*")+" checking "+str(len(myfilelist))+" files for package collisions"
5925
			print green("*")+" checking "+str(len(myfilelist))+" files for package collisions"
5926
			collidingfiles = []
5927
			for f in myfilelist:
5927
			for f in myfilelist:
5928
				nocheck = False
5928
				nocheck = False
5929
				# listdir isn't intelligent enough to exclude symlinked dirs,
5929
				# listdir isn't intelligent enough to exclude symlinked dirs,
Lines 5946-5963 Link Here
5946
						break
5946
						break
5947
				if not isowned:
5947
				if not isowned:
5948
					print "existing file "+f+" is not owned by this package"
5948
					print "existing file "+f+" is not owned by this package"
5949
					stopmerge=True
5949
					collidingfiles.append(f)
5950
			print green("*")+" spent "+str(time.time()-starttime)+" seconds checking for file collisions"
5950
			print green("*")+" spent "+str(time.time()-starttime)+" seconds checking for file collisions"
5951
			if stopmerge:
5951
5952
			stopmerge = False
5953
			# The three if-clauses could technically be combined and nested,
5954
			# However, practically the indentation depth gets to deep.
5955
			if collidingfiles:
5956
				# Check for qlist from app-portage/portage-utils
5957
				# FIXME: Currently only standard location /usr/bin/qlist supported
5958
				hasqfile = os.access('/usr/bin/qfile', os.X_OK)
5959
				print
5952
				print red("*")+" This package is blocked because it wants to overwrite"
5960
				print red("*")+" This package is blocked because it wants to overwrite"
5953
				print red("*")+" files belonging to other packages (see messages above)."
5961
				print red("*")+" files possibly belonging to other packages (see messages above)."
5954
				print red("*")+" If you have no clue what this is all about report it "
5962
				print red("*")+" If you have no clue what this is all about report it "
5955
				print red("*")+" as a bug for this package on http://bugs.gentoo.org"
5963
				print red("*")+" as a bug for this package on http://bugs.gentoo.org."
5964
				if not "collision-protect-ask" in self.settings.features:
5965
					stopmerge = True
5966
					print
5967
					print red("*")+" To get some interactivity add collision-protect-ask"
5968
					print red("*")+" to your FEATURES list."
5969
				if not hasqfile:
5970
					print
5971
					print red("*")+" You might want to install app-portage/portage-utils"
5972
					print red("*")+" to get the qfile utility, it finds file owners and"
5973
					print red("*")+" helps to investigate the problem."
5974
5975
			if collidingfiles and "collision-protect-ask" in self.settings.features:
5976
				# User asks for interactivity
5977
				answered = False
5978
				while not answered:
5979
					# FIXME: This should not clutter the terminal buffer,
5980
					# but in case of not_answered be overwritten."
5981
					print
5982
					print green("*")+" You enabled the collision-protect-ask feature."
5983
					print green("*")+" What do you want to do?"
5984
					print green("*")+"  1. Overwrite those files and continue the merge,"
5985
					print green("*")+"      I checked that no package is owning them"
5986
					print green("*")+"      (using e.g. qfile from app-portage/portage-utils)"
5987
					print green("*")+"      or I know what I am doing!"
5988
					print   red("*")+"      Anyway, I will file a bug as asked for above."
5989
					print green("*")+"  2. Please find out, who is owning these files, I have"
5990
					print green("*")+"      qfile from app-portage/portage-utils installed."
5991
					print green("*")+"  3. Abort merge! (the same, as if you would not have"
5992
					print green("*")+"      set the collision-protect-ask feature)"
5993
					print green("*")+" (1/2/3)? ",
5994
					a = sys.stdin.readline().rstrip()
5995
					if a == '1':
5996
						# continue as if without collision
5997
						answered = True
5998
					elif a == '2':
5999
						# run qlist
6000
						if not hasqfile:
6001
							# FIXME: suggestion to user needs to be given
6002
							print
6003
							print red("*")+" NO, you don't have qfile installed."
6004
						else:
6005
							print
6006
							print green("*")+"Running qfile for colliding files:"
6007
							for f in collidingfiles:
6008
								print f+':'
6009
								res = os.system('/usr/bin/qfile '+f)
6010
								if res != 0:
6011
									print "  Not owned by any package."
6012
					elif a == '3':
6013
						stopmerge = True
6014
						answered = True
6015
6016
			if stopmerge:
5956
				print
6017
				print
5957
				print red("package "+self.cat+"/"+self.pkg+" NOT merged")
6018
				print red("package "+self.cat+"/"+self.pkg+" NOT merged")
5958
				print
6019
				print
5959
				# Why is the package already merged here db-wise? Shouldn't be the case
6020
				# Why is the package already merged here db-wise? Shouldn't be the case
5960
				# only unmerge if it ia new package and has no contents
6021
				# only unmerge if it is a new package and has no contents
5961
				if not self.getcontents():
6022
				if not self.getcontents():
5962
					self.unmerge(ldpath_mtimes=prev_mtimes)
6023
					self.unmerge(ldpath_mtimes=prev_mtimes)
5963
					self.delete()
6024
					self.delete()

Return to bug 162288