trees: auto-delete+auto-rebuild if project changes
actual source code is not scanned, but config directories are scanned. simply get the checksum of each file under config/ pertaining to a given project/tree, and also for the given target. coreboot utilities are also handled. if it changes, in any way, delete and re-build automatically. such deletions should probably still be done manually, as part of understanding the build system, but this change should make the build system much easier to use during development. Signed-off-by: Leah Rowe <leah@libreboot.org>audit6
parent
4438368c0c
commit
0b9cd77fe7
|
@ -32,3 +32,4 @@
|
||||||
/CHANGELOG
|
/CHANGELOG
|
||||||
/todo.txt
|
/todo.txt
|
||||||
/lock
|
/lock
|
||||||
|
/hash/
|
||||||
|
|
1
build
1
build
|
@ -100,6 +100,7 @@ build_release()
|
||||||
cd "$srcdir" || $err "$vdir: !cd \"$srcdir\""
|
cd "$srcdir" || $err "$vdir: !cd \"$srcdir\""
|
||||||
./update trees -f
|
./update trees -f
|
||||||
rmgit .
|
rmgit .
|
||||||
|
x_ rm -Rf hash repo
|
||||||
x_ mv src/docs docs
|
x_ mv src/docs docs
|
||||||
) || $err "can't create release files"
|
) || $err "can't create release files"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
# Copyright (c) 2020-2021,2023-2024 Leah Rowe <leah@libreboot.org>
|
# Copyright (c) 2020-2021,2023-2024 Leah Rowe <leah@libreboot.org>
|
||||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||||
|
|
||||||
eval `setvars "" loc url bkup_url subfile mdir subhash subrepo subrepo_bkup \
|
eval `setvars "" loc url bkup_url subfile subhash subrepo subrepo_bkup \
|
||||||
depend subfile_bkup`
|
depend subfile_bkup`
|
||||||
|
|
||||||
fetch_targets()
|
fetch_targets()
|
||||||
|
@ -69,9 +69,6 @@ git_prep()
|
||||||
|
|
||||||
prep_submodules()
|
prep_submodules()
|
||||||
{
|
{
|
||||||
mdir="$PWD/config/submodule/$project"
|
|
||||||
[ -n "$tree" ] && mdir="$mdir/$tree"
|
|
||||||
|
|
||||||
[ -f "$mdir/module.list" ] && while read -r msrcdir; do
|
[ -f "$mdir/module.list" ] && while read -r msrcdir; do
|
||||||
fetch_submodule "$msrcdir"
|
fetch_submodule "$msrcdir"
|
||||||
done < "$mdir/module.list"; return 0
|
done < "$mdir/module.list"; return 0
|
||||||
|
|
|
@ -53,6 +53,8 @@ mkvendorfiles()
|
||||||
check_coreboot_utils()
|
check_coreboot_utils()
|
||||||
{
|
{
|
||||||
for util in cbfstool ifdtool; do
|
for util in cbfstool ifdtool; do
|
||||||
|
[ "$badhash" = "n" ] || rm -f "elf/$util/$1/$util" || \
|
||||||
|
$err "!rm badelf elf/$util/$1/$util"
|
||||||
e "elf/$util/$1/$util" f && continue
|
e "elf/$util/$1/$util" f && continue
|
||||||
|
|
||||||
utilelfdir="elf/$util/$1"
|
utilelfdir="elf/$util/$1"
|
||||||
|
|
49
script/trees
49
script/trees
|
@ -12,7 +12,7 @@ set -u -e
|
||||||
eval `setvars "" xarch srcdir premake cmakedir xlang mode makeargs elfdir cmd \
|
eval `setvars "" xarch srcdir premake cmakedir xlang mode makeargs elfdir cmd \
|
||||||
project target target_dir targets xtree _f release bootstrapargs mkhelper \
|
project target target_dir targets xtree _f release bootstrapargs mkhelper \
|
||||||
autoconfargs listfile autogenargs btype tree rev tree_depend build_depend \
|
autoconfargs listfile autogenargs btype tree rev tree_depend build_depend \
|
||||||
defconfig postmake mkhelpercfg dry dest_dir`
|
defconfig postmake mkhelpercfg dry dest_dir mdir badhash`
|
||||||
|
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
|
@ -116,7 +116,8 @@ handle_defconfig()
|
||||||
configure_project()
|
configure_project()
|
||||||
{
|
{
|
||||||
eval `setvars "" xarch xlang build_depend autoconfargs xtree postmake \
|
eval `setvars "" xarch xlang build_depend autoconfargs xtree postmake \
|
||||||
tree_depend makeargs btype mkhelper bootstrapargs premake release`
|
tree_depend makeargs btype mkhelper bootstrapargs premake release \
|
||||||
|
badhash`
|
||||||
|
|
||||||
[ -f "$1/target.cfg" ] || btype="auto"
|
[ -f "$1/target.cfg" ] || btype="auto"
|
||||||
[ -f "$datadir/mkhelper.cfg" ] && eval `setcfg "$datadir/mkhelper.cfg"`
|
[ -f "$datadir/mkhelper.cfg" ] && eval `setcfg "$datadir/mkhelper.cfg"`
|
||||||
|
@ -141,6 +142,11 @@ configure_project()
|
||||||
|
|
||||||
[ -z "$mode" ] && build_dependencies
|
[ -z "$mode" ] && build_dependencies
|
||||||
|
|
||||||
|
mdir="$PWD/config/submodule/$project"
|
||||||
|
[ -n "$tree" ] && mdir="$mdir/$tree"
|
||||||
|
|
||||||
|
[ -f "CHANGELOG" ] || check_project_hashes
|
||||||
|
|
||||||
[ "$mode" = "fetch" ] || x_ ./update trees -f "$project" $target
|
[ "$mode" = "fetch" ] || x_ ./update trees -f "$project" $target
|
||||||
[ "$mode" = "fetch" ] || return 0
|
[ "$mode" = "fetch" ] || return 0
|
||||||
|
|
||||||
|
@ -158,6 +164,45 @@ build_dependencies()
|
||||||
done; return 0
|
done; return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
check_project_hashes()
|
||||||
|
{
|
||||||
|
x_ mkdir -p hash
|
||||||
|
|
||||||
|
old_pjhash=""
|
||||||
|
[ ! -f "hash/$project$tree" ] || \
|
||||||
|
read -r old_pjhash < "hash/$project$tree"
|
||||||
|
|
||||||
|
x_ rm -f "$TMPDIR/project.list" "$TMPDIR/project.hash" \
|
||||||
|
"$TMPDIR/project.tmp"; x_ touch "$TMPDIR/project.tmp"
|
||||||
|
x_ touch "$TMPDIR/project.hash"
|
||||||
|
|
||||||
|
for delcheck in "$datadir" "$configdir/$tree" "$mdir"; do
|
||||||
|
[ -d "$delcheck" ] || continue
|
||||||
|
find "$delcheck" -type f -not -path "*/.git*/*" \
|
||||||
|
>> "$TMPDIR/project.tmp" || \
|
||||||
|
$err "!find $delcheck > project.tmp"
|
||||||
|
done
|
||||||
|
sort "$TMPDIR/project.tmp" > "$TMPDIR/project.list" || \
|
||||||
|
$err "!sort project tmp/list"
|
||||||
|
|
||||||
|
while read -r delcheck; do
|
||||||
|
[ -f "$delcheck" ] || continue
|
||||||
|
sha512sum "$delcheck" | awk '{print $1}' >> \
|
||||||
|
"$TMPDIR/project.hash" || $err "!findhash $delcheck"
|
||||||
|
done < "$TMPDIR/project.list"
|
||||||
|
|
||||||
|
pjhash="$(sha512sum "$TMPDIR/project.hash" | awk '{print $1}')" || :
|
||||||
|
badhash="y" && [ "$pjhash" = "$old_pjhash" ] && badhash="n"
|
||||||
|
[ -f "hash/$project$tree" ] || badhash="y"
|
||||||
|
|
||||||
|
printf "%s\n" "$pjhash" > "hash/$project$tree" || \
|
||||||
|
$err "!mk hash/$project$tree"
|
||||||
|
|
||||||
|
[ "$badhash" = "n" ] || rm -Rf "src/$project/$tree" \
|
||||||
|
"elf/$project/$tree" "elf/$project/$target" || \
|
||||||
|
$err "!rmproject $project $tree"; :
|
||||||
|
}
|
||||||
|
|
||||||
check_cross_compiler()
|
check_cross_compiler()
|
||||||
{
|
{
|
||||||
for _xarch in $xarch; do
|
for _xarch in $xarch; do
|
||||||
|
|
Loading…
Reference in New Issue