deb-pkg: move setting debarch for a separate function
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> Signed-off-by: Michal Marek <mmarek@suse.cz>
This commit is contained in:
Родитель
92f43c452c
Коммит
dca0c0246f
|
@ -25,8 +25,13 @@ create_package() {
|
||||||
chown -R root:root "$pdir"
|
chown -R root:root "$pdir"
|
||||||
chmod -R go-w "$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
|
# Attempt to find the correct Debian architecture
|
||||||
local forcearch="" debarch=""
|
|
||||||
case "$UTS_MACHINE" in
|
case "$UTS_MACHINE" in
|
||||||
i386|ia64|alpha)
|
i386|ia64|alpha)
|
||||||
debarch="$UTS_MACHINE" ;;
|
debarch="$UTS_MACHINE" ;;
|
||||||
|
@ -47,6 +52,7 @@ create_package() {
|
||||||
arm*)
|
arm*)
|
||||||
debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;;
|
debarch=arm$(grep -q CONFIG_AEABI=y $KCONFIG_CONFIG && echo el || true) ;;
|
||||||
*)
|
*)
|
||||||
|
debarch=$(dpkg --print-architecture)
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
echo "** ** ** WARNING ** ** **" >&2
|
echo "** ** ** WARNING ** ** **" >&2
|
||||||
echo "" >&2
|
echo "" >&2
|
||||||
|
@ -59,13 +65,8 @@ create_package() {
|
||||||
if [ -n "$KBUILD_DEBARCH" ] ; then
|
if [ -n "$KBUILD_DEBARCH" ] ; then
|
||||||
debarch="$KBUILD_DEBARCH"
|
debarch="$KBUILD_DEBARCH"
|
||||||
fi
|
fi
|
||||||
if [ -n "$debarch" ] ; then
|
forcearch="-DArchitecture=$debarch"
|
||||||
forcearch="-DArchitecture=$debarch"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 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
|
# Some variables and settings used throughout the script
|
||||||
|
@ -86,6 +87,9 @@ fwpackagename=linux-firmware-image-$version
|
||||||
kernel_headers_packagename=linux-headers-$version
|
kernel_headers_packagename=linux-headers-$version
|
||||||
libc_headers_packagename=linux-libc-dev
|
libc_headers_packagename=linux-libc-dev
|
||||||
dbg_packagename=$packagename-dbg
|
dbg_packagename=$packagename-dbg
|
||||||
|
debarch=
|
||||||
|
forcearch=
|
||||||
|
set_debarch
|
||||||
|
|
||||||
if [ "$ARCH" = "um" ] ; then
|
if [ "$ARCH" = "um" ] ; then
|
||||||
packagename=user-mode-linux-$version
|
packagename=user-mode-linux-$version
|
||||||
|
|
Загрузка…
Ссылка в новой задаче