mirror of
https://github.com/sipeed/NanoKVM.git
synced 2026-09-11 00:22:56 -05:00
fix(build): correct exit codes in support/sg2002/build
The script has no error handling of its own, so these all pass silently. - update_lib exited 1 after succeeding, so callers could not chain it - a failed maixcdk build printed "Build Error!" and exited 0, letting a caller carry on with no artifacts - add_to_kvmapp did the same when the source did not exist - the copies in update_lib were unchecked; since update_lib is what keeps the SDK components in sync with the source tree, a silent failure there yields libraries built from stale sources
This commit is contained in:
@@ -41,6 +41,10 @@ maixcdk_clean(){
|
|||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
update_lib)
|
update_lib)
|
||||||
|
# This script does not run under "set -e", and a release build relies on
|
||||||
|
# update_lib to guarantee the SDK components match the source tree. A copy
|
||||||
|
# that fails silently here would produce stale libraries, so fail loudly.
|
||||||
|
set -e
|
||||||
cp -rf $NanoKVM_PATH/support/sg2002/additional/kvm $MAIXCDK_PATH/components
|
cp -rf $NanoKVM_PATH/support/sg2002/additional/kvm $MAIXCDK_PATH/components
|
||||||
cp -rf $NanoKVM_PATH/support/sg2002/additional/kvm_mmf $MAIXCDK_PATH/components
|
cp -rf $NanoKVM_PATH/support/sg2002/additional/kvm_mmf $MAIXCDK_PATH/components
|
||||||
cp -rf $NanoKVM_PATH/support/sg2002/additional/vision $MAIXCDK_PATH/components
|
cp -rf $NanoKVM_PATH/support/sg2002/additional/vision $MAIXCDK_PATH/components
|
||||||
@@ -48,7 +52,7 @@ case "$1" in
|
|||||||
cp -f $NanoKVM_PATH/support/sg2002/additional/sophgo-middleware/v2/sample/common/sample_common_sensor.c $MAIXCDK_PATH/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/sample/common/
|
cp -f $NanoKVM_PATH/support/sg2002/additional/sophgo-middleware/v2/sample/common/sample_common_sensor.c $MAIXCDK_PATH/components/3rd_party/sophgo-middleware/sophgo-middleware/v2/sample/common/
|
||||||
|
|
||||||
echo -e "\e[36m[build] \e[32mupdate_lib ok!\e[0m"
|
echo -e "\e[36m[build] \e[32mupdate_lib ok!\e[0m"
|
||||||
exit 1
|
exit 0
|
||||||
;;
|
;;
|
||||||
kvm_system)
|
kvm_system)
|
||||||
Project_Name="kvm_system"
|
Project_Name="kvm_system"
|
||||||
@@ -138,6 +142,7 @@ then
|
|||||||
echo -e "\e[36m[build] \e[32mBuild completed! Use \e[34m./build $Project_Name add_to_kvmapp\e[32m to add it to kvmapp.\e[0m"
|
echo -e "\e[36m[build] \e[32mBuild completed! Use \e[34m./build $Project_Name add_to_kvmapp\e[32m to add it to kvmapp.\e[0m"
|
||||||
else
|
else
|
||||||
echo -e "\e[36m[build] \e[31mBuild Error!\e[0m"
|
echo -e "\e[36m[build] \e[31mBuild Error!\e[0m"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
clean)
|
clean)
|
||||||
@@ -171,6 +176,7 @@ then
|
|||||||
|
|
||||||
else
|
else
|
||||||
echo -e "\e[36m[build] \e[31mThe source file does not exist. Please compile using \e[34m./build kvm_system \e[31mfirst.\e[0m"
|
echo -e "\e[36m[build] \e[31mThe source file does not exist. Please compile using \e[34m./build kvm_system \e[31mfirst.\e[0m"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
Reference in New Issue
Block a user