diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-03T15·06+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-03T15·06+0000 |
commit | 64519cfd657d024ae6e2bb74cb21ad21b886fd2a (patch) | |
tree | cfcc6f0457009a392914201f8379f2cbd734d147 /tests/add.sh | |
parent | 09bc0c502c4a52baf0bd363d8ee5f18d49244f73 (diff) |
* Unify the treatment of sources copied to the store, and recursive
SHA-256 outputs of fixed-output derivations. I.e. they now produce the same store path: $ nix-store --add x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x $ nix-store --add-fixed --recursive sha256 x /nix/store/j2fq9qxvvxgqymvpszhs773ncci45xsj-x the latter being the same as the path that a derivation derivation { name = "x"; outputHashAlgo = "sha256"; outputHashMode = "recursive"; outputHash = "..."; ... }; produces. This does change the output path for such fixed-output derivations. Fortunately they are quite rare. The most common use is fetchsvn calls with SHA-256 hashes. (There are a handful of those is Nixpkgs, mostly unstable development packages.) * Documented the computation of store paths (in store-api.cc).
Diffstat (limited to 'tests/add.sh')
-rw-r--r-- | tests/add.sh | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/tests/add.sh b/tests/add.sh index 83092b26c143..7ea4cb6d6a99 100644 --- a/tests/add.sh +++ b/tests/add.sh @@ -1,13 +1,28 @@ source common.sh -file=./add.sh +path1=$($nixstore --add ./dummy) +echo $path1 -path=$($nixstore --add $file) +path2=$($nixstore --add-fixed sha256 --recursive ./dummy) +echo $path2 -echo $path +if test "$path1" != "$path2"; then + echo "nix-store --add and --add-fixed mismatch" + exit 1 +fi -hash=$($nixstore -q --hash $path) +path3=$($nixstore --add-fixed sha256 ./dummy) +echo $path3 +test "$path1" != "$path3" || exit 1 -echo $hash +path4=$($nixstore --add-fixed sha1 --recursive ./dummy) +echo $path4 +test "$path1" != "$path4" || exit 1 -test "$hash" = "sha256:$($nixhash --type sha256 --base32 $file)" +hash1=$($nixstore -q --hash $path1) +echo $hash1 + +hash2=$($nixhash --type sha256 --base32 ./dummy) +echo $hash2 + +test "$hash1" = "sha256:$hash2" |