mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-16 03:25:25 +02:00
get.sh: put tmpclone dirs in xbtmp
and generate them, don't hardcode them - this reduces the chance of race conditions, which we have seen in the past and which current execution flow in xbmk even mitigates in a few places, by doing things in a certain order. this change makes the code more robust and easier to maintain. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+8
-5
@@ -3,10 +3,7 @@
|
|||||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||||
|
|
||||||
eval "`setvars "" loc url bkup_url subcurl subhash subgit subgit_bkup \
|
eval "`setvars "" loc url bkup_url subcurl subhash subgit subgit_bkup \
|
||||||
depend subcurl_bkup`"
|
depend subcurl_bkup tmpgit`"
|
||||||
|
|
||||||
tmpgit="$xbtmp/gitclone"
|
|
||||||
tmpgitcache="$XBMK_CACHE/tmpgit"
|
|
||||||
|
|
||||||
fetch_targets()
|
fetch_targets()
|
||||||
{
|
{
|
||||||
@@ -31,7 +28,7 @@ clone_project()
|
|||||||
loc="$XBMK_CACHE/clone/$project" && singletree "$project" && \
|
loc="$XBMK_CACHE/clone/$project" && singletree "$project" && \
|
||||||
loc="src/$project"
|
loc="src/$project"
|
||||||
|
|
||||||
e "$loc" d missing && remkdir "${tmpgit%/*}" && git_prep \
|
e "$loc" d missing && git_prep \
|
||||||
"$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; :
|
"$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"; :
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +39,10 @@ git_prep()
|
|||||||
_patchdir="$3"
|
_patchdir="$3"
|
||||||
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
||||||
|
|
||||||
|
tmpgit="`mktemp -d || err "can't make tmpgit"`" || err
|
||||||
|
x_ rm -Rf "$tmpgit"
|
||||||
|
x_ mkdir -p "${tmpgit%/*}"
|
||||||
|
|
||||||
chkvars rev
|
chkvars rev
|
||||||
xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
|
xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
|
||||||
if singletree "$project" || [ $# -gt 4 ]; then
|
if singletree "$project" || [ $# -gt 4 ]; then
|
||||||
@@ -134,7 +135,9 @@ try_copy()
|
|||||||
try_git()
|
try_git()
|
||||||
{
|
{
|
||||||
gitdest="`findpath "$1"`" || err "Can't get readpath for '$1'"
|
gitdest="`findpath "$1"`" || err "Can't get readpath for '$1'"
|
||||||
|
tmpgitcache="`mktemp -d || err "can't make tmpgitcache"`" || err
|
||||||
x_ rm -Rf "$tmpgitcache"
|
x_ rm -Rf "$tmpgitcache"
|
||||||
|
x_ mkdir -p "${tmpgitcache%/*}"
|
||||||
|
|
||||||
[ -d "$gitdest" ] || ( x_ git clone "$2" "$tmpgitcache" ) || return 1
|
[ -d "$gitdest" ] || ( x_ git clone "$2" "$tmpgitcache" ) || return 1
|
||||||
[ -d "$gitdest" ] || x_ mkdir -p "${gitdest%/*}"
|
[ -d "$gitdest" ] || x_ mkdir -p "${gitdest%/*}"
|
||||||
|
|||||||
@@ -65,8 +65,6 @@ trees()
|
|||||||
targets="$*"
|
targets="$*"
|
||||||
cmd="build_targets $targets"
|
cmd="build_targets $targets"
|
||||||
singletree "$project" && cmd="build_project"
|
singletree "$project" && cmd="build_project"
|
||||||
|
|
||||||
remkdir "${tmpgit%/*}"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
build_project()
|
build_project()
|
||||||
|
|||||||
Reference in New Issue
Block a user