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

Bug#649748: linux-2.6: fixes upstream packaging when cross-compiling



Package: linux-2.6
Severity: wishlist
Tags: upstream

Hello,

  I was not sure where to send this patch, better here to Debian community for review.
  I found a bit annoying that using upstream deb-pkg target does not allow me to create
  proper Debian packages when cross compiling, so I have created the following patch
  which attempts to address this issue.


Index: linux-2.6.39.4/scripts/package/builddeb
===================================================================
--- linux-2.6.39.4.orig/scripts/package/builddeb	2011-08-03 20:43:28.000000000 +0100
+++ linux-2.6.39.4/scripts/package/builddeb	2011-11-23 14:02:24.029139514 +0000
@@ -12,21 +12,9 @@
 
 set -e
 
-create_package() {
-	local pname="$1" pdir="$2"
-
-	cp debian/copyright "$pdir/usr/share/doc/$pname/"
-	cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
-	gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
-	sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
-		| xargs -r0 md5sum > DEBIAN/md5sums"
-
-	# Fix ownership and permissions
-	chown -R root:root "$pdir"
-	chmod -R go-w "$pdir"
-
+find_debarch() {
 	# Attempt to find the correct Debian architecture
-	local forcearch="" debarch=""
+	forcearch="" debarch=""
 	case "$UTS_MACHINE" in
 	i386|ia64|alpha)
 		debarch="$UTS_MACHINE" ;;
@@ -54,6 +42,23 @@
 		echo "Please add support for $UTS_MACHINE to ${0} ..." >&2
 		echo "" >&2
 	esac
+}
+
+create_package() {
+	local pname="$1" pdir="$2"
+
+	cp debian/copyright "$pdir/usr/share/doc/$pname/"
+	cp debian/changelog "$pdir/usr/share/doc/$pname/changelog.Debian"
+	gzip -9 "$pdir/usr/share/doc/$pname/changelog.Debian"
+	sh -c "cd '$pdir'; find . -type f ! -path './DEBIAN/*' -printf '%P\0' \
+		| xargs -r0 md5sum > DEBIAN/md5sums"
+
+	# Fix ownership and permissions
+	chown -R root:root "$pdir"
+	chmod -R go-w "$pdir"
+
+	find_debarch
+
 	if [ -n "$KBUILD_DEBARCH" ] ; then
 		debarch="$KBUILD_DEBARCH"
 	fi
@@ -246,7 +251,8 @@
 (cd $srctree; tar -c -f - -T /tmp/files$$) | (cd $destdir; tar -xf -)
 (cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
 rm -f /tmp/files$$ /tmp/objfiles$$
-arch=$(dpkg --print-architecture)
+find_debarch
+arch=$debarch
 
 cat <<EOF >> debian/control
 

  Do you think is sane to send this patch to upstream? In that case, which would be the appropiate
  place to get the proper attention?

-- System Information:
Debian Release: wheezy/sid
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.39-2-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash



Reply to: