commit:     2e18650ca6535305920d84c924a14e2c819a15a6
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 16 22:56:37 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Wed Aug 16 23:00:20 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=2e18650c

quickpkg: handle unsuccessful compressor exit in quickpkg_atom

Fixes: cff2c0149142 ("Support different compressors for binary packages")

 bin/quickpkg | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/bin/quickpkg b/bin/quickpkg
index 81d6afa08..faf1eddd4 100755
--- a/bin/quickpkg
+++ b/bin/quickpkg
@@ -163,7 +163,16 @@ def quickpkg_atom(options, infos, arg, eout):
                                with 
tarfile.open(mode="w|",format=tarfile.PAX_FORMAT if xattrs else 
tarfile.DEFAULT_FORMAT, fileobj=proc.stdin) as tar:
                                        tar_contents(contents, root, tar, 
protect=protect, xattrs=xattrs)
                                proc.stdin.close()
-                               proc.wait()
+                               if proc.wait() != os.EX_OK:
+                                       eout.eend(1)
+                                       eout.eerror("Compressor failed for 
package %s" % cpv)
+                                       retval |= 1
+                                       try:
+                                               os.unlink(binpkg_tmpfile)
+                                       except OSError as e:
+                                               if e.errno not in 
(errno.ENOENT, errno.ESTALE):
+                                                       raise
+                                       continue
                        xpak.tbz2(binpkg_tmpfile).recompose_mem(xpdata)
                finally:
                        if have_lock:

Reply via email to