git.sh: download "depend" projects *before*

don't do it after, because that means the main project
is saved under src/ before we know whether the subrepo
was downloaded.

the "depend" variable (in config/git/) is no longer used
for projects that go in subdirectories of a parent; now,
we use config/submodules/ for this type of dependency.

download the "depend" projects (as per config/git/) first.
this way, if they fail, the main one will fail, but if
they succeed and main fails, you can just run the main
download again and it won't fail.

this fixes a bug where, depending on how you download a
set of projects and depending on the order which you do so,
a given project can become un-downloadable on current design,
because git will complain that a directory already exists.

this fix is done not only in code (by this commit), but
by prior configuration changes.

Signed-off-by: Leah Rowe <leah@libreboot.org>
20240612_branch
Leah Rowe 2024-06-07 14:16:58 +01:00
parent a4549e935e
commit d43247683b
2 changed files with 3 additions and 5 deletions

View File

@ -57,11 +57,10 @@ fetch_project_repo()
[ -z "${loc+x}" ] && $err "fetch_project_repo $project: loc not set" [ -z "${loc+x}" ] && $err "fetch_project_repo $project: loc not set"
[ -z "${url+x}" ] && $err "fetch_project_repo $project: url not set" [ -z "${url+x}" ] && $err "fetch_project_repo $project: url not set"
clone_project
[ -z "$depend" ] || for d in $depend ; do [ -z "$depend" ] || for d in $depend ; do
x_ ./update trees -f $d x_ ./update trees -f $d
done done
rm -Rf "$tmpgit" || $err "fetch_repo: !rm -Rf $tmpgit" clone_project
for x in config/git/*; do for x in config/git/*; do
[ -f "$x" ] && nuke "${x##*/}" "src/${x##*/}"; continue [ -f "$x" ] && nuke "${x##*/}" "src/${x##*/}"; continue
@ -74,6 +73,8 @@ clone_project()
loc="src/$loc" loc="src/$loc"
e "$loc" d && return 0 e "$loc" d && return 0
remkdir "${tmpgit%/*}"
git clone $url "$tmpgit" || git clone $bkup_url "$tmpgit" \ git clone $url "$tmpgit" || git clone $bkup_url "$tmpgit" \
|| $err "clone_project: could not download $project" || $err "clone_project: could not download $project"
git_prep "$PWD/config/$project/patches" "$loc" git_prep "$PWD/config/$project/patches" "$loc"
@ -107,7 +108,6 @@ prep_submodules()
[ -n "$tree" ] && mdir="$mdir/$tree" [ -n "$tree" ] && mdir="$mdir/$tree"
[ -f "$mdir/module.list" ] || return 0 [ -f "$mdir/module.list" ] || return 0
cat "$mdir/module.list" > "$tmpdir/modules" || \ cat "$mdir/module.list" > "$tmpdir/modules" || \
$err "!cp $mdir/module.list $tmpdir/modules" $err "!cp $mdir/module.list $tmpdir/modules"

View File

@ -39,8 +39,6 @@ main()
cfgsdir="config/$project" cfgsdir="config/$project"
listfile="$datadir/build.list" # needed on multi, optional on single listfile="$datadir/build.list" # needed on multi, optional on single
remkdir "${tmpgit%/*}"
_cmd="build_projects" _cmd="build_projects"
singletree "$project" || _cmd="build_targets" singletree "$project" || _cmd="build_targets"
$_cmd $@ $_cmd $@