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

Collapse All | Expand All

(-)pym/portage.py (-4 / +36 lines)
Lines 6093-6099 Link Here
6093
			mysettings.get("CONFIG_PROTECT","").split(),
6093
			mysettings.get("CONFIG_PROTECT","").split(),
6094
			mysettings.get("CONFIG_PROTECT_MASK","").split())
6094
			mysettings.get("CONFIG_PROTECT_MASK","").split())
6095
		self.updateprotect = protect_obj.updateprotect
6095
		self.updateprotect = protect_obj.updateprotect
6096
		self.isprotected = protect_obj.isprotected
6096
		self._config_protect = protect_obj
6097
		self._installed_instance = None
6097
		self.contentscache=[]
6098
		self.contentscache=[]
6098
		self._contents_inodes = None
6099
		self._contents_inodes = None
6099
6100
Lines 6293-6300 Link Here
6293
			mykeys.sort()
6294
			mykeys.sort()
6294
			mykeys.reverse()
6295
			mykeys.reverse()
6295
6296
6296
			self.updateprotect()
6297
6298
			#process symlinks second-to-last, directories last.
6297
			#process symlinks second-to-last, directories last.
6299
			mydirs=[]
6298
			mydirs=[]
6300
			modprotect="/lib/modules/"
6299
			modprotect="/lib/modules/"
Lines 6325-6331 Link Here
6325
				# upgraded. We effectively only want one half of the config protection
6324
				# upgraded. We effectively only want one half of the config protection
6326
				# functionality for /lib/modules. For portage-ng both capabilities
6325
				# functionality for /lib/modules. For portage-ng both capabilities
6327
				# should be able to be independently specified.
6326
				# should be able to be independently specified.
6328
				if self.isprotected(obj) or ((len(obj) > len(modprotect)) and (obj[0:len(modprotect)]==modprotect)):
6327
				if obj.startswith(modprotect):
6329
					writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[objkey][0], obj))
6328
					writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[objkey][0], obj))
6330
					continue
6329
					continue
6331
6330
Lines 6427-6432 Link Here
6427
6426
6428
		return False
6427
		return False
6429
6428
6429
	def isprotected(self, filename):
6430
		"""In cases where an installed package in the same slot owns a
6431
		protected file that will be merged, bump the mtime on the installed
6432
		file in order to ensure that it isn't unmerged."""
6433
		if not self._config_protect.isprotected(filename):
6434
			return False
6435
		if self._installed_instance is None:
6436
			return True
6437
		mydata = self._installed_instance.getcontents().get(filename, None)
6438
		if mydata is None:
6439
			return True
6440
6441
		# Bump the mtime in order to ensure that the old config file doesn't
6442
		# get unmerged.  The user will have an opportunity to merge the new
6443
		# config with the old one.
6444
		try:
6445
			os.utime(filename, None)
6446
		except OSError, e:
6447
			if e.errno != errno.ENOENT:
6448
				raise
6449
			del e
6450
			# The file has disappeared, so it's not protected.
6451
			return False
6452
		return True
6453
6430
	def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
6454
	def treewalk(self, srcroot, destroot, inforoot, myebuild, cleanup=0,
6431
		mydbapi=None, prev_mtimes=None):
6455
		mydbapi=None, prev_mtimes=None):
6432
		# srcroot  = ${D};
6456
		# srcroot  = ${D};
Lines 6447-6452 Link Here
6447
		for v in self.vartree.dbapi.cp_list(self.mysplit[0]):
6471
		for v in self.vartree.dbapi.cp_list(self.mysplit[0]):
6448
			otherversions.append(v.split("/")[1])
6472
			otherversions.append(v.split("/")[1])
6449
6473
6474
		slot_matches = self.vartree.dbapi.match(
6475
			"%s:%s" % (self.mysplit[0], self.settings["SLOT"]))
6476
		if slot_matches:
6477
			# Used by self.isprotected().
6478
			self._installed_instance = dblink(self.cat,
6479
				catsplit(slot_matches[0])[1], destroot, self.settings,
6480
				vartree=self.vartree)
6481
6450
		# check for package collisions
6482
		# check for package collisions
6451
		if "collision-protect" in self.settings.features:
6483
		if "collision-protect" in self.settings.features:
6452
			collision_ignore = set([normalize_path(myignore) for myignore in \
6484
			collision_ignore = set([normalize_path(myignore) for myignore in \

Return to bug 8423