Gentoo Archives: gentoo-commits

From: Arfrever Frehtes Taifersar Arahesis <Arfrever@××××××.Org>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/_emerge/
Date: Fri, 27 Dec 2013 18:06:58
Message-Id: 1388167570.0331526698e485508a1040d24acca5f5eff1c3f3.arfrever@gentoo
1 commit: 0331526698e485508a1040d24acca5f5eff1c3f3
2 Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
3 AuthorDate: Fri Dec 27 18:06:10 2013 +0000
4 Commit: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
5 CommitDate: Fri Dec 27 18:06:10 2013 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=03315266
7
8 Bug #496134: Preserve extended attributes in binary packages.
9
10 ---
11 bin/misc-functions.sh | 1 +
12 pym/_emerge/Binpkg.py | 1 +
13 pym/_emerge/BinpkgExtractorAsync.py | 15 ++++++++++++---
14 3 files changed, 14 insertions(+), 3 deletions(-)
15
16 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
17 index 2c4d248..5ccf7c2 100755
18 --- a/bin/misc-functions.sh
19 +++ b/bin/misc-functions.sh
20 @@ -1166,6 +1166,7 @@ __dyn_package() {
21
22 local tar_options=""
23 [[ $PORTAGE_VERBOSE = 1 ]] && tar_options+=" -v"
24 + has xattr ${FEATURES} && [[ $(tar --help 2> /dev/null) == *--xattrs* ]] && tar_options+=" --xattrs"
25 # Sandbox is disabled in case the user wants to use a symlink
26 # for $PKGDIR and/or $PKGDIR/All.
27 export SANDBOX_ON="0"
28
29 diff --git a/pym/_emerge/Binpkg.py b/pym/_emerge/Binpkg.py
30 index 36f8516..a740efd 100644
31 --- a/pym/_emerge/Binpkg.py
32 +++ b/pym/_emerge/Binpkg.py
33 @@ -298,6 +298,7 @@ class Binpkg(CompositeTask):
34
35 extractor = BinpkgExtractorAsync(background=self.background,
36 env=self.settings.environ(),
37 + features=self.settings.features,
38 image_dir=self._image_dir,
39 pkg=self.pkg, pkg_path=self._pkg_path,
40 logfile=self.settings.get("PORTAGE_LOG_FILE"),
41
42 diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py
43 index f25cbf9..be74c2f 100644
44 --- a/pym/_emerge/BinpkgExtractorAsync.py
45 +++ b/pym/_emerge/BinpkgExtractorAsync.py
46 @@ -1,23 +1,31 @@
47 -# Copyright 1999-2011 Gentoo Foundation
48 +# Copyright 1999-2013 Gentoo Foundation
49 # Distributed under the terms of the GNU General Public License v2
50
51 from _emerge.SpawnProcess import SpawnProcess
52 import portage
53 import signal
54 +import subprocess
55
56 class BinpkgExtractorAsync(SpawnProcess):
57
58 - __slots__ = ("image_dir", "pkg", "pkg_path")
59 + __slots__ = ("features", "image_dir", "pkg", "pkg_path")
60
61 _shell_binary = portage.const.BASH_BINARY
62
63 def _start(self):
64 + tar_options = ""
65 + if "xattr" in self.features:
66 + process = subprocess.Popen(["tar", "--help"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
67 + output = process.communicate()[0]
68 + if b"--xattrs" in output:
69 + tar_options = "--xattrs"
70 +
71 # Add -q to bzip2 opts, in order to avoid "trailing garbage after
72 # EOF ignored" warning messages due to xpak trailer.
73 # SIGPIPE handling (128 + SIGPIPE) should be compatible with
74 # assert_sigpipe_ok() that's used by the ebuild unpack() helper.
75 self.args = [self._shell_binary, "-c",
76 - ("${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -cq -- %s | tar -xp -C %s -f - ; " + \
77 + ("${PORTAGE_BUNZIP2_COMMAND:-${PORTAGE_BZIP2_COMMAND} -d} -cq -- %s | tar -xp %s -C %s -f - ; " + \
78 "p=(${PIPESTATUS[@]}) ; " + \
79 "if [[ ${p[0]} != 0 && ${p[0]} != %d ]] ; then " % (128 + signal.SIGPIPE) + \
80 "echo bzip2 failed with status ${p[0]} ; exit ${p[0]} ; fi ; " + \
81 @@ -25,6 +33,7 @@ class BinpkgExtractorAsync(SpawnProcess):
82 "echo tar failed with status ${p[1]} ; exit ${p[1]} ; fi ; " + \
83 "exit 0 ;") % \
84 (portage._shell_quote(self.pkg_path),
85 + tar_options,
86 portage._shell_quote(self.image_dir))]
87
88 SpawnProcess._start(self)