git.sh: Remove .git if XBMK_RELEASE=y
The build system already deletes .git in all source directories for each given release, but does so at the very end; it still does, but now it is deleted one by one per project, to save space during very large builds (release sizes vary wildly, depending on how many trees exist for coreboot basically). If you're building entirely in tmpfs (as I do), this could be a problem if you have lots of .git/ directories. This change reduces disk usage, or in the above example, memory usage when running the build system from tmpfs. This complements another recent change, where ROM images are compressed per target during release builds, rather than all at the very end of the process. It is part of a series of optimisations, to reduce the memory and disk usage of the build system, and to reduce I/O wastage in general. This change will not be the last of such changes! Signed-off-by: Leah Rowe <leah@libreboot.org>20240612_branch
parent
dd851caac9
commit
f8e3ca3b22
3
build
3
build
|
@ -157,8 +157,7 @@ fetch_trees()
|
|||
[ ! -f "$x" ] || [ -L "$xp" ] || x_ rm -Rf "src/$xp/$xp"
|
||||
done
|
||||
|
||||
find . -name ".git" -exec rm -Rf {} + || $err "$_xm: rm .git"
|
||||
find . -name ".gitmodules" -exec rm -Rf {} + || $err "$_xm: rm .gitmod"
|
||||
rmgit .
|
||||
rm -Rf tmp .git src/u-boot/*/test/lib/strlcat.c || $err "$_xm !rm"
|
||||
}
|
||||
|
||||
|
|
|
@ -111,6 +111,8 @@ git_prep()
|
|||
fi
|
||||
fi
|
||||
|
||||
[ "$xbmk_release" = "y" ] && rmgit "$tmpgit"
|
||||
|
||||
[ "$_loc" = "${_loc%/*}" ] || x_ mkdir -p "${_loc%/*}"
|
||||
mv "$tmpgit" "$_loc" || $err "git_prep: !mv $tmpgit $_loc"
|
||||
[ -n "$xtree" ] && [ ! -d "src/coreboot/$xtree" ] && \
|
||||
|
|
|
@ -178,3 +178,12 @@ mksha512sum()
|
|||
$err "!sha512sum \"${1}\" > \"${2}\""
|
||||
) || $err "failed to create tarball checksum"
|
||||
}
|
||||
|
||||
rmgit()
|
||||
{
|
||||
(
|
||||
cd "$1" || $err "!cd gitrepo $1"
|
||||
find . -name ".git" -exec rm -Rf {} + || $err "!rm .git $1"
|
||||
find . -name ".gitmodules" -exec rm -Rf {} + || $err "!rm .gitmod $1"
|
||||
) || $err "Cannot remove .git/.gitmodules in $1"
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue