* Allow a known hash to be specified.
svn path=/nixpkgs/trunk/; revision=1892
This commit is contained in:
parent
2a3f5188b5
commit
60e7948db1
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
url=$1
|
url=$1
|
||||||
rev=$2
|
rev=$2
|
||||||
|
hash=$3
|
||||||
|
|
||||||
if test -z "$url"; then
|
if test -z "$url"; then
|
||||||
echo "syntax: nix-prefetch-svn URL [REVISION]" >&2
|
echo "syntax: nix-prefetch-svn URL [REVISION]" >&2
|
||||||
@ -10,6 +11,9 @@ fi
|
|||||||
|
|
||||||
test -n "$rev" || rev="HEAD"
|
test -n "$rev" || rev="HEAD"
|
||||||
|
|
||||||
|
# Determine the hash, unless it was given.
|
||||||
|
if test -z "$hash"; then
|
||||||
|
|
||||||
# !!! hacky; we should have a way to query the location of the store.
|
# !!! hacky; we should have a way to query the location of the store.
|
||||||
if storeDir=$(which nix-store); then
|
if storeDir=$(which nix-store); then
|
||||||
storeDir=$(dirname $(dirname "$storeDir"))/store
|
storeDir=$(dirname $(dirname "$storeDir"))/store
|
||||||
@ -31,6 +35,8 @@ echo "hash is $hash" >&2
|
|||||||
tmpPath2=$storeDir/svn-checkout-tmp-$hash
|
tmpPath2=$storeDir/svn-checkout-tmp-$hash
|
||||||
test -e $tmpPath2 || mv $tmpPath1 $tmpPath2 # !!! race
|
test -e $tmpPath2 || mv $tmpPath1 $tmpPath2 # !!! race
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Create a Nix expression that does a fetchsvn.
|
# Create a Nix expression that does a fetchsvn.
|
||||||
nixExpr=$(dirname $(readlink -f $0))/../../system/i686-linux.nix
|
nixExpr=$(dirname $(readlink -f $0))/../../system/i686-linux.nix
|
||||||
storeExpr=$( \
|
storeExpr=$( \
|
||||||
@ -42,7 +48,9 @@ finalPath=$(nix-store -qnB --force-realise $storeExpr)
|
|||||||
|
|
||||||
echo "path is $finalPath" >&2
|
echo "path is $finalPath" >&2
|
||||||
|
|
||||||
|
if test -n "$tmpPath2"; then
|
||||||
rm -rf $tmpPath2 || true
|
rm -rf $tmpPath2 || true
|
||||||
|
fi
|
||||||
|
|
||||||
echo $hash
|
echo $hash
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user