don't use build.list to detect multi-tree projects

instead, check for the presence of target.cfg files
not in config/project/ but config/project/tree/

the way this check is done, it merely returns 1 if
config/project/*/target.cfg is detected, and returns
0 in all other cases, even if config/project/target.cfg
exists

that way, if the maintainer accidentally adds a
target.cfg in the main directory, the given multi-tree
project will not break

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2-merge1
Leah Rowe 2024-06-06 01:01:22 +01:00 committed by Leah Rowe
parent 878056f37b
commit a61794dfca
3 changed files with 12 additions and 5 deletions

5
build
View File

@ -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 .
}

View File

@ -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
}

View File

@ -39,7 +39,7 @@ main()
remkdir "${tmpgit%/*}"
_cmd="build_projects"
[ -f "config/$project/build.list" ] && _cmd="build_targets"
singletree "$project" || _cmd="build_targets"
$_cmd $@
}