mirror of
https://github.com/NixOS/nix
synced 2025-06-25 23:11: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
|
@ -173,26 +173,26 @@ static ref<std::string> decompressBzip2(const std::string & in)
|
|||
}
|
||||
}
|
||||
|
||||
ref<std::string> compress(const std::string & method, ref<std::string> in)
|
||||
ref<std::string> compress(const std::string & method, const std::string & in)
|
||||
{
|
||||
if (method == "none")
|
||||
return in;
|
||||
return make_ref<std::string>(in);
|
||||
else if (method == "xz")
|
||||
return compressXZ(*in);
|
||||
return compressXZ(in);
|
||||
else if (method == "bzip2")
|
||||
return compressBzip2(*in);
|
||||
return compressBzip2(in);
|
||||
else
|
||||
throw UnknownCompressionMethod(format("unknown compression method ‘%s’") % method);
|
||||
}
|
||||
|
||||
ref<std::string> decompress(const std::string & method, ref<std::string> in)
|
||||
ref<std::string> decompress(const std::string & method, const std::string & in)
|
||||
{
|
||||
if (method == "none")
|
||||
return in;
|
||||
return make_ref<std::string>(in);
|
||||
else if (method == "xz")
|
||||
return decompressXZ(*in);
|
||||
return decompressXZ(in);
|
||||
else if (method == "bzip2")
|
||||
return decompressBzip2(*in);
|
||||
return decompressBzip2(in);
|
||||
else
|
||||
throw UnknownCompressionMethod(format("unknown compression method ‘%s’") % method);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue