Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/_emerge/, pym/portage/package/ebuild/
Date: Wed, 02 May 2018 01:56:14
Message-Id: 1525225743.2b40f119d4334bd3d4bcd2824f575700963b40ef.zmedico@gentoo
1 commit: 2b40f119d4334bd3d4bcd2824f575700963b40ef
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 2 01:27:30 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed May 2 01:49:03 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2b40f119
7
8 BINPKG_COMPRESS: allow empty setting to disable compression (bug 654456)
9
10 In some cases it might make sense to disable compression, so
11 allow an empty setting to disable compression (consistent with
12 PORTAGE_COMPRESS).
13
14 Bug: https://bugs.gentoo.org/654456
15
16 bin/misc-functions.sh | 2 +-
17 bin/quickpkg | 11 +++++++++--
18 pym/_emerge/BinpkgExtractorAsync.py | 16 ++++++++++++----
19 pym/portage/package/ebuild/doebuild.py | 6 +++++-
20 4 files changed, 27 insertions(+), 8 deletions(-)
21
22 diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh
23 index a6330ee93..0648e6cfd 100755
24 --- a/bin/misc-functions.sh
25 +++ b/bin/misc-functions.sh
26 @@ -481,7 +481,7 @@ __dyn_package() {
27 [ -z "${PORTAGE_COMPRESSION_COMMAND}" ] && \
28 die "PORTAGE_COMPRESSION_COMMAND is unset"
29 tar $tar_options -cf - $PORTAGE_BINPKG_TAR_OPTS -C "${D}" . | \
30 - $PORTAGE_COMPRESSION_COMMAND -c > "$PORTAGE_BINPKG_TMPFILE"
31 + $PORTAGE_COMPRESSION_COMMAND > "$PORTAGE_BINPKG_TMPFILE"
32 assert "failed to pack binary package: '$PORTAGE_BINPKG_TMPFILE'"
33 PYTHONPATH=${PORTAGE_PYTHONPATH:-${PORTAGE_PYM_PATH}} \
34 "${PORTAGE_PYTHON:-/usr/bin/python}" "$PORTAGE_BIN_PATH"/xpak-helper.py recompose \
35
36 diff --git a/bin/quickpkg b/bin/quickpkg
37 index ec6f50409..9765ec717 100755
38 --- a/bin/quickpkg
39 +++ b/bin/quickpkg
40 @@ -142,8 +142,15 @@ def quickpkg_atom(options, infos, arg, eout):
41 try:
42 compression = _compressors[binpkg_compression]
43 except KeyError as e:
44 - eout.eerror("Invalid or unsupported compression method: %s" % e.args[0])
45 - return 1
46 + if binpkg_compression:
47 + eout.eerror("Invalid or unsupported compression method: %s" % e.args[0])
48 + return 1
49 + # Empty BINPKG_COMPRESS disables compression.
50 + binpkg_compression = 'none'
51 + compression = {
52 + 'compress': 'cat',
53 + 'package': 'sys-apps/coreutils',
54 + }
55 try:
56 compression_binary = shlex_split(varexpand(compression["compress"], mydict=settings))[0]
57 except IndexError as e:
58
59 diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py
60 index 4468efde6..3733bdeb5 100644
61 --- a/pym/_emerge/BinpkgExtractorAsync.py
62 +++ b/pym/_emerge/BinpkgExtractorAsync.py
63 @@ -17,6 +17,8 @@ from portage.util import (
64 )
65 import signal
66 import subprocess
67 +import tarfile
68 +
69
70 class BinpkgExtractorAsync(SpawnProcess):
71
72 @@ -38,6 +40,13 @@ class BinpkgExtractorAsync(SpawnProcess):
73 decomp = _compressors.get(compression_probe(self.pkg_path))
74 if decomp is not None:
75 decomp_cmd = decomp.get("decompress")
76 + elif tarfile.is_tarfile(portage._unicode_encode(self.pkg_path,
77 + encoding=portage._encodings['fs'], errors='strict')):
78 + decomp_cmd = 'cat'
79 + decomp = {
80 + 'compress': 'cat',
81 + 'package': 'sys-apps/coreutils',
82 + }
83 else:
84 decomp_cmd = None
85 if decomp_cmd is None:
86 @@ -56,16 +65,15 @@ class BinpkgExtractorAsync(SpawnProcess):
87
88 if find_binary(decompression_binary) is None:
89 # Try alternative command if it exists
90 - if _compressors.get(compression_probe(self.pkg_path)).get("decompress_alt"):
91 - decomp_cmd = _compressors.get(
92 - compression_probe(self.pkg_path)).get("decompress_alt")
93 + if decomp.get("decompress_alt"):
94 + decomp_cmd = decomp.get("decompress_alt")
95 try:
96 decompression_binary = shlex_split(varexpand(decomp_cmd, mydict=self.env))[0]
97 except IndexError:
98 decompression_binary = ""
99
100 if find_binary(decompression_binary) is None:
101 - missing_package = _compressors.get(compression_probe(self.pkg_path)).get("package")
102 + missing_package = decomp.get("package")
103 self.scheduler.output("!!! %s\n" %
104 _("File compression unsupported %s.\n Command was: %s.\n Maybe missing package: %s") %
105 (self.pkg_path, varexpand(decomp_cmd, mydict=self.env), missing_package), log_path=self.logfile,
106
107 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
108 index 0dabafeb7..31b552ff3 100644
109 --- a/pym/portage/package/ebuild/doebuild.py
110 +++ b/pym/portage/package/ebuild/doebuild.py
111 @@ -534,7 +534,11 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
112 try:
113 compression = _compressors[binpkg_compression]
114 except KeyError as e:
115 - writemsg("Warning: Invalid or unsupported compression method: %s" % e.args[0])
116 + if binpkg_compression:
117 + writemsg("Warning: Invalid or unsupported compression method: %s" % e.args[0])
118 + else:
119 + # Empty BINPKG_COMPRESS disables compression.
120 + mysettings['PORTAGE_COMPRESSION_COMMAND'] = 'cat'
121 else:
122 try:
123 compression_binary = shlex_split(varexpand(compression["compress"], mydict=settings))[0]