diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2004-04-14 10:55:33 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2004-04-14 10:55:33 +0000 |
commit | 5c847a370a218390781296f1c63fead40a2e17e8 (patch) | |
tree | ab9a01a86b3572c342b55fad45892bd0ae5300c2 /pkgs/build-support/fetchsvn/builder.sh | |
parent | f7561cf00ed8bd0c9278e363362e7f7ded5a990e (diff) |
* `fetchsvn' now requires the MD5 hash (as computed by `nix-hash') of
the tree being fetched from a Subversion repository. The revision number is now optional (and defaults to HEAD). This makes `fetchsvn' more pure. First, a URL/revision tuple does not uniquely identify a file resource, since the repository itself might change. Second, `svn:external' attributes can cause arbitrary resources to be exported. A script `nix-prefetch-svn' has been provided to determine the hash of a URL. svn path=/nixpkgs/trunk/; revision=938
Diffstat (limited to 'pkgs/build-support/fetchsvn/builder.sh')
-rw-r--r-- | pkgs/build-support/fetchsvn/builder.sh | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/build-support/fetchsvn/builder.sh b/pkgs/build-support/fetchsvn/builder.sh index 15fdd7d7c8217..3079588dca37c 100644 --- a/pkgs/build-support/fetchsvn/builder.sh +++ b/pkgs/build-support/fetchsvn/builder.sh @@ -1,8 +1,19 @@ -buildinputs="$subversion" . $stdenv/setup -echo "exporting $url (r$rev) into $out..." +header "exporting $url (r$rev) into $out" -svn export -r $rev "$url" $out || exit 1 +prefetch=$(dirname $out)/svn-checkout-tmp-$md5 +echo $prefetch +if test -e "$prefetch"; then + mv $prefetch $out +else + svn export -r "$rev" "$url" $out +fi -echo $rev > $out/svn-revision || exit 1 +actual=$(nix-hash $out) +if test "$actual" != "$md5"; then + echo "hash is $actual, expected $md5" >&2 + exit 1 +fi + +stopNest |