Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/
Date: Wed, 04 Oct 2017 07:09:56
Message-Id: 1507100852.26c0a0e31b5150f7ef23b2156b87863e47dd5996.zmedico@gentoo
1 commit: 26c0a0e31b5150f7ef23b2156b87863e47dd5996
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Oct 4 06:07:05 2017 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Oct 4 07:07:32 2017 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=26c0a0e3
7
8 BinpkgExtractorAsync: fix PIPESTATUS error handling
9
10 Fixes: b4b0e6b0aaa1 ("remove trailer when decompressing binary packages")
11
12 pym/_emerge/BinpkgExtractorAsync.py | 18 +++++++++++-------
13 1 file changed, 11 insertions(+), 7 deletions(-)
14
15 diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py
16 index 173845974..07ba2a1b7 100644
17 --- a/pym/_emerge/BinpkgExtractorAsync.py
18 +++ b/pym/_emerge/BinpkgExtractorAsync.py
19 @@ -80,17 +80,21 @@ class BinpkgExtractorAsync(SpawnProcess):
20 # SIGPIPE handling (128 + SIGPIPE) should be compatible with
21 # assert_sigpipe_ok() that's used by the ebuild unpack() helper.
22 self.args = [self._shell_binary, "-c",
23 - ("head -c-%d -- %s | %s | tar -xp %s -C %s -f - ; " + \
24 - "p=(${PIPESTATUS[@]}) ; " + \
25 - "if [[ ${p[0]} != 0 && ${p[0]} != %d ]] ; then " % (128 + signal.SIGPIPE) + \
26 - "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \
27 - "if [ ${p[1]} != 0 ] ; then " + \
28 - "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \
29 + ("cmd0=(head -c-%d -- %s) cmd1=(%s) cmd2=(tar -xp %s -C %s -f -); " + \
30 + '"${cmd0[@]}" | "${cmd1[@]}" | "${cmd2[@]}"; ' + \
31 + "p=(${PIPESTATUS[@]}) ; for i in {0..2}; do " + \
32 + "if [[ ${p[$i]} != 0 && ${p[$i]} != %d ]] ; then " + \
33 + "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \
34 + "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; done; " + \
35 + "if [ ${p[$i]} != 0 ] ; then " + \
36 + "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \
37 + "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; " + \
38 "exit 0 ;") % \
39 (pkg_xpak.xpaksize,
40 portage._shell_quote(self.pkg_path),
41 decomp_cmd,
42 tar_options,
43 - portage._shell_quote(self.image_dir))]
44 + portage._shell_quote(self.image_dir),
45 + 128 + signal.SIGPIPE)]
46
47 SpawnProcess._start(self)