mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
tree.sh: fix globbing in multi-tree command args
this solves a bug that does not yet manifest, because this bug *can't* currently trigger any error due to lbmk's design. this is therefore a preventative fix, for reasons that will become clear. we previously put arguments in a variable, in a way that didn't handle globbing. now we avoid a variable and use "$@" instead, which solves the problem. this also means that the main logic in mk can be cleaner, as trees-specific control logic is now placed entirely in tree.sh's main. this means that we can now also wrap x_ around trees() this was never a problem in the past, because all of the arguments for trees commands never have globbing; config names are always e.g. foo_bar, not foo bar in commands where globbing did need to be handled, those commands were never trees commands. e.g. you had ./mk inject filename yes, this is a design improvement, or a preventative bug fix. pick your poison. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+15
-15
@@ -17,7 +17,7 @@ eval "`newvar autoconfargs autogenargs badhash badtghash bootstrapargs \
|
||||
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
|
||||
forcepull gccdir gccfull gccver gnatdir gnatfull gnatver listfile \
|
||||
makeargs mdir mkhelper mkhelpercfg mode postmake premake project release \
|
||||
rev srcdir target target_dir targets tree xarch xgcctree xlang`"
|
||||
rev srcdir target target_dir tree xarch xgcctree xlang`"
|
||||
|
||||
trees()
|
||||
{
|
||||
@@ -79,7 +79,7 @@ trees()
|
||||
err "missing flag ($flags)" "trees" "$@"
|
||||
elif [ -z "$project" ]; then
|
||||
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
||||
return 1
|
||||
return 0
|
||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||
fi
|
||||
@@ -100,13 +100,15 @@ trees()
|
||||
x_ touch "$mkhelpercfg"
|
||||
fi
|
||||
|
||||
targets="$*"
|
||||
cmd="build_targets $targets"
|
||||
if singletree "$project"; then
|
||||
cmd="build_project"
|
||||
fi
|
||||
cmd="build_project"
|
||||
singletree "$project" || \
|
||||
cmd="build_targets"
|
||||
|
||||
remkdir "${tmpgit%/*}"
|
||||
x_ touch "$mkhelpercfg"
|
||||
|
||||
. "$mkhelpercfg"
|
||||
$cmd "$@"
|
||||
}
|
||||
|
||||
build_project()
|
||||
@@ -131,14 +133,12 @@ build_project()
|
||||
|
||||
build_targets()
|
||||
{
|
||||
if [ ! -d "$configdir" ]; then
|
||||
[ ! -d "$configdir" ] && \
|
||||
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
||||
elif [ $# -lt 1 ]; then
|
||||
targets="$(ls -1 "$configdir")" || \
|
||||
err "'$configdir': can't list targets" "build_targets" "$@"
|
||||
fi
|
||||
|
||||
for x in $targets
|
||||
[ $# -lt 1 ] && \
|
||||
fx_ build_targets find "$configdir" \
|
||||
-mindepth 1 -maxdepth 1 -type d
|
||||
[ $# -gt 0 ] && for x in "$@"
|
||||
do
|
||||
unset CROSS_COMPILE
|
||||
export PATH="$xbmkpath"
|
||||
@@ -151,7 +151,7 @@ build_targets()
|
||||
|
||||
printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$x"
|
||||
|
||||
target="$x"
|
||||
target="${x##*/}"
|
||||
|
||||
x_ handle_defconfig
|
||||
|
||||
|
||||
@@ -41,9 +41,6 @@ shift 1 2>/dev/null || :
|
||||
eval "$(printf "version release download inject\n" | awk '{ for (i=1; i<=NF; \
|
||||
i++) $i = "[ \""$i"\" = \"$_f\" ] && x_ "$i" \"$@\" && exit 0;"; print }')"
|
||||
|
||||
trees "$_f" "$@" || exit 0
|
||||
x_ touch "$mkhelpercfg"
|
||||
. "$mkhelpercfg"
|
||||
$cmd
|
||||
x_ trees "$_f" "$@"
|
||||
|
||||
) || exit 1; :
|
||||
|
||||
Reference in New Issue
Block a user