From c16e853471356d992b7fdf86259e9d5cbfe79e08 Mon Sep 17 00:00:00 2001 From: Andrew Jeddeloh Date: Tue, 7 Nov 2017 11:23:39 -0800 Subject: [PATCH] sys-apps/portage: backport compression fixes Portage did not strip the xpak trailer off .tbz2 files, which caused it to fail when using compression methods other than bzip. Backport the fixes for this. --- ....8-0002-backport-decompression-fixes.patch | 42 +++++++++++++++++++ .../sys-apps/portage/portage-2.3.8.ebuild | 2 + 2 files changed, 44 insertions(+) create mode 100644 sdk_container/src/third_party/coreos-overlay/sys-apps/portage/files/portage-2.3.8-0002-backport-decompression-fixes.patch diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/files/portage-2.3.8-0002-backport-decompression-fixes.patch b/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/files/portage-2.3.8-0002-backport-decompression-fixes.patch new file mode 100644 index 0000000000..ab51430792 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/files/portage-2.3.8-0002-backport-decompression-fixes.patch @@ -0,0 +1,42 @@ +diff --git a/pym/_emerge/BinpkgExtractorAsync.py b/pym/_emerge/BinpkgExtractorAsync.py +index e85f4ecac..07ba2a1b7 100644 +--- a/pym/_emerge/BinpkgExtractorAsync.py ++++ b/pym/_emerge/BinpkgExtractorAsync.py +@@ -74,21 +74,27 @@ class BinpkgExtractorAsync(SpawnProcess): + self._async_wait() + return + +- # Add -q to decomp_cmd opts, in order to avoid "trailing garbage +- # after EOF ignored" warning messages due to xpak trailer. ++ pkg_xpak = portage.xpak.tbz2(self.pkg_path) ++ pkg_xpak.scan() ++ + # SIGPIPE handling (128 + SIGPIPE) should be compatible with + # assert_sigpipe_ok() that's used by the ebuild unpack() helper. + self.args = [self._shell_binary, "-c", +- ("%s -cq -- %s | tar -xp %s -C %s -f - ; " + \ +- "p=(${PIPESTATUS[@]}) ; " + \ +- "if [[ ${p[0]} != 0 && ${p[0]} != %d ]] ; then " % (128 + signal.SIGPIPE) + \ +- "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 ; " + \ ++ ("cmd0=(head -c-%d -- %s) cmd1=(%s) cmd2=(tar -xp %s -C %s -f -); " + \ ++ '"${cmd0[@]}" | "${cmd1[@]}" | "${cmd2[@]}"; ' + \ ++ "p=(${PIPESTATUS[@]}) ; for i in {0..2}; do " + \ ++ "if [[ ${p[$i]} != 0 && ${p[$i]} != %d ]] ; then " + \ ++ "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \ ++ "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; done; " + \ ++ "if [ ${p[$i]} != 0 ] ; then " + \ ++ "echo command $(eval \"echo \\\"'\\${cmd$i[*]}'\\\"\") " + \ ++ "failed with status ${p[$i]} ; exit ${p[$i]} ; fi ; " + \ + "exit 0 ;") % \ +- (decomp_cmd, ++ (pkg_xpak.xpaksize, + portage._shell_quote(self.pkg_path), ++ decomp_cmd, + tar_options, +- portage._shell_quote(self.image_dir))] ++ portage._shell_quote(self.image_dir), ++ 128 + signal.SIGPIPE)] + + SpawnProcess._start(self) diff --git a/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/portage-2.3.8.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/portage-2.3.8.ebuild index f1fb822cda..dfc7c873c7 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/portage-2.3.8.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-apps/portage/portage-2.3.8.ebuild @@ -79,6 +79,8 @@ SRC_URI="mirror://gentoo/${PN}-${TARBALL_PV}.tar.bz2 $(prefix_src_archives ${PN}-${TARBALL_PV}.tar.bz2)" PATCHES=( + # fixed upstream in 2.3.12 and up. Backports upstream commits b4b0e6b0aa and 26c0a0e31b. + "${FILESDIR}/${PN}-2.3.8-0002-backport-decompression-fixes.patch" # upstream bug: https://bugs.gentoo.org/507284 "${FILESDIR}/${PN}-2.3.8-0001-portage-repository-config.py-add-disabled-attribute-.patch" # upstream bug: https://bugs.gentoo.org/490014