scripts: add support for multiple mmodule sources

This adds support for providing a list of multiple sources a module can
be obtained from. This way, modules can have a fallback to clone from in
case the primary source is not available.
This commit is contained in:
David Bauer 2021-02-03 01:18:44 +01:00
parent 39c1f67236
commit 4a79b17d3b

View File

@ -19,10 +19,22 @@ for module in $GLUON_MODULES; do
git init
if ! git branch -f base "$commit" 2>/dev/null; then
git fetch "$repo" "$branch"
git branch -f base "$commit" || {
echo "unable to find commit \"$commit\" on branch \"$branch\" in repo \"$repo\"." >&2
exit 1
}
for repository in $repo; do
if git fetch "$repository" "$branch"; then
if ! git branch -f base "$commit"; then
echo "unable to find commit \"$commit\" on branch \"$branch\" in repo \"$repo\"." >&2
break
fi
fetched=1
break
else
echo "unable to fetch module \"$module\" from \"$repository\"" >&2
fi
done
if [ $fetched -ne 1 ]; then
echo "No suitable mirror for module \"$module\" found." >&2
exit 1
fi
fi
done