Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Tue, 27 Sep 2022 20:28:59
Message-Id: 1664310524.03495541756c55cb7fbe2d9f535c8bd7c64b9c31.mgorny@gentoo
1 commit: 03495541756c55cb7fbe2d9f535c8bd7c64b9c31
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 25 08:28:00 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Sep 27 20:28:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03495541
7
8 unpacker.eclass: Unpack .deb packages on-the-fly as well
9
10 Closes: https://github.com/gentoo/gentoo/pull/27431
11 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
12
13 eclass/unpacker.eclass | 60 +++++++++++++++++++++++++++-----------------------
14 1 file changed, 33 insertions(+), 27 deletions(-)
15
16 diff --git a/eclass/unpacker.eclass b/eclass/unpacker.eclass
17 index 100f11428622..3d23151b636e 100644
18 --- a/eclass/unpacker.eclass
19 +++ b/eclass/unpacker.eclass
20 @@ -273,33 +273,39 @@ unpack_deb() {
21
22 unpack_banner "${deb}"
23
24 - # on AIX ar doesn't work out as their ar used a different format
25 - # from what GNU ar (and thus what .deb files) produce
26 - if [[ -n ${EPREFIX} ]] ; then
27 - {
28 - read # global header
29 - [[ ${REPLY} = "!<arch>" ]] || die "${deb} does not seem to be a deb archive"
30 - local f timestamp uid gid mode size magic
31 - while read f timestamp uid gid mode size magic ; do
32 - [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines
33 - # GNU ar uses / as filename terminator (and .deb permits that)
34 - f=${f%/}
35 - if [[ ${f} = "data.tar"* ]] ; then
36 - head -c "${size}" > "${f}"
37 - else
38 - head -c "${size}" > /dev/null # trash it
39 - fi
40 - done
41 - } < "${deb}"
42 - else
43 - $(tc-getBUILD_AR) x "${deb}" || die
44 - fi
45 -
46 - unpacker ./data.tar*
47 -
48 - # Clean things up #458658. No one seems to actually care about
49 - # these, so wait until someone requests to do something else ...
50 - rm -f debian-binary {control,data}.tar*
51 + {
52 + # on AIX ar doesn't work out as their ar used a different format
53 + # from what GNU ar (and thus what .deb files) produce
54 + if [[ -n ${EPREFIX} ]] ; then
55 + {
56 + read # global header
57 + [[ ${REPLY} = "!<arch>" ]] || die "${deb} does not seem to be a deb archive"
58 + local f timestamp uid gid mode size magic
59 + while read f timestamp uid gid mode size magic ; do
60 + [[ -n ${f} && -n ${size} ]] || continue # ignore empty lines
61 + # GNU ar uses / as filename terminator (and .deb permits that)
62 + f=${f%/}
63 + if [[ ${f} = "data.tar"* ]] ; then
64 + local decomp=$(_unpacker_get_decompressor "${f}")
65 + head -c "${size}" | ${decomp:-cat}
66 + assert "unpacking ${f} from ${deb} failed"
67 + break
68 + else
69 + head -c "${size}" > /dev/null # trash it
70 + fi
71 + done
72 + } < "${deb}"
73 + else
74 + local f=$(
75 + $(tc-getBUILD_AR) t "${deb}" | grep ^data.tar
76 + assert "data not found in ${deb}"
77 + )
78 + local decomp=$(_unpacker_get_decompressor "${f}")
79 + $(tc-getBUILD_AR) p "${deb}" "${f}" | ${decomp:-cat}
80 + assert "unpacking ${f} from ${deb} failed"
81 + fi
82 + } | tar --no-same-owner -x
83 + assert "unpacking ${deb} failed"
84 }
85
86 # @FUNCTION: unpack_cpio