Don't overload dumpPath()
This commit is contained in:
parent
712b616a84
commit
bb1034316d
|
@ -156,7 +156,7 @@ bool BinaryCacheStore::isValidPath(const Path & storePath)
|
||||||
return fileExists(narInfoFileFor(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);
|
auto res = readNarInfo(storePath);
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void BinaryCacheStore::exportPath(const Path & storePath, bool sign, Sink & sink
|
||||||
|
|
||||||
auto res = readNarInfo(storePath);
|
auto res = readNarInfo(storePath);
|
||||||
|
|
||||||
dumpPath(storePath, sink);
|
narFromPath(storePath, sink);
|
||||||
|
|
||||||
// FIXME: check integrity of NAR.
|
// FIXME: check integrity of NAR.
|
||||||
|
|
||||||
|
@ -271,7 +271,7 @@ Path BinaryCacheStore::addToStore(const string & name, const Path & srcPath,
|
||||||
StringSink sink;
|
StringSink sink;
|
||||||
Hash h;
|
Hash h;
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
nix::dumpPath(srcPath, sink, filter);
|
dumpPath(srcPath, sink, filter);
|
||||||
h = hashString(hashAlgo, *sink.s);
|
h = hashString(hashAlgo, *sink.s);
|
||||||
} else {
|
} else {
|
||||||
auto s = readFile(srcPath);
|
auto s = readFile(srcPath);
|
||||||
|
|
|
@ -124,7 +124,7 @@ public:
|
||||||
Path addTextToStore(const string & name, const string & s,
|
Path addTextToStore(const string & name, const string & s,
|
||||||
const PathSet & references, bool repair = false) override;
|
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;
|
void exportPath(const Path & path, bool sign, Sink & sink) override;
|
||||||
|
|
||||||
|
|
|
@ -69,9 +69,11 @@ ref<FSAccessor> LocalFSStore::getFSAccessor()
|
||||||
return make_ref<LocalStoreAccessor>(ref<Store>(shared_from_this()));
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1418,7 +1418,7 @@ Path LocalStore::addToStore(const string & name, const Path & _srcPath,
|
||||||
small files. */
|
small files. */
|
||||||
StringSink sink;
|
StringSink sink;
|
||||||
if (recursive)
|
if (recursive)
|
||||||
nix::dumpPath(srcPath, sink, filter);
|
dumpPath(srcPath, sink, filter);
|
||||||
else
|
else
|
||||||
sink.s = make_ref<std::string>(readFile(srcPath));
|
sink.s = make_ref<std::string>(readFile(srcPath));
|
||||||
|
|
||||||
|
|
|
@ -366,7 +366,7 @@ Path RemoteStore::addToStore(const string & name, const Path & _srcPath,
|
||||||
try {
|
try {
|
||||||
conn->to.written = 0;
|
conn->to.written = 0;
|
||||||
conn->to.warn = true;
|
conn->to.warn = true;
|
||||||
nix::dumpPath(srcPath, conn->to, filter);
|
dumpPath(srcPath, conn->to, filter);
|
||||||
conn->to.warn = false;
|
conn->to.warn = false;
|
||||||
conn->processStderr();
|
conn->processStderr();
|
||||||
} catch (SysError & e) {
|
} catch (SysError & e) {
|
||||||
|
|
|
@ -223,7 +223,7 @@ public:
|
||||||
const PathSet & references, bool repair = false) = 0;
|
const PathSet & references, bool repair = false) = 0;
|
||||||
|
|
||||||
/* Write a NAR dump of a store path. */
|
/* 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
|
/* Export a store path, that is, create a NAR dump of the store
|
||||||
path and append its references and its deriver. Optionally, a
|
path and append its references and its deriver. Optionally, a
|
||||||
|
@ -365,7 +365,7 @@ public:
|
||||||
class LocalFSStore : public Store
|
class LocalFSStore : public Store
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void dumpPath(const Path & path, Sink & sink) override;
|
void narFromPath(const Path & path, Sink & sink) override;
|
||||||
ref<FSAccessor> getFSAccessor() override;
|
ref<FSAccessor> getFSAccessor() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -784,7 +784,7 @@ static void opVerifyPath(Strings opFlags, Strings opArgs)
|
||||||
printMsg(lvlTalkative, format("checking path ‘%1%’...") % path);
|
printMsg(lvlTalkative, format("checking path ‘%1%’...") % path);
|
||||||
ValidPathInfo info = store->queryPathInfo(path);
|
ValidPathInfo info = store->queryPathInfo(path);
|
||||||
HashSink sink(info.narHash.type);
|
HashSink sink(info.narHash.type);
|
||||||
store->dumpPath(path, sink);
|
store->narFromPath(path, sink);
|
||||||
auto current = sink.finish();
|
auto current = sink.finish();
|
||||||
if (current.first != info.narHash) {
|
if (current.first != info.narHash) {
|
||||||
printMsg(lvlError,
|
printMsg(lvlError,
|
||||||
|
|
Loading…
Reference in a new issue