Files
nixpkgs/pkgs/build-support/fetchdarcs/builder.sh
T
2025-12-17 05:21:02 +07:00

39 lines
871 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
runHook preFetch
tagtext=""
tagflags=""
# Darcs hashes are sha1 (120 bits, 40-character hex)
if [[ "$rev" =~ [a-fA-F0-9]{40} ]]; then
tagtext="(hash $rev)"
tagflags="--to-hash=$rev"
elif test -n "$rev"; then
tagtext="(tag $rev)"
tagflags="--tag=$rev"
elif test -n "$context"; then
tagtext="(context)"
tagflags="--context=$context"
fi
# Repository list may contain ?. No glob expansion for that.
set -o noglob
success=
for repository in $repositories; do
echo "Trying to clone $repository $tagtext into $out"
if darcs clone --lazy $tagflags "$repository" "$out"; then
# remove metadata, because it can change
rm -rf "$out/_darcs"
success=1
break
fi
done
set +o noglob
if [ -z "$success" ]; then
echo "Error: couldnt clone repository from any mirror" 1>&2
exit 1
fi
runHook postFetch