about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-22T13·21+0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-03-22T13·21+0100
commitbb1034316d7dcafa2ab45762a6b6509e922c4c21 (patch)
tree7da0208e56ea292fc09910308f9f891002e6bf21 /src
parent712b616a8443b940e94ac443499246f4de6ee5cd (diff)
Don't overload dumpPath()
Diffstat (limited to 'src')
-rw-r--r--src/libstore/binary-cache-store.cc6
-rw-r--r--src/libstore/binary-cache-store.hh2
-rw-r--r--src/libstore/local-fs-store.cc6
-rw-r--r--src/libstore/local-store.cc2
-rw-r--r--src/libstore/remote-store.cc2
-rw-r--r--src/libstore/store-api.hh4
-rw-r--r--src/nix-store/nix-store.cc2
7 files changed, 13 insertions, 11 deletions
diff --git a/src/libstore/binary-cache-store.cc b/src/libstore/binary-cache-store.cc
index e6b68d486b47..473a0b2614bb 100644
--- a/src/libstore/binary-cache-store.cc
+++ b/src/libstore/binary-cache-store.cc
@@ -156,7 +156,7 @@ bool BinaryCacheStore::isValidPath(const Path & storePath)
     return fileExists(narInfoFileFor(storePath));
 }
 
-void BinaryCacheStore::dumpPath(const Path & storePath, Sink & sink)
+void BinaryCacheStore::narFromPath(const Path & storePath, Sink & sink)
 {
     auto res = readNarInfo(storePath);
 
@@ -189,7 +189,7 @@ void BinaryCacheStore::exportPath(const Path & storePath, bool sign, Sink & sink
 
     auto res = readNarInfo(storePath);
 
-    dumpPath(storePath, sink);
+    narFromPath(storePath, sink);
 
     // FIXME: check integrity of NAR.
 
@@ -271,7 +271,7 @@ Path BinaryCacheStore::addToStore(const string & name, const Path & srcPath,
     StringSink sink;
     Hash h;
     if (recursive) {
-        nix::dumpPath(srcPath, sink, filter);
+        dumpPath(srcPath, sink, filter);
         h = hashString(hashAlgo, *sink.s);
     } else {
         auto s = readFile(srcPath);
diff --git a/src/libstore/binary-cache-store.hh b/src/libstore/binary-cache-store.hh
index f14b4859b04e..de6941561d5e 100644
--- a/src/libstore/binary-cache-store.hh
+++ b/src/libstore/binary-cache-store.hh
@@ -124,7 +124,7 @@ public:
     Path addTextToStore(const string & name, const string & s,
         const PathSet & references, bool repair = false) override;
 
-    void dumpPath(const Path & path, Sink & sink) override;
+    void narFromPath(const Path & path, Sink & sink) override;
 
     void exportPath(const Path & path, bool sign, Sink & sink) override;
 
diff --git a/src/libstore/local-fs-store.cc b/src/libstore/local-fs-store.cc
index 87c216ec9f95..8b72c05b7b90 100644
--- a/src/libstore/local-fs-store.cc
+++ b/src/libstore/local-fs-store.cc
@@ -69,9 +69,11 @@ ref<FSAccessor> LocalFSStore::getFSAccessor()
     return make_ref<LocalStoreAccessor>(ref<Store>(shared_from_this()));
 }
 
-void LocalFSStore::dumpPath(const Path & path, Sink & sink)
+void LocalFSStore::narFromPath(const Path & path, Sink & sink)
 {
-    nix::dumpPath(path, sink);
+    if (!isValidPath(path))
+        throw Error(format("path ‘%s’ is not valid") % path);
+    dumpPath(path, sink);
 }
 
 }
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index 532d511ef8bf..3d10b3387ed5 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -1418,7 +1418,7 @@ Path LocalStore::addToStore(const string & name, const Path & _srcPath,
        small files. */
     StringSink sink;
     if (recursive)
-        nix::dumpPath(srcPath, sink, filter);
+        dumpPath(srcPath, sink, filter);
     else
         sink.s = make_ref<std::string>(readFile(srcPath));
 
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index 3c417b4a6d06..82b7cfd7c17d 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -366,7 +366,7 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
     try {
         conn->to.written = 0;
         conn->to.warn = true;
-        nix::dumpPath(srcPath, conn->to, filter);
+        dumpPath(srcPath, conn->to, filter);
         conn->to.warn = false;
         conn->processStderr();
     } catch (SysError & e) {
diff --git a/src/libstore/store-api.hh b/src/libstore/store-api.hh
index 1a7440148322..62ee811ebfa6 100644
--- a/src/libstore/store-api.hh
+++ b/src/libstore/store-api.hh
@@ -223,7 +223,7 @@ public:
         const PathSet & references, bool repair = false) = 0;
 
     /* Write a NAR dump of a store path. */
-    virtual void dumpPath(const Path & path, Sink & sink) = 0;
+    virtual void narFromPath(const Path & path, Sink & sink) = 0;
 
     /* Export a store path, that is, create a NAR dump of the store
        path and append its references and its deriver.  Optionally, a
@@ -365,7 +365,7 @@ public:
 class LocalFSStore : public Store
 {
 public:
-    void dumpPath(const Path & path, Sink & sink) override;
+    void narFromPath(const Path & path, Sink & sink) override;
     ref<FSAccessor> getFSAccessor() override;
 };
 
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 563f0805e08b..1a27230416cc 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -784,7 +784,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
         printMsg(lvlTalkative, format("checking path ‘%1%’...") % path);
         ValidPathInfo info = store->queryPathInfo(path);
         HashSink sink(info.narHash.type);
-        store->dumpPath(path, sink);
+        store->narFromPath(path, sink);
         auto current = sink.finish();
         if (current.first != info.narHash) {
             printMsg(lvlError,