summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-27 16:38:49 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-27 16:38:49 +0100
commite1e04aa80d2f80ef9e79fbe499c8a03f351943d4 (patch)
tree52a7f6ce2c4a1b2a64160d5e98a74cd793b334f2 /script
parent93ff80d96d1c1565c131b43cb2d9247aabac3b03 (diff)
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>
Diffstat (limited to 'script')
-rwxr-xr-xscript/trees9
1 files changed, 7 insertions, 2 deletions
diff --git a/script/trees b/script/trees
index 85fe4a26..50171608 100755
--- a/script/trees
+++ b/script/trees
@@ -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"
@@ -155,7 +155,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
}