git.sh: split submodule handling to new function

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2-merge1
Leah Rowe 2024-05-22 17:59:42 +01:00 committed by Leah Rowe
parent b593127795
commit 9c0a7f14fc
1 changed files with 18 additions and 13 deletions

View File

@ -96,20 +96,17 @@ git_prep()
git_am_patches "$tmpgit" "$_patchdir" || $err "!am $_loc $_patchdir" git_am_patches "$tmpgit" "$_patchdir" || $err "!am $_loc $_patchdir"
if [ "$project" = "coreboot" ] && [ $# -gt 2 ]; then if [ "$project" = "coreboot" ] && [ $# -gt 2 ]; then
[ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \ prep_submodules "$_loc"
update --init || $err "git_prep $_loc: !submod" fi
patch_submodules if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \
[ "$xtree" != "$tree" ] && [ $# -gt 2 ]; then
if [ "$project" = "coreboot" ] && [ -n "$xtree" ] && \ (
[ "$xtree" != "$tree" ]; then cd "$tmpgit/util" || $err "prep $1: !cd $tmpgit/util"
( rm -Rf crossgcc || $err "prep $1: !rm xgcc"
cd "$tmpgit/util" || $err "prep $_loc: !cd $tmpgit/util" ln -s "../../$xtree/util/crossgcc" crossgcc || \
rm -Rf crossgcc || $err "prep $_loc: !rm xgcc" $err "prep $1: can't create xgcc symlink"
ln -s "../../$xtree/util/crossgcc" crossgcc || \ ) || $err "prep $1: can't create xgcc symlink"
$err "prep $_loc: can't create xgcc symlink"
) || $err "prep $_loc: can't create xgcc symlink"
fi
fi fi
[ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \ [ "$xbmk_release" = "y" ] && [ "$_loc" != "src/$project/$project" ] \
@ -121,6 +118,14 @@ git_prep()
x_ ./update trees -f coreboot "$xtree"; return 0 x_ ./update trees -f coreboot "$xtree"; return 0
} }
prep_submodules()
{
[ ! -f "$tmpgit/.gitmodules" ] || git -C "$tmpgit" submodule \
update --init --checkout || $err "git_prep $1: !submod"
patch_submodules
}
patch_submodules() patch_submodules()
{ {
mdir="${PWD}/config/submodule/$project" mdir="${PWD}/config/submodule/$project"