[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#739136: debootstrap: Sync deb support with latest dpkg-deb



Package: debootstrap
Version: 1.0.59
Severity: wishlist
Tags: patch

Hi!

When using the fallback code instead of dpkg-deb the implementation
is missing support for uncompressed data.tar and control.tar and
control.tar.xz. Although this should not be needed in Debian for
the base system, it might be needed by downstreams, or when a user
includes a package manually. And I think it does not harm to have
deb support in sync with what dpkg-deb supports.

The attached two patches implement this. Although I've only tested
the functions in isolation, not as part of a debootstrap run with
such packages.

Thanks,
Guillem
From 009dc7588934809654a1eac28d66e323601215f8 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Tue, 30 Jul 2013 18:18:42 +0200
Subject: [PATCH 1/2] Add uncompressed data.tar deb member support

These are currently not accepted by the Debian archive, but have been
supported since dpkg 1.10.24, and they do not incur any additional
dependency from the host system. This is mostly for completeness' sake,
as Debian base packages with uncompressed data.tar members are probably
not going to be used at all.
---
 functions | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/functions b/functions
index 4e3955a..8fc0bee 100644
--- a/functions
+++ b/functions
@@ -813,12 +813,13 @@ extract_ar_deb_field () {
 
 extract_ar_deb_data () {
 	local pkg="$1"
-	local tarball=$(ar -t "$pkg" | grep "^data.tar.[bgx]z")
+	local tarball=$(ar -t "$pkg" | grep "^data.tar")
 
 	case "$tarball" in
 		data.tar.gz) cat_cmd=zcat ;;
 		data.tar.bz2) cat_cmd=bzcat ;;
 		data.tar.xz) cat_cmd=xzcat ;;
+		data.tar) cat_cmd=cat ;;
 		*) error 1 UNKNOWNDATACOMP "Unknown compression type for %s in %s" "$tarball" "$pkg" ;;
 	esac
 
-- 
1.9.0.rc3.244.g3497008

From aa3e446f3f87cec655dd66929c85050f6776c812 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Thu, 23 Jan 2014 20:14:11 +0100
Subject: [PATCH 2/2] 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.
---
 functions | 18 +++++++++++++++---
 1 file 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 () {
-- 
1.9.0.rc3.244.g3497008


Reply to: