Makefile: add yet another helper real.remove_canary_files-extract_patch_rebuild_what_changed: reextract packages, repatch sources (might fail, easy to fix) and rebuild only what changed (not a lot)

if patch fails to apply, its because patch file creates a file and doesn't expect it to exist.
just call rm on the file reported to exist, and relaunch build.

Deletes ./install/*/* and permits to rebuild all dependencies in order, just based on freshly extracted and patched code.
Bonus, this saves your SDD from unneeded wear and rebuilds faster then all other Mafile helpers.

That's my favorite.

Signed-off-by: Thierry Laurion <insurgo@riseup.net>
This commit is contained in:
Thierry Laurion 2024-04-23 19:34:32 -04:00
parent a29f92a26d
commit 975a2424cd
No known key found for this signature in database
GPG Key ID: 9A53E1BB3FF00461

View File

@ -833,6 +833,20 @@ real.clean:
done
cd install && rm -rf -- *
real.gitclean:
#Use git ignore file as a base to wipe everything not in tree. Keeps coreboot forks downloaded since detected as git repos, wipes the rest.
git clean -fxd
real.gitclean_keep_packages:
#Same as above but keep the packages downloaded to save bandwidth
git clean -fxd -e "packages"
real.remove_canary_files-extract_patch_rebuild_what_changed:
#Another approach is to remove the "canary" files
# This forces Heads to restart building a board config by checking packages integrity, extracting them, redoing patching on files and rebuilding what needs to be rebuilt
# reinstalling what is needed under ./install as well which is what we normally want on a development cycle.
#Limitations: if for whatever reason, a patch creates a file in an extracted package dir, this approach will fail without further manual actions
# This is not so bad though: git patch apply tells you exactly which file couldn't be created as expected. Just delete those files and relaunch the build and it will succeed.
#This approach economizes a lot of time since most of the build artifacts do not need to be rebuilt since the dates of the files should be the same as when you originally built them.
# So only a minimal time is needed to rebuild, and this is also good for your SSD.
#**** USE THIS APPROACH FIRST ***
find ./build/ -type f -name ".canary" | xargs rm || echo "All .carnary files already deleted"
find ./install/*/* | xargs rm -rf || echo "All install/ARCH/* dirs and files already deleted"
echo "you can now call make BOARD=desired_board, and if any patch fails to apply because file exists; just rm that build/path_to_file and continue testing!"