about summary refs log tree commit diff
path: root/src/nix-store/nix-store.cc
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-21T16·55+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-21T16·55+0100
commit1c5f73f529d83543dc776b4de4180309bfd3b4a3 (patch)
tree3f19160e2f65893c560d04a8a99b024427b86b78 /src/nix-store/nix-store.cc
parent87295b9844090d76173a9f68341a4b17a7e1e7b9 (diff)
Add Store::dumpPath() method
This allows applying nix-store --verify-path to binary cache stores:

  NIX_REMOTE=https://cache.nixos.org nix-store --verify-path /nix/store/s5c7...
Diffstat (limited to 'src/nix-store/nix-store.cc')
-rw-r--r--src/nix-store/nix-store.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index a258c77c326f..563f0805e08b 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -783,7 +783,9 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
         Path path = followLinksToStorePath(i);
         printMsg(lvlTalkative, format("checking path ‘%1%’...") % path);
         ValidPathInfo info = store->queryPathInfo(path);
-        HashResult current = hashPath(info.narHash.type, path);
+        HashSink sink(info.narHash.type);
+        store->dumpPath(path, sink);
+        auto current = sink.finish();
         if (current.first != info.narHash) {
             printMsg(lvlError,
                 format("path ‘%1%’ was modified! expected hash ‘%2%’, got ‘%3%’")