diff --git a/build b/build index 420276c..8745b8a 100755 --- a/build +++ b/build @@ -112,10 +112,7 @@ fetch_trees() { for x in $(items config/git); do ./update trees -f "$x" || $err "$_xm: fetch $x" - done - for x in config/*/build.list; do - [ -f "$x" ] && xp="${x#*/}" && xp="${xp%/*}" - [ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp" + singletree "$x" || x_ rm -Rf "src/$x/$x" done rmgit . } diff --git a/include/lib.sh b/include/lib.sh index 6a4be7e..bc2232a 100755 --- a/include/lib.sh +++ b/include/lib.sh @@ -228,3 +228,13 @@ e() eval "$estr" printf "%s %s\n" "$1" "$es2" 1>&2 } + +# return 0 if project is single-tree, otherwise 1 +# e.g. coreboot is multi-tree, so 1 +singletree() +{ + for pdir in "config/${1}/"*/target.cfg; do + [ ! -e "$pdir" ] && continue + [ -f "$pdir" ] && return 1 + done +} diff --git a/script/trees b/script/trees index 4086318..494fc8d 100755 --- a/script/trees +++ b/script/trees @@ -39,7 +39,7 @@ main() remkdir "${tmpgit%/*}" _cmd="build_projects" - [ -f "config/$project/build.list" ] && _cmd="build_targets" + singletree "$project" || _cmd="build_targets" $_cmd $@ }