summaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorGuillem Jover <guillem@debian.org>2014-01-23 19:14:11 (GMT)
committerColin Watson <cjwatson@debian.org>2014-05-06 08:33:35 (GMT)
commit6a6cfc012bff779d694ffbad4cba1022c8829a32 (patch)
treebdaaa92cf256b1d5ea90f70e44022953488e1feb /functions
parentc0f8fb8b996b201005686502fe98494638ad59c9 (diff)
downloaddebootstrap-6a6cfc012bff779d694ffbad4cba1022c8829a32.zip
debootstrap-6a6cfc012bff779d694ffbad4cba1022c8829a32.tar.gz
debootstrap-6a6cfc012bff779d694ffbad4cba1022c8829a32.tar.bz2
Add uncompressed and xz control.tar deb member support
These are currently not accepted by the Debian archive, but are supported since dpkg 1.17.6, and they do not incur any additional dependency from the host system. This is mostly for completeness' sake, as Debian base packages with uncompressed or xz control.tar members are probably not going to be used at all.
Diffstat (limited to 'functions')
-rw-r--r--functions18
1 files changed, 15 insertions, 3 deletions
diff --git a/functions b/functions
index 8fc0bee..0d48390 100644
--- a/functions
+++ b/functions
@@ -805,10 +805,22 @@ extract_dpkg_deb_data () {
extract_ar_deb_field () {
local pkg="$1"
local field="$2"
+ local tarball=$(ar -t "$pkg" | grep "^control\.tar")
- ar -p "$pkg" control.tar.gz | zcat |
- tar -O -xf - control ./control 2>/dev/null |
- grep -i "^$field:" | sed -e 's/[^:]*: *//' | head -n 1
+ case "$tarball" in
+ control.tar.gz) cat_cmd=zcat ;;
+ control.tar.xz) cat_cmd=xzcat ;;
+ control.tar) cat_cmd=cat ;;
+ *) error 1 UNKNOWNCONTROLCOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;;
+ esac
+
+ if type $cat_cmd >/dev/null 2>&1; then
+ ar -p "$pkg" "$tarball" | $cat_cmd |
+ tar -O -xf - control ./control 2>/dev/null |
+ grep -i "^$field:" | sed -e 's/[^:]*: *//' | head -n 1
+ else
+ error 1 UNPACKCMDUNVL "Extracting %s requires the %s command, which is not available" "$pkg" "$cat_cmd"
+ fi
}
extract_ar_deb_data () {