From 7ee147ed49aa1c2562dcbbe03a53034f18014aa9 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Thu, 27 Jun 2024 16:38:49 +0100 Subject: [PATCH] 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 --- script/trees | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/script/trees b/script/trees index ffc8651..765813c 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" @@ -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 }