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

Collapse All | Expand All

(-)/usr/lib64/python3.4/site-packages/portage/dbapi/vartree.py (-41 / +4 lines)
Lines 4539-4555 Link Here
4539
			mode='w', encoding=_encodings['repo.content'],
4539
			mode='w', encoding=_encodings['repo.content'],
4540
			errors='backslashreplace')
4540
			errors='backslashreplace')
4541
4541
4542
4543
		# open INTEGRITY file (possibly overwriting old one) for recording
4544
		# Use atomic_ofstream for automatic coercion of raw bytes to
4545
		# unicode, in order to prevent TypeError when writing raw bytes
4546
		# to TextIOWrapper with python2.
4547
		intfile = atomic_ofstream(_unicode_encode(
4548
			os.path.join(self.dbtmpdir, 'INTEGRITY'),
4549
			encoding=_encodings['fs'], errors='strict'),
4550
			mode='w', encoding=_encodings['repo.content'],
4551
			errors='backslashreplace')
4552
4553
		# Don't bump mtimes on merge since some application require
4542
		# Don't bump mtimes on merge since some application require
4554
		# preservation of timestamps.  This means that the unmerge phase must
4543
		# preservation of timestamps.  This means that the unmerge phase must
4555
		# check to see if file belongs to an installed instance in the same
4544
		# check to see if file belongs to an installed instance in the same
Lines 4562-4568 Link Here
4562
4551
4563
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4552
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4564
		# "second hand" of symlinks to merge later
4553
		# "second hand" of symlinks to merge later
4565
		if self.mergeme(srcroot, destroot, outfile, intfile, secondhand,
4554
		if self.mergeme(srcroot, destroot, outfile, secondhand,
4566
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4555
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4567
			return 1
4556
			return 1
4568
4557
Lines 4574-4580 Link Here
4574
			# couldn't get merged will be added to thirdhand.
4563
			# couldn't get merged will be added to thirdhand.
4575
4564
4576
			thirdhand = []
4565
			thirdhand = []
4577
			if self.mergeme(srcroot, destroot, outfile, intfile, thirdhand,
4566
			if self.mergeme(srcroot, destroot, outfile, thirdhand,
4578
				secondhand, cfgfiledict, mymtime):
4567
				secondhand, cfgfiledict, mymtime):
4579
				return 1
4568
				return 1
4580
4569
Lines 4588-4594 Link Here
4588
4577
4589
		if len(secondhand):
4578
		if len(secondhand):
4590
			# force merge of remaining symlinks (broken or circular; oh well)
4579
			# force merge of remaining symlinks (broken or circular; oh well)
4591
			if self.mergeme(srcroot, destroot, outfile, intfile, None,
4580
			if self.mergeme(srcroot, destroot, outfile, None,
4592
				secondhand, cfgfiledict, mymtime):
4581
				secondhand, cfgfiledict, mymtime):
4593
				return 1
4582
				return 1
4594
4583
Lines 4599-4608 Link Here
4599
		outfile.flush()
4588
		outfile.flush()
4600
		outfile.close()
4589
		outfile.close()
4601
4590
4602
		#if we opened it, close it
4603
		intfile.flush()
4604
		intfile.close()
4605
4606
		# write out our collection of md5sums
4591
		# write out our collection of md5sums
4607
		if cfgfiledict != cfgfiledict_orig:
4592
		if cfgfiledict != cfgfiledict_orig:
4608
			cfgfiledict.pop("IGNORE", None)
4593
			cfgfiledict.pop("IGNORE", None)
Lines 4614-4620 Link Here
4614
4599
4615
		return os.EX_OK
4600
		return os.EX_OK
4616
4601
4617
	def mergeme(self, srcroot, destroot, outfile, intfile, secondhand, stufftomerge, cfgfiledict, thismtime):
4602
	def mergeme(self, srcroot, destroot, outfile, secondhand, stufftomerge, cfgfiledict, thismtime):
4618
		"""
4603
		"""
4619
4604
4620
		This function handles actual merging of the package contents to the livefs.
4605
		This function handles actual merging of the package contents to the livefs.
Lines 4626-4633 Link Here
4626
		@type destroot: String (Path)
4611
		@type destroot: String (Path)
4627
		@param outfile: File to log operations to
4612
		@param outfile: File to log operations to
4628
		@type outfile: File Object
4613
		@type outfile: File Object
4629
		@param intfile: File to log integrity info to
4630
		@type intfile: File Object
4631
		@param secondhand: A set of items to merge in pass two (usually
4614
		@param secondhand: A set of items to merge in pass two (usually
4632
		or symlinks that point to non-existing files that may get merged later)
4615
		or symlinks that point to non-existing files that may get merged later)
4633
		@type secondhand: List
4616
		@type secondhand: List
Lines 4766-4791 Link Here
4766
				# confmem rejected this update
4749
				# confmem rejected this update
4767
				zing = "---"
4750
				zing = "---"
4768
4751
4769
			srcobj = srcroot+relative_path
4770
			destobj = os.path.realpath(destroot+relative_path)
4771
			hashtype = self.settings["INTEGRITY_HASH"]
4772
4773
			line = ""
4774
			if stat.S_ISREG(mymode):
4775
				line = "mode:"+oct(mymode)[-4:]+" "
4776
				if hashtype.lower() == "sha1" or hashtype.lower() == "sha256" or hashtype.lower() == "sha512":
4777
					line += hashtype.lower()+":"+portage.checksum.perform_checksum(srcobj, hashtype.upper(), 0)[0]+" "
4778
				line += "file:"+destobj+"\n"
4779
			elif stat.S_ISDIR(mymode):
4780
				if not os.path.exists(destobj):
4781
					line = "mode:"+oct(mymode)[-4:]+" "
4782
					line += "file:"+destobj+"\n"
4783
			else: #LINK, FIFO, DEV
4784
				line = "mode:"+oct(mymode)[-4:]+" "
4785
				line += "file:"+destobj+"\n"
4786
4787
			intfile.write(line)
4788
4789
			if stat.S_ISLNK(mymode):
4752
			if stat.S_ISLNK(mymode):
4790
				# we are merging a symbolic link
4753
				# we are merging a symbolic link
4791
				# Pass in the symlink target in order to bypass the
4754
				# Pass in the symlink target in order to bypass the

Return to bug 605082