public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r13085 - main/branches/2.1.6/pym/_emerge
@ 2009-03-12  5:57 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-03-12  5:57 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-03-12 05:57:42 +0000 (Thu, 12 Mar 2009)
New Revision: 13085

Modified:
   main/branches/2.1.6/pym/_emerge/__init__.py
Log:
Bug #261992 - Replace the EbuildBuildDir.clean() method with a clean_log()
method since log cleanup is all that's currently needed and shutil.rmtree()
can fail with "OSError: [Errno 36] File name too long" due to strange file
names, or on FreeBSD it can fail with EPERM due to file flags in $D.
(trunk r13071)

Modified: main/branches/2.1.6/pym/_emerge/__init__.py
===================================================================
--- main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-12 05:57:24 UTC (rev 13084)
+++ main/branches/2.1.6/pym/_emerge/__init__.py	2009-03-12 05:57:42 UTC (rev 13085)
@@ -2488,7 +2488,7 @@
 		if not self.prefetch:
 			self._build_dir = EbuildBuildDir(pkg=self.pkg, settings=settings)
 			self._build_dir.lock()
-			self._build_dir.clean()
+			self._build_dir.clean_log()
 			portage.prepare_build_dirs(self.pkg.root, self._build_dir.settings, 0)
 			if self.logfile is None:
 				self.logfile = settings.get("PORTAGE_LOG_FILE")
@@ -2559,7 +2559,7 @@
 				portage.elog.elog_process(self.pkg.cpv, self._build_dir.settings)
 			features = self._build_dir.settings.features
 			if self.returncode == os.EX_OK:
-				self._build_dir.clean()
+				self._build_dir.clean_log()
 			self._build_dir.unlock()
 			self.config_pool.deallocate(self._build_dir.settings)
 			self._build_dir = None
@@ -2614,18 +2614,16 @@
 			if catdir_lock is not None:
 				portage.locks.unlockdir(catdir_lock)
 
-	def clean(self):
+	def clean_log(self):
 		"""Uses shutil.rmtree() rather than spawning a 'clean' phase. Disabled
 		by keepwork or keeptemp in FEATURES."""
 		settings = self.settings
-		features = settings.features
-		if not ("keepwork" in features or "keeptemp" in features):
+
+		for x in ('.logid', 'temp/build.log'):
 			try:
-				shutil.rmtree(settings["PORTAGE_BUILDDIR"])
-			except EnvironmentError, e:
-				if e.errno != errno.ENOENT:
-					raise
-				del e
+				os.unlink(os.path.join(settings["PORTAGE_BUILDDIR"], x))
+			except OSError:
+				pass
 
 	def unlock(self):
 		if self._lock_obj is None:
@@ -3396,11 +3394,7 @@
 			self._build_dir.lock()
 			# If necessary, discard old log so that we don't
 			# append to it.
-			for x in ('.logid', 'temp/build.log'):
-				try:
-					os.unlink(os.path.join(self._build_dir.dir_path, x))
-				except OSError:
-					pass
+			self._build_dir.clean_log()
 			# Initialze PORTAGE_LOG_FILE.
 			portage.prepare_build_dirs(self.settings["ROOT"], self.settings, 1)
 		fetcher = BinpkgFetcher(background=self.background,




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-12  5:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-12  5:57 [gentoo-commits] portage r13085 - main/branches/2.1.6/pym/_emerge Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox