mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Add a Store::addToStore() variant that accepts a NAR
As a side effect, this ensures that signatures are propagated when copying paths between stores. Also refactored import/export to make use of this.
This commit is contained in:
parent
b6c768fb6a
commit
538a64e8c3
15 changed files with 235 additions and 338 deletions
|
@ -363,10 +363,9 @@ void copyStorePath(ref<Store> srcStore, ref<Store> dstStore,
|
|||
auto info = srcStore->queryPathInfo(storePath);
|
||||
|
||||
StringSink sink;
|
||||
srcStore->exportPaths({storePath}, sink);
|
||||
srcStore->narFromPath({storePath}, sink);
|
||||
|
||||
StringSource source(*sink.s);
|
||||
dstStore->importPaths(source, 0);
|
||||
dstStore->addToStore(*info, *sink.s);
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,16 +405,6 @@ string showPaths(const PathSet & paths)
|
|||
}
|
||||
|
||||
|
||||
void Store::exportPaths(const Paths & paths, Sink & sink)
|
||||
{
|
||||
for (auto & i : paths) {
|
||||
sink << 1;
|
||||
exportPath(i, sink);
|
||||
}
|
||||
sink << 0;
|
||||
}
|
||||
|
||||
|
||||
std::string ValidPathInfo::fingerprint() const
|
||||
{
|
||||
if (narSize == 0 || !narHash)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue