Package: dh-kpatches
Version: 0.99.36
Severity: normal
Tags: patch

dpkg --print-installation-architecture is deprecated.
Plase use dpkg-architecure -qDEB_HOST_ARCH instead in apply an unpatch scripts.

In addition, the testing for existence of APPLIED_<arch>_<patch> files and
their creation may be inconsistent because the
`dpkg --print-installation-architecture` value (or
`dpkg-architecure -qDEB_HOST_ARCH`) may be different from the #PATCHARCH#
value, e.g. in the case of building for a sub-architecture, or when using
synonym architecture names (e.g. ppc is synonym to powerpc). But
dh-kpatches cannot handle such cases itself correctly.
So, only one architecture name should be used, preferably the value
returned by `dpkg-architecure -qDEB_HOST_ARCH`, which is in fact set by
make-kpkg. That way, handling synonymous architecture names
and sub-architectures, and therefore choosing correct apply and unpatch
scripts, is dealt with only by make-kpkg.

The attached patch corrects those two problems.

-- System Information:
Debian Release: testing/unstable
  APT prefers unstable
  APT policy: (990, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.15-1-686
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)

Versions of packages dh-kpatches depends on:
ii  debhelper                     5.0.24     helper programs for debian/rules
ii  perl                          5.8.8-2    Larry Wall's Practical Extraction 

dh-kpatches recommends no packages.

-- no debconf information
--- dh-kpatches-0.99.36/dh-kpatches.nw  2005-06-09 07:40:11.000000000 +0900
+++ dh-kpatches-0.99.36-patched/dh-kpatches.nw  2006-03-06 13:05:43.186155360 
+0900
@@ -341,7 +341,7 @@
 
 <<Store necessary info for unpatching>>=
 mkdir -p debian
-cat > 'debian/APPLIED_#PATCHARCH#_#PATCHID#' <<EOF
+cat > 'debian/APPLIED_${ARCHITECTURE}_#PATCHID#' <<EOF
 PATCHFILE='$PATCHFILE'
 STRIPLEVEL='$STRIPLEVEL'
 DEPENDS='$UNPATCHDEPS'
@@ -368,7 +368,7 @@
 chmod +x 'debian/image.d/register-#PATCHID#'
 <<Apply.tmpl constants>>=
 TOPPATCHDIR=/usr/src/kernel-patches
-ARCHITECTURE=`dpkg --print-installation-architecture`
+ARCHITECTURE=`dpkg-architecture -qDEB_HOST_ARCH`
 DECOMPRESSOR="zcat -f"
 PATCH_OPTIONS="--ignore-whitespace --silent"
 # This is informational only, used by lskpatches
@@ -395,14 +395,13 @@
 
 <<Assert this is a kernel tree>>
 
-ARCHITECTURE=`dpkg --print-installation-architecture`
+ARCHITECTURE=`dpkg-architecture -qDEB_HOST_ARCH`
 PATCHID=#PATCHID#
-PATCHARCH=#PATCHARCH#
 
 TOPPATCHDIR=/usr/src/kernel-patches
 DECOMPRESSOR="zcat -f"
 
-STAMP=debian/APPLIED_${PATCHARCH}_$PATCHID
+STAMP=debian/APPLIED_${ARCHITECTURE}_$PATCHID
 
 PATCH_OPTIONS="--ignore-whitespace --silent"
 
@@ -466,7 +465,7 @@
 fi
 @
 <<Do not unpatch if there are still dependants>>=
-if grep -l "^DEPENDS=.*[' ]#PATCHARCH#/unpatch/#PATCHID#[' ]" debian/APPLIED_* 
>/dev/null 2>/dev/null
+if grep -l "^DEPENDS=.*[' ]${ARCHITECTURE}/unpatch/#PATCHID#[' ]" 
debian/APPLIED_* >/dev/null 2>/dev/null
 then
     # There are patches depending on this one, to be removed before.
     # the dep will be removed by the last of those other patches.
@@ -478,7 +477,7 @@
 echo >&2 "START unpatching #PATCHID# patch (#PATCHNAME#)"
 
 $DECOMPRESSOR $PATCHFILE | patch -R -p$STRIPLEVEL $PATCH_OPTIONS
-rm -f debian/APPLIED_${PATCHARCH}_$PATCHID debian/image.d/register-#PATCHID#
+rm -f debian/APPLIED_${ARCHITECTURE}_$PATCHID debian/image.d/register-#PATCHID#
 
 <<Remove those patches we depended on>>
 <<Remove empty files>>
@@ -1026,7 +1025,6 @@
                  " -e 's/#KVERSIONS#/$kversions{$arch}/g'" .
                  " -e 's|#PATCHFILES#|$patchfiles{$arch}|g'" .
                  " -e 's|#DEBPATCHFILES#|$debpatchfiles{$arch}|g'" .
-                 " -e 's/#PATCHARCH#/$arch/g'" .
                  " -e 's/#STRIPLEVELS#/$striplevels{$arch}/g'"
                 );
     doit ("chmod", "0755", "$tmp$pdir/$script/$patchid");

Reply via email to