trees: handle all projects if project undefined

e.g. ./update trees -f

if passed, this command would download every tree

similarly, the -c option can be used in this way. this
solves a longstanding issue: on the current, much more
efficient design, it was not possible to systematically
clean every project.

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2
Leah Rowe 2024-06-30 21:31:01 +01:00 committed by Leah Rowe
parent ff00073666
commit bdf43e07cf
2 changed files with 8 additions and 12 deletions

12
build
View File

@ -87,7 +87,8 @@ build_release()
{ {
( (
cd "$srcdir" || $err "$vdir: !cd \"$srcdir\"" cd "$srcdir" || $err "$vdir: !cd \"$srcdir\""
fetch_trees ./update trees -f
rmgit .
x_ mv src/docs docs x_ mv src/docs docs
) || $err "can't create release files" ) || $err "can't create release files"
@ -114,15 +115,6 @@ build_release()
rm -Rf "$srcdir" || $err "!rm -Rf $srcdir" rm -Rf "$srcdir" || $err "!rm -Rf $srcdir"
} }
fetch_trees()
{
for x in $(ls -1 config/git); do
./update trees -f "$x" || $err "$vdir: fetch $x"
singletree "$x" || x_ rm -Rf "src/$x/$x"
done
rmgit .
}
fail() fail()
{ {
tmp_cleanup || printf "WARNING: can't rm tmpfiles: %s\n" "$TMPDIR" 1>&2 tmp_cleanup || printf "WARNING: can't rm tmpfiles: %s\n" "$TMPDIR" 1>&2

View File

@ -31,11 +31,15 @@ main()
-n) mode="nconfig" ;; -n) mode="nconfig" ;;
*) $err "invalid option '-$option'" ;; *) $err "invalid option '-$option'" ;;
esac esac
[ -n "${OPTARG+x}" ] || $err "OPTARG not set" [ -z "${OPTARG+x}" ] && shift 1 && break
project="${OPTARG#src/}"; shift 2 project="${OPTARG#src/}"; shift 2
done done
[ -z "$_f" ] && $err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)" [ -z "$_f" ] && $err "missing flag (-m/-u/-b/-c/-x/-f/-s/-l/-n)"
[ -z "$project" ] && $err "project name not specified" [ -z "$project" ] && for p in $(ls -1 config/git); do
./update trees $_f "$p" || $err "!./update trees $_f $p"
[ "$XBMK_RELEASE" != "y" ] || singletree "$p" || \
x_ rm Rf "src/$p/$p"; continue
done && return 0
[ -f "config/git/$project/pkg.cfg" ] || $err "'$project' not defined" [ -f "config/git/$project/pkg.cfg" ] || $err "'$project' not defined"