trees: err if target.cfg not given if multi-tree

it was always by design that an error should occur, if a
target.cfg file does not exist on multi-tree projects,
but we previously did not support target.cfg files on
single-tree projects.

single-tree target.cfg support was later added, and it was
done by making target.cfg optional there, but i accidentally
made it optional on multi-tree projects.

in practise, all multi-tree projects included target.cfg,
but this was not being enforced in code.

this patch should fix the issue.

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2
Leah Rowe 2024-06-27 16:38:49 +01:00 committed by Leah Rowe
parent f8d1abf18d
commit 7ee147ed49
1 changed files with 7 additions and 2 deletions

View File

@ -63,7 +63,7 @@ build_projects()
fetch_project_repo; return 0
fi
load_project_config "$cfgsdir" || return 0
load_project_config "$cfgsdir" 0 || return 0
[ -f "$listfile" ] || listfile="" # optional on single-tree
dest_dir="$elfdir"
@ -153,7 +153,12 @@ load_project_config()
eval `setvars "" xarch xlang tree bootstrapargs autoconfargs xtree \
tree_depend makeargs btype`
[ -f "$1/target.cfg" ] || btype="auto"
eval `setcfg "$1/target.cfg" 0`
# target.cfg optional on single-tree so return if missing.
# target.cfg mandatory on multi-tree so err if missing.
_setcfgarg="" && [ $# -gt 1 ] && _setcfgarg="$2"
eval `setcfg "$1/target.cfg" $_setcfgarg`
[ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || \
return 1; return 0
}