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

(-)file_not_specified_in_diff (-5 / +93 lines)
Line  Link Here
0
-- vartree.py
0
++ vartree.py
Lines 4574-4579 Link Here
4574
			mode='w', encoding=_encodings['repo.content'],
4574
			mode='w', encoding=_encodings['repo.content'],
4575
			errors='backslashreplace')
4575
			errors='backslashreplace')
4576
4576
4577
4578
		hashtype = self.settings.get("INTEGRITY_HASH").upper()
4579
		if hashtype is None:
4580
			hashtype = "SHA512"
4581
		elif hashtype != "SHA1" and hashtype != "SHA256":
4582
			hashtype = "SHA512"
4583
4584
		# open CONTENTS_DIGESTS file (possibly overwriting old one) for recording
4585
		# Use atomic_ofstream for automatic coercion of raw bytes to
4586
		# unicode, in order to prevent TypeError when writing raw bytes
4587
		# to TextIOWrapper with python2.
4588
		digfile = atomic_ofstream(_unicode_encode(
4589
			os.path.join(self.dbtmpdir, 'CONTENTS_DIGESTS_'+hashtype),
4590
			encoding=_encodings['fs'], errors='strict'),
4591
			mode='w', encoding=_encodings['repo.content'],
4592
			errors='backslashreplace')
4593
4594
		# open CONTENTS_DIGESTS file (possibly overwriting old one) for recording
4595
		# Use atomic_ofstream for automatic coercion of raw bytes to
4596
		# unicode, in order to prevent TypeError when writing raw bytes
4597
		# to TextIOWrapper with python2.
4598
		modfile = atomic_ofstream(_unicode_encode(
4599
			os.path.join(self.dbtmpdir, 'CONTENTS_MODES'),
4600
			encoding=_encodings['fs'], errors='strict'),
4601
			mode='w', encoding=_encodings['repo.content'],
4602
			errors='backslashreplace')
4603
4604
		# open CONTENTS_DIGESTS file (possibly overwriting old one) for recording
4605
		# Use atomic_ofstream for automatic coercion of raw bytes to
4606
		# unicode, in order to prevent TypeError when writing raw bytes
4607
		# to TextIOWrapper with python2.
4608
		paxfile = atomic_ofstream(_unicode_encode(
4609
			os.path.join(self.dbtmpdir, 'CONTENTS_ATTRS_PAX'),
4610
			encoding=_encodings['fs'], errors='strict'),
4611
			mode='w', encoding=_encodings['repo.content'],
4612
			errors='backslashreplace')
4613
4577
		# Don't bump mtimes on merge since some application require
4614
		# Don't bump mtimes on merge since some application require
4578
		# preservation of timestamps.  This means that the unmerge phase must
4615
		# preservation of timestamps.  This means that the unmerge phase must
4579
		# check to see if file belongs to an installed instance in the same
4616
		# check to see if file belongs to an installed instance in the same
Lines 4586-4592 Link Here
4586
4623
4587
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4624
		# we do a first merge; this will recurse through all files in our srcroot but also build up a
4588
		# "second hand" of symlinks to merge later
4625
		# "second hand" of symlinks to merge later
