summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2024-06-29 22:02:26 +0100
committerLeah Rowe <leah@libreboot.org>2024-06-29 22:25:54 +0100
commitcfc9f62ffee12c4f4cd9791799f6eac8608a9b76 (patch)
tree41e6d03c752dbd23f23973fd442807808d287de3
parent7bf28352078951e9eb78ec1aa467346031c8628e (diff)
trees: unified handling of source downloads
run it from load_project_config() Signed-off-by: Leah Rowe <leah@libreboot.org>
-rwxr-xr-xscript/trees21
1 files changed, 8 insertions, 13 deletions
diff --git a/script/trees b/script/trees
index 304c7524..1036976e 100755
--- a/script/trees
+++ b/script/trees
@@ -12,7 +12,7 @@ set -u -e
cbmakeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
eval `setvars "" xarch cdir config cmakedir xlang mode makeargs elfdir xtree \
project target target_dir targets tree _f target1 bootstrapargs mkhelper \
- autoconfargs config_name listfile autogenargs btype`
+ autoconfargs config_name listfile autogenargs btype _cmd`
main()
{
@@ -57,11 +57,6 @@ main()
build_project()
{
- if [ "$mode" = "fetch" ]; then
- [ -f "CHANGELOG" ] && return 0
- fetch_project; return 0
- fi
-
load_project_config "$cfgsdir" 0 || return 0
[ -f "$listfile" ] || listfile="" # optional on single-tree
@@ -125,10 +120,6 @@ handle_defconfig()
handle_src_tree()
{
target_dir="$cfgsdir/$target"
- if [ "$mode" = "fetch" ]; then
- [ -f "CHANGELOG" ] && return 1
- fetch_targets; return 1
- fi
load_project_config "$target_dir" || return 1
x_ mkdir -p "$elfdir/$target"
@@ -158,10 +149,14 @@ load_project_config()
# 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`
+ if [ -f "$1/target.cfg" ] || [ -z "$_setcfgarg" ]; then
+ eval `setcfg "$1/target.cfg" $_setcfgarg`
+ fi
+
+ [ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || return 1
- [ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || \
- return 1; return 0
+ [ "$mode" = "fetch" ] || return 0
+ [ -f "CHANGELOG" ] && return 1; fetch_${_cmd#build_}; return 1
}
check_cross_compiler()