Bug#757013: crosshurd: Update deb(5) format support
Package: crosshurd
Version: 1.7.46
Severity: wishlist
Tags: patch
Hi!
As part of an effort [S] to try to get as much tools to understand
the current .deb format (see deb(5)), I'm attaching a patch series
updating the crosshurd code accessing the .deb archives.
[S] <https://wiki.debian.org/Teams/Dpkg/DebSupport>
I've only tested running crosshurd for the hurd, but not the second
stage (running native-install), as I don't have a setup ready for this
right now.
(I'm including two other patches that update the dpkg and dpkg-deb
usage, strictly speaking not necessary for the .deb format support
though, just cleanup on the way.)
Thanks,
Guillem
From acfa29c106e43aba8a55e8c3ce9d6d65110cce72 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Mon, 4 Aug 2014 14:14:52 +0200
Subject: [PATCH 2/4] Use dpkg-deb instead of manually extracting the deb
packages
There is no point in accessing the .deb files manually, we are assuming
dpkg-deb, dpkg and apt to be around anyway.
This automatically gives support for the latest deb(5) format.
---
functions | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/functions b/functions
index 1e1f885..3fe312f 100644
--- a/functions
+++ b/functions
@@ -43,12 +43,7 @@ extract () { (
p="$(($p + 1))"
progress "$p" "$#" "Extracting packages"
info "Extracting $pkg..."
- if ar -t ./$pkg | grep -q data.tar.gz
- then
- ar -p ./$pkg data.tar.gz | zcat | tar -xf -
- else
- ar -p ./$pkg data.tar.xz | xzcat | tar -xf -
- fi
+ dpkg-deb --extract ./$pkg .
done
sync
); }
@@ -74,11 +69,7 @@ apt_debfor () {
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
- local ver="$(
- ar -p "$TARGET/$deb" control.tar.gz | zcat |
- tar -O -xf - control ./control 2>/dev/null |
- sed -ne 's/^Version: *//Ip' | head -n 1
- )"
+ local ver="$(dpkg-deb --field "$TARGET/$deb" Version)"
mkdir -p "$TARGET/var/lib/dpkg/info"
--
2.0.1.570.gc6b0718
From b6bbcc6292a13ebb48d1f2705094f5e48eada15e Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Mon, 4 Aug 2014 14:17:05 +0200
Subject: [PATCH 3/4] Use dpkg-deb --field instead of parsing dpkg-deb -I
output
---
dpkg-hurd | 2 +-
makehurddir.sh | 2 +-
native-install/native-install | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dpkg-hurd b/dpkg-hurd
index b764744..449c726 100755
--- a/dpkg-hurd
+++ b/dpkg-hurd
@@ -77,7 +77,7 @@ case ${1} in
action="${1}"
file="${2}"
- name=`dpkg --info ${file} | grep '^ Package:' - | sed -e "s/ Package: //"`
+ name=`dpkg-deb --field ${file} Package`
[ -f ${file} ] || err "file \`${file}' does not exist"
diff --git a/makehurddir.sh b/makehurddir.sh
index 4f3670e..d29d881 100755
--- a/makehurddir.sh
+++ b/makehurddir.sh
@@ -33,7 +33,7 @@ if [ $retval != 0 ]; then
fi
extract `(cd $TARGET/var/cache/apt/archives && \
- for i in *.deb; do dpkg --info $i | grep ^\ Priority:.required \
+ for i in *.deb; do dpkg-deb --field $i Priority | grep ^required \
&& echo $i; done) | cut -d _ -f 1`
if [ -e $TARGET/var/cache/apt/archives/gnumach-image-1.4-486_* ] ; then
diff --git a/native-install/native-install b/native-install/native-install
index 4e935c8..21dc92c 100755
--- a/native-install/native-install
+++ b/native-install/native-install
@@ -149,7 +149,7 @@ fi
# install required packages
for i in /var/cache/apt/archives/*.deb ; do
- dpkg --info $i | grep ^\ Priority:.required > /dev/null \
+ dpkg-deb --field $i Priority | grep ^required > /dev/null \
&& dpkg --force-depends --skip-same-version --unpack $i
done
dpkg --force-depends --skip-same-version --unpack /var/cache/apt/archives/insserv_*.deb
--
2.0.1.570.gc6b0718
From 91272b0a89964aa8ac2c73ae8716b2b8b9f90c24 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Mon, 4 Aug 2014 14:17:36 +0200
Subject: [PATCH 4/4] Use dpkg-deb --build instead of dpkg --build
We avoid the wrapper.
---
dpkg-hurd | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dpkg-hurd b/dpkg-hurd
index 449c726..5aa693b 100755
--- a/dpkg-hurd
+++ b/dpkg-hurd
@@ -100,7 +100,7 @@ case ${1} in
done
# Now repack the file.
- dpkg --build temp_build/${name}
+ dpkg-deb --build temp_build/${name}
# Move old prerm and postrm scripts out of the way.
for f in prerm postrm
--
2.0.1.570.gc6b0718
Reply to: