forked from lix-project/lix
Merge pull request #9805 from yshui/prefetch-unpack
Add --unpack to nix store prefetch-file
(cherry picked from commit f51409cf98e9b18f27a6d0240a0aa0c3f37c2fd0)
Change-Id: I974b04f3efc8b210a9399a71d3704490cfc2c80c
This commit is contained in:
parent
b6bb869e52
commit
fad1a25e17
|
@ -257,6 +257,7 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
{
|
{
|
||||||
std::string url;
|
std::string url;
|
||||||
bool executable = false;
|
bool executable = false;
|
||||||
|
bool unpack = false;
|
||||||
std::optional<std::string> name;
|
std::optional<std::string> name;
|
||||||
HashType hashType = htSHA256;
|
HashType hashType = htSHA256;
|
||||||
std::optional<Hash> expectedHash;
|
std::optional<Hash> expectedHash;
|
||||||
|
@ -289,6 +290,14 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
.handler = {&executable, true},
|
.handler = {&executable, true},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
addFlag({
|
||||||
|
.longName = "unpack",
|
||||||
|
.description =
|
||||||
|
"Unpack the archive (which must be a tarball or zip file) and add "
|
||||||
|
"the result to the Nix store.",
|
||||||
|
.handler = {&unpack, true},
|
||||||
|
});
|
||||||
|
|
||||||
expectArg("url", &url);
|
expectArg("url", &url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,7 +314,7 @@ struct CmdStorePrefetchFile : StoreCommand, MixJSON
|
||||||
}
|
}
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto [storePath, hash] = prefetchFile(store, url, name, hashType, expectedHash, false, executable);
|
auto [storePath, hash] = prefetchFile(store, url, name, hashType, expectedHash, unpack, executable);
|
||||||
|
|
||||||
if (json) {
|
if (json) {
|
||||||
auto res = nlohmann::json::object();
|
auto res = nlohmann::json::object();
|
||||||
|
|
Loading…
Reference in a new issue