trees: more robust check to avoid "make fetch"

do not use shorthand here. the test was failing to
produce the desired result under some circumstances,
for example when i did "./update release" i got this:

make: Entering directory '/home/lbdev/lbmk/release/20240612-62-ga6b1a6bd/libreboot-20240612-62-ga6b1a6bd_src/src/stm32-vserprog'
make: *** No rule to make target 'fetch'.  Stop.
make: Leaving directory '/home/lbdev/lbmk/release/20240612-62-ga6b1a6bd/libreboot-20240612-62-ga6b1a6bd_src/src/stm32-vserprog'
ERROR script/trees: !mk src/stm32-vserprog fetch
ERROR ./update: excmd: script/trees -f
ERROR script/roms: Unhandled non-zero exit: ./update
ERROR ./build: excmd: script/roms serprog
ERROR ./update: build_release release/20240612-62-ga6b1a6bd: stm32
ERROR ./update: can't build rom images

in the above circumstance, run_make_command was executed,
which is not the desired behaviour; rather, fetch_project_trees
or fetch_project_repo should be called, and then the script
should immediately exit. it should also exit, without downloading
anything, if a changelog file exists as in release archives.

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit6
Leah Rowe 2024-06-21 03:05:00 +01:00
parent a6b1a6bddb
commit ad1602569e
1 changed files with 8 additions and 4 deletions

View File

@ -58,8 +58,10 @@ build_projects()
{ {
[ $# -gt 0 ] && x_ ./update trees $_f $@ [ $# -gt 0 ] && x_ ./update trees $_f $@
[ "$mode" = "fetch" ] && [ ! -f "CHANGELOG" ] && \ if [ "$mode" = "fetch" ]; then
eval "fetch_project_repo; return 0;" [ -f "CHANGELOG" ] && return 0
fetch_project_repo; return 0
fi
load_project_config "$cfgsdir" load_project_config "$cfgsdir"
[ -f "$listfile" ] || listfile="" # optional on single-tree [ -f "$listfile" ] || listfile="" # optional on single-tree
@ -124,8 +126,10 @@ handle_defconfig()
handle_src_tree() handle_src_tree()
{ {
target_dir="$cfgsdir/$target" target_dir="$cfgsdir/$target"
[ "$mode" = "fetch" ] && [ ! -f "CHANGELOG" ] && \ if [ "$mode" = "fetch" ]; then
eval "fetch_project_trees; return 1;" [ -f "CHANGELOG" ] && return 1
fetch_project_trees; return 1
fi
load_project_config "$target_dir" load_project_config "$target_dir"
x_ mkdir -p "$elfdir/$target" x_ mkdir -p "$elfdir/$target"