about summary refs log tree commit diff
path: root/nixpkgs/pkgs/build-support/fetchdarcs/builder.sh
blob: 75b9066dba6f43d9f78d11fa13c37cc72ce6cbf1 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup

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

echo "getting $url $partial ${tagtext} into $out"

darcs get --lazy $tagflags "$url" "$out"
# remove metadata, because it can change
rm -rf "$out/_darcs"