Message ID | cf573e24baadc04da27c471dafee90344e0cb400.1428671643.git.riku.voipio@linaro.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 2015-04-10 15:15, 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. > --- > scripts/package/builddeb | 14 ++++++++++---- > 1 file changed, 10 insertions(+), 4 deletions(-) > > diff --git a/scripts/package/builddeb b/scripts/package/builddeb > index a9858a4..e397815 100755 > --- a/scripts/package/builddeb > +++ b/scripts/package/builddeb > @@ -27,8 +27,15 @@ create_package() { > chown -R root:root "$pdir" > chmod -R go-w "$pdir" > > + # Create the package > + dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" > + dpkg --build "$pdir" .. > +} > + > +set_debarch() { > # Attempt to find the correct Debian architecture > - local forcearch="" debarch="" > + forcearch="" > + debarch="" > case "$UTS_MACHINE" in > i386|ia64|alpha) > debarch="$UTS_MACHINE" ;; > @@ -73,10 +80,8 @@ create_package() { > if [ -n "$debarch" ] ; then > forcearch="-DArchitecture=$debarch" > fi > + export forcearch debarch You do not need to export the variables. But it will improve the readability of the script if you initialize the variables in the toplevel scope. Also, the fallback for empty $debarch is $(dpkg --print-architecture). It makes sense to set it once in the new function. 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
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index a9858a4..e397815 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -27,8 +27,15 @@ create_package() { chown -R root:root "$pdir" chmod -R go-w "$pdir" + # Create the package + dpkg-gencontrol $forcearch -Vkernel:debarch="${debarch:-$(dpkg --print-architecture)}" -p$pname -P"$pdir" + dpkg --build "$pdir" .. +} + +set_debarch() { # Attempt to find the correct Debian architecture - local forcearch="" debarch="" + forcearch="" + debarch="" case "$UTS_MACHINE" in i386|ia64|alpha) debarch="$UTS_MACHINE" ;; @@ -73,10 +80,8 @@ create_package() { if [ -n "$debarch" ] ; then forcearch="-DArchitecture=$debarch" fi + export forcearch 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 +104,7 @@ kernel_headers_packagename=linux-headers-$version libc_headers_packagename=linux-libc-dev dbg_packagename=$packagename-dbg tools_packagename=linux-tools-$version +set_debarch if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version
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. --- scripts/package/builddeb | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)