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.orig (-4 / +41 lines)
Lines 4539-4544 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
4542
		# Don't bump mtimes on merge since some application require
4553
		# Don't bump mtimes on merge since some application require
4543
		# preservation of timestamps.  This means that the unmerge phase must
4554
		# preservation of timestamps.  This means that the unmerge phase must
4544
		# check to see if file belongs to an installed instance in the same
4555
		# check to see if file belongs to an installed instance in the same
Lines 4551-4557 Link Here
4551
4562
4552
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4563
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4553
		# "second hand" of symlinks to merge later
4564
		# "second hand" of symlinks to merge later
4554
		if self.mergeme(srcroot, destroot, outfile, secondhand,
4565
		if self.mergeme(srcroot, destroot, outfile, intfile, secondhand,
4555
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4566
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4556
			return 1
4567
			return 1
4557
4568
Lines 4563-4569 Link Here
4563
			# couldn't get merged will be added to thirdhand.
4574
			# couldn't get merged will be added to thirdhand.
4564
4575
4565
			thirdhand = []
4576
			thirdhand = []
4566
			if self.mergeme(srcroot, destroot, outfile, thirdhand,
4577
			if self.mergeme(srcroot, destroot, outfile, intfile, thirdhand,
4567
				secondhand, cfgfiledict, mymtime):
4578
				secondhand, cfgfiledict, mymtime):
4568
				return 1
4579
				return 1
4569
4580
Lines 4577-4583 Link Here
4577
4588
4578
		if len(secondhand):
4589
		if len(secondhand):
4579
			# force merge of remaining symlinks (broken or circular; oh well)
4590
			# force merge of remaining symlinks (broken or circular; oh well)
4580
			if self.mergeme(srcroot, destroot, outfile, None,
4591
			if self.mergeme(srcroot, destroot, outfile, intfile, None,
4581
				secondhand, cfgfiledict, mymtime):
4592
				secondhand, cfgfiledict, mymtime):
4582
				return 1
4593
				return 1
4583
4594
Lines 4588-4593 Link Here
4588
		outfile.flush()
4599
		outfile.flush()
4589
		outfile.close()
4600
		outfile.close()
4590
4601
4602
		#if we opened it, close it
4603
		intfile.flush()
4604
		intfile.close()
4605
4591
		# write out our collection of md5sums
4606
		# write out our collection of md5sums
4592
		if cfgfiledict != cfgfiledict_orig:
4607
		if cfgfiledict != cfgfiledict_orig:
4593
			cfgfiledict.pop("IGNORE", None)
4608
			cfgfiledict.pop("IGNORE", None)
Lines 4599-4605 Link Here
4599
4614
4600
		return os.EX_OK
4615
		return os.EX_OK
4601
4616
4602
	def mergeme(self, srcroot, destroot, outfile, secondhand, stufftomerge, cfgfiledict, thismtime):
4617
	def mergeme(self, srcroot, destroot, outfile, intfile, secondhand, stufftomerge, cfgfiledict, thismtime):
4603
		"""
4618
		"""
4604
4619
4605
		This function handles actual merging of the package contents to the livefs.
4620
		This function handles actual merging of the package contents to the livefs.
Lines 4611-4616 Link Here
4611
		@type destroot: String (Path)
4626
		@type destroot: String (Path)
4612
		@param outfile: File to log operations to
4627
		@param outfile: File to log operations to
4613
		@type outfile: File Object
4628
		@type outfile: File Object
4629
		@param intfile: File to log integrity info to
4630
		@type intfile: File Object
4614
		@param secondhand: A set of items to merge in pass two (usually
4631
		@param secondhand: A set of items to merge in pass two (usually
4615
		or symlinks that point to non-existing files that may get merged later)
4632
		or symlinks that point to non-existing files that may get merged later)
4616
		@type secondhand: List
4633
		@type secondhand: List
Lines 4749-4754 Link Here
4749
				# confmem rejected this update
4766
				# confmem rejected this update
4750
				zing = "---"
4767
				zing = "---"
4751
4768
4769
			srcobj = srcroot+relative_path
4770
			destobj = 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
4752
			if stat.S_ISLNK(mymode):
4789
			if stat.S_ISLNK(mymode):
4753
				# we are merging a symbolic link
4790
				# we are merging a symbolic link
4754
				# Pass in the symlink target in order to bypass the
4791
				# Pass in the symlink target in order to bypass the

Return to bug 605082