diff mbox

deb-pkg: v2: move setting debarch for a separate function

Message ID 1429191766-13385-1-git-send-email-riku.voipio@linaro.org (mailing list archive)
State New, archived
Headers show

Commit Message

Riku Voipio April 16, 2015, 1:42 p.m. UTC
From: Riku Voipio <riku.voipio@linaro.org>

create_package() function tries to resolve used architecture
for everry package. Split the setting the architecture to a
new function, set_debarch(), called once on startup.

This allows using debarch from other parts of script as
needed.

v2: Follow Michals suggestion on setting variables at
top scope and also setting the fallback $debarch in the
new function

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
---
 scripts/package/builddeb | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Michal Marek April 22, 2015, 2:45 p.m. UTC | #1
On 2015-04-16 15:42, riku.voipio@linaro.org wrote:
> From: Riku Voipio <riku.voipio@linaro.org>
> 
> create_package() function tries to resolve used architecture
> for everry package. Split the setting the architecture to a
> new function, set_debarch(), called once on startup.
> 
> This allows using debarch from other parts of script as
> needed.
> 
> v2: Follow Michals suggestion on setting variables at
> top scope and also setting the fallback $debarch in the
> new function
> 
> Signed-off-by: Riku Voipio <riku.voipio@linaro.org>

Thanks, applied to kbuild.git#misc. But please base your patches on
Linus's or the maintainer's tree next time. Your patch had some
conflicts, because it was based on some non-upstream patches.

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
maximilian attems April 22, 2015, 3:52 p.m. UTC | #2
On Wed, Apr 22, 2015 at 04:45:38PM +0200, Michal Marek wrote:
> On 2015-04-16 15:42, riku.voipio@linaro.org wrote:
> > From: Riku Voipio <riku.voipio@linaro.org>
> > 
> > create_package() function tries to resolve used architecture
> > for everry package. Split the setting the architecture to a
> > new function, set_debarch(), called once on startup.
> > 
> > This allows using debarch from other parts of script as
> > needed.
> > 
> > v2: Follow Michals suggestion on setting variables at
> > top scope and also setting the fallback $debarch in the
> > new function
> > 
> > Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
> 
> Thanks, applied to kbuild.git#misc. But please base your patches on
> Linus's or the maintainer's tree next time. Your patch had some
> conflicts, because it was based on some non-upstream patches.

thanks, acked.

--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index a9858a4..d9b7694 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -27,8 +27,13 @@  create_package() {
 	chown -R root:root "$pdir"
 	chmod -R go-w "$pdir"
 
+	# Create the package
+	dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch}" -p$pname -P"$pdir"
+	dpkg --build "$pdir" ..
+}
+
+set_debarch() {
 	# Attempt to find the correct Debian architecture
-	local forcearch="" debarch=""
 	case "$UTS_MACHINE" in
 	i386|ia64|alpha)
 		debarch="$UTS_MACHINE" ;;
@@ -58,6 +63,7 @@  create_package() {
 		fi
 		;;
 	*)
+		debarch=$(dpkg --print-architecture)
 		echo "" >&2
 		echo "** ** **  WARNING  ** ** **" >&2
 		echo "" >&2
@@ -70,13 +76,8 @@  create_package() {
 	if [ -n "$KBUILD_DEBARCH" ] ; then
 		debarch="$KBUILD_DEBARCH"
 	fi
-	if [ -n "$debarch" ] ; then
-		forcearch="-DArchitecture=$debarch"
-	fi
+	forcearch="-DArchitecture=$debarch"
 
-	# Create the package
-	dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir"
-	dpkg --build "$pdir" ..
 }
 
 # Some variables and settings used throughout the script
@@ -99,6 +100,9 @@  kernel_headers_packagename=linux-headers-$version
 libc_headers_packagename=linux-libc-dev
 dbg_packagename=$packagename-dbg
 tools_packagename=linux-tools-$version
+debarch=
+forcearch=
+set_debarch
 
 if [ "$ARCH" = "um" ] ; then
 	packagename=user-mode-linux-$version