Logg errors that occur during binpkg extraction.
authorZac Medico <zmedico@gentoo.org>
Fri, 12 Feb 2010 08:41:29 +0000 (08:41 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 12 Feb 2010 08:41:29 +0000 (08:41 -0000)
svn path=/main/trunk/; revision=15343

pym/_emerge/Binpkg.py
pym/_emerge/BinpkgExtractorAsync.py

index 1e39d486161fbb822b447f1d2ed0f63d5e4427b4..a8d07630ba8341440685fe2a6506e68ea9537022 100644 (file)
@@ -15,6 +15,7 @@ from portage import os
 from portage import _encodings
 from portage import _unicode_encode
 import codecs
+import logging
 from portage.output import colorize
 
 class Binpkg(CompositeTask):
@@ -270,15 +271,17 @@ class Binpkg(CompositeTask):
 
                extractor = BinpkgExtractorAsync(background=self.background,
                        image_dir=self._image_dir,
-                       pkg=self.pkg, pkg_path=self._pkg_path, scheduler=self.scheduler)
+                       pkg=self.pkg, pkg_path=self._pkg_path,
+                       logfile=self.settings.get("PORTAGE_LOG_FILE"),
+                       scheduler=self.scheduler)
                self._writemsg_level(">>> Extracting %s\n" % self.pkg.cpv)
                self._start_task(extractor, self._extractor_exit)
 
        def _extractor_exit(self, extractor):
                if self._final_exit(extractor) != os.EX_OK:
                        self._unlock_builddir()
-                       writemsg("!!! Error Extracting '%s'\n" % self._pkg_path,
-                               noiselevel=-1)
+                       self._writemsg_level("!!! Error Extracting '%s'\n" % \
+                               self._pkg_path, noiselevel=-1, level=logging.ERROR)
                self.wait()
 
        def _unlock_builddir(self):
index ae9e7a58b31b3b6433fc672a4cfad914a604e3d2..9e799443d61806c873aca6820cc36dbcaefd94e0 100644 (file)
@@ -18,7 +18,13 @@ class BinpkgExtractorAsync(SpawnProcess):
 
        def _start(self):
                self.args = [self._shell_binary, "-c",
-                       "bzip2 -dqc -- %s | tar -xp -C %s -f -" % \
+                       ("bzip2 -dqc -- %s | tar -xp -C %s -f - ; " + \
+                       "p=(${PIPESTATUS[@]}) ; " + \
+                       "if [ ${p[0]} != 0 ] ; then " + \
+                       "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \
+                       "if [ ${p[1]} != 0 ] ; then " + \
+                       "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \
+                       "exit 0 ;") % \
                        (portage._shell_quote(self.pkg_path),
                        portage._shell_quote(self.image_dir))]