4589
		if self.mergeme(srcroot, destroot, outfile, secondhand,
4626
		if self.mergeme(srcroot, destroot, outfile, digfile, modfile, paxfile, hashtype, secondhand,
4590
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4627
			self.settings["EPREFIX"].lstrip(os.sep), cfgfiledict, mymtime):
4591
			return 1
4628
			return 1
4592
4629
Lines 4598-4604 Link Here
4598
			# couldn't get merged will be added to thirdhand.
4635
			# couldn't get merged will be added to thirdhand.
4599
4636
4600
			thirdhand = []
4637
			thirdhand = []
4601
			if self.mergeme(srcroot, destroot, outfile, thirdhand,
4638
			if self.mergeme(srcroot, destroot, outfile, digfile, modfile, paxfile, hashtype, thirdhand,
4602
				secondhand, cfgfiledict, mymtime):
4639
				secondhand, cfgfiledict, mymtime):
4603
				return 1
4640
				return 1
4604
4641
Lines 4612-4618 Link Here
4612
4649
4613
		if len(secondhand):
4650
		if len(secondhand):
4614
			# force merge of remaining symlinks (broken or circular; oh well)
4651
			# force merge of remaining symlinks (broken or circular; oh well)
4615
			if self.mergeme(srcroot, destroot, outfile, None,
4652
			if self.mergeme(srcroot, destroot, outfile, digfile, modfile, paxfile, hashtype, None,
4616
				secondhand, cfgfiledict, mymtime):
4653
				secondhand, cfgfiledict, mymtime):
4617
				return 1
4654
				return 1
4618
4655
Lines 4623-4628 Link Here
4623
		outfile.flush()
4660
		outfile.flush()
4624
		outfile.close()
4661
		outfile.close()
4625
4662
4663
		#if we opened it, close it
4664
		digfile.flush()
4665
		digfile.close()
4666
4667
		#if we opened it, close it
4668
		modfile.flush()
4669
		modfile.close()
4670
4671
		#if we opened it, close it
4672
		paxfile.flush()
4673
		paxfile.close()
4674
4626
		# write out our collection of md5sums
4675
		# write out our collection of md5sums
4627
		if cfgfiledict != cfgfiledict_orig:
4676
		if cfgfiledict != cfgfiledict_orig:
4628
			cfgfiledict.pop("IGNORE", None)
4677
			cfgfiledict.pop("IGNORE", None)
Lines 4634-4640 Link Here
4634
4683
4635
		return os.EX_OK
4684
		return os.EX_OK
4636
4685
4637
	def mergeme(self, srcroot, destroot, outfile, secondhand, stufftomerge, cfgfiledict, thismtime):
4686
	def mergeme(self, srcroot, destroot, outfile, digfile, modfile, paxfile, hashtype, secondhand, stufftomerge, cfgfiledict, thismtime):
4638
		"""
4687
		"""
4639
4688
4640
		This function handles actual merging of the package contents to the livefs.
4689
		This function handles actual merging of the package contents to the livefs.
Lines 4646-4651 Link Here
4646
		@type destroot: String (Path)
4695
		@type destroot: String (Path)
4647
		@param outfile: File to log operations to
4696
		@param outfile: File to log operations to
4648
		@type outfile: File Object
4697
		@type outfile: File Object
4698
		@param digfile: File to log digests info to
4699
		@type digfile: File Object
4700
		@param modfile: File to log mode info to
4701
		@type modfile: File Object
4702
		@param paxfile: File to log mode info to
4703
		@type paxfile: File Object
4649
		@param secondhand: A set of items to merge in pass two (usually
4704
		@param secondhand: A set of items to merge in pass two (usually
4650
		or symlinks that point to non-existing files that may get merged later)
4705
		or symlinks that point to non-existing files that may get merged later)
4651
		@type secondhand: List
4706
		@type secondhand: List
Lines 4784-4789 Link Here
4784
				# confmem rejected this update
4839
				# confmem rejected this update
4785
				zing = "---"
4840
				zing = "---"
4786
4841
4842
			digest_length = 0
4843
			if hashtype == "SHA1":
4844
				digest_length = 40
4845
			elif hashtype == "SHA256":
4846
				digest_length = 64
4847
			elif hashtype == "SHA512":
4848
				digest_length = 128
4849
4850
			if stat.S_ISREG(mymode):
4851
				line_digest = portage.checksum.perform_checksum(mysrc, hashtype, 0)[0]+"\n"
4852
				line_mode = "mode:"+oct(mymode)[-4:]+"\n"
4853
4854
				attrlist = xattr.list(mysrc)
4855
				if len(attrlist)>0:
4856
					for i in attrlist:
4857
						if i == "user.pax.flags":
4858
							line_attr_pax = _unicode_decode(xattr.get(mysrc, "user.pax.flags")).zfill(5)+"\n"
4859
				else:
4860
					line_attr_pax = "00000\n"
4861
4862
			elif stat.S_ISDIR(mymode):
4863
				line_digest = '{num:0{width}}\n'.format(num=0, width=digest_length)
4864
				line_mode = "mode:"+oct(mymode)[-4:]+"\n"
4865
				line_attr_pax = "00000\n"
4866
			else: #LINK, FIFO, DEV
4867
				line_digest = '{num:0{width}}\n'.format(num=0, width=digest_length)
4868
				line_mode = "mode:"+oct(mymode)[-4:]+"\n"
4869
				line_attr_pax = "00000\n"
4870
4871
			digfile.write(line_digest)
4872
			modfile.write(line_mode)
4873
			paxfile.write(line_attr_pax)
4874
4787
			if stat.S_ISLNK(mymode):
4875
			if stat.S_ISLNK(mymode):
4788
				# we are merging a symbolic link
4876
				# we are merging a symbolic link
4789
				# Pass in the symlink target in order to bypass the
4877
				# Pass in the symlink target in order to bypass the

Return to bug 605082