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 /src/nix-store/nix-store.cc | |
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 'src/nix-store/nix-store.cc')
-rw-r--r-- | src/nix-store/nix-store.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc index 63635b52d3f1..e03e82221285 100644 --- a/src/nix-store/nix-store.cc +++ b/src/nix-store/nix-store.cc @@ -129,7 +129,7 @@ static void opAddFixed(Strings opFlags, Strings opArgs) opArgs.pop_front(); for (Strings::iterator i = opArgs.begin(); i != opArgs.end(); ++i) - cout << format("%1%\n") % store->addToStore(*i, true, recursive, hashAlgo); + cout << format("%1%\n") % store->addToStore(*i, recursive, hashAlgo); } @@ -151,6 +151,9 @@ static void opPrintFixedPath(Strings opFlags, Strings opArgs) if (*i == "--recursive") recursive = true; else throw UsageError(format("unknown flag `%1%'") % *i); + if (opArgs.size() != 3) + throw UsageError(format("`--print-fixed-path' requires three arguments")); + Strings::iterator i = opArgs.begin(); string hashAlgo = *i++; string hash = *i++; |