Fix --refresh with --no-net

https://hydra.nixos.org/build/110879699
(cherry picked from commit 5bbe793abf)
This commit is contained in:
Eelco Dolstra 2020-01-28 17:34:48 +01:00
parent 6b824c78f1
commit c85097da7c

View File

@ -55,6 +55,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
{ {
bool printBuildLogs = false; bool printBuildLogs = false;
bool useNet = true; bool useNet = true;
bool refresh = false;
NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix") NixArgs() : MultiCommand(*RegisterCommand::commands), MixCommonArgs("nix")
{ {
@ -96,7 +97,7 @@ struct NixArgs : virtual MultiCommand, virtual MixCommonArgs
mkFlag() mkFlag()
.longName("refresh") .longName("refresh")
.description("consider all previously downloaded files out-of-date") .description("consider all previously downloaded files out-of-date")
.handler([&]() { settings.tarballTtl = 0; }); .handler([&]() { refresh = true; });
} }
void printFlags(std::ostream & out) override void printFlags(std::ostream & out) override
@ -181,6 +182,9 @@ void mainWrapped(int argc, char * * argv)
downloadSettings.connectTimeout = 1; downloadSettings.connectTimeout = 1;
} }
if (args.refresh)
settings.tarballTtl = 0;
args.command->prepare(); args.command->prepare();
args.command->run(); args.command->run();
} }