Bug #304981 - Truncate the build log after successful fetch, instead of
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:17:08 +0000 (20:17 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 20:17:08 +0000 (20:17 -0000)
removing it, so as not to interfere with tail -f. (trunk r15352)

svn path=/main/branches/2.1.7/; revision=15579

pym/_emerge/EbuildBuildDir.py

index e501357e77871f77ac95471c5d7bb7a6b73fba6b..99c48dfb6dadd26434ba182d81c6171b590f5e39 100644 (file)
@@ -63,10 +63,11 @@ class EbuildBuildDir(SlotObject):
        def clean_log(self):
                """Discard existing log."""
                settings = self.settings
-
-               for x in ('.logid', 'temp/build.log'):
+               log_file = settings.get('PORTAGE_LOG_FILE')
+               if log_file is not None and os.path.isfile(log_file):
+                       # Truncate rather than unlink, so tail -f still works.
                        try:
-                               os.unlink(os.path.join(settings["PORTAGE_BUILDDIR"], x))
+                               open(log_file, 'wb')
                        except OSError:
                                pass