From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 60EF7158094 for ; Sun, 25 Sep 2022 18:27:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B04D12BC0FE; Sun, 25 Sep 2022 18:23:39 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 719E62BC0FB for ; Sun, 25 Sep 2022 18:23:39 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 15/15] unpacker.eclass: Unpack .deb packages on-the-fly as well Date: Sun, 25 Sep 2022 20:23:17 +0200 Message-Id: <20220925182317.1559529-16-mgorny@gentoo.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220925182317.1559529-1-mgorny@gentoo.org> References: <20220925182317.1559529-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 1061a051-4181-408c-a02e-e0249b0d7903 X-Archives-Hash: aad4ac94ca0b113135fc436d2220366b Signed-off-by: Michał Górny --- eclass/unpacker.eclass | 60 +++++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 27 deletions(-) diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass index 100f11428622..3d23151b636e 100644 --- a/eclass/unpacker.eclass +++ b/eclass/unpacker.eclass @@ -273,33 +273,39 @@ unpack_deb() { unpack_banner "${deb}" - # on AIX ar doesn't work out as their ar used a different format - # from what GNU ar (and thus what .deb files) produce - if [[ -n ${EPREFIX} ]] ; then - { - read # global header - [[ ${REPLY} = "!" ]] || die "${deb} does not seem to be a deb archive" - local f timestamp uid gid mode size magic - while read f timestamp uid gid mode size magic ; do - [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines - # GNU ar uses / as filename terminator (and .deb permits that) - f=${f%/} - if [[ ${f} = "data.tar"* ]] ; then - head -c "${size}" > "${f}" - else - head -c "${size}" > /dev/null # trash it - fi - done - } < "${deb}" - else - $(tc-getBUILD_AR) x "${deb}" || die - fi - - unpacker ./data.tar* - - # Clean things up #458658. No one seems to actually care about - # these, so wait until someone requests to do something else ... - rm -f debian-binary {control,data}.tar* + { + # on AIX ar doesn't work out as their ar used a different format + # from what GNU ar (and thus what .deb files) produce + if [[ -n ${EPREFIX} ]] ; then + { + read # global header + [[ ${REPLY} = "!" ]] || die "${deb} does not seem to be a deb archive" + local f timestamp uid gid mode size magic + while read f timestamp uid gid mode size magic ; do + [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines + # GNU ar uses / as filename terminator (and .deb permits that) + f=${f%/} + if [[ ${f} = "data.tar"* ]] ; then + local decomp=$(_unpacker_get_decompressor "${f}") + head -c "${size}" | ${decomp:-cat} + assert "unpacking ${f} from ${deb} failed" + break + else + head -c "${size}" > /dev/null # trash it + fi + done + } < "${deb}" + else + local f=$( + $(tc-getBUILD_AR) t "${deb}" | grep ^data.tar + assert "data not found in ${deb}" + ) + local decomp=$(_unpacker_get_decompressor "${f}") + $(tc-getBUILD_AR) p "${deb}" "${f}" | ${decomp:-cat} + assert "unpacking ${f} from ${deb} failed" + fi + } | tar --no-same-owner -x + assert "unpacking ${deb} failed" } # @FUNCTION: unpack_cpio -- 2.37.3