summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2022-09-25 10:28:00 +0200
committerMichał Górny <mgorny@gentoo.org>2022-09-27 22:28:44 +0200
commit03495541756c55cb7fbe2d9f535c8bd7c64b9c31 (patch)
tree4372edbbe4ed813e2ae91a89cc476b50b41cabc0 /eclass/unpacker.eclass
parentunpacker.eclass: Fix handling GNU ar archives in handwoven impl (diff)
downloadgentoo-03495541756c55cb7fbe2d9f535c8bd7c64b9c31.tar.gz
gentoo-03495541756c55cb7fbe2d9f535c8bd7c64b9c31.tar.bz2
gentoo-03495541756c55cb7fbe2d9f535c8bd7c64b9c31.zip
unpacker.eclass: Unpack .deb packages on-the-fly as well
Closes: https://github.com/gentoo/gentoo/pull/27431 Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/unpacker.eclass')
-rw-r--r--eclass/unpacker.eclass60
1 files 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} = "!<arch>" ]] || 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} = "!<arch>" ]] || 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