StorePathsCommand: Don't build installables
On second though this was annoying. E.g. "nix log nixpkgs.hello" would build/download Hello first, even though the log can be fetched directly from the binary cache. May need to revisit this.
This commit is contained in:
parent
15e8bd3bcb
commit
6438ba22af
|
@ -23,7 +23,7 @@ struct CmdBuild : MixDryRun, InstallablesCommand
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto paths = buildInstallables(store, dryRun);
|
auto paths = toStorePaths(store, dryRun ? DryRun : Build);
|
||||||
|
|
||||||
printInfo("build result: %s", showPaths(paths));
|
printInfo("build result: %s", showPaths(paths));
|
||||||
}
|
}
|
||||||
|
|
|
@ -115,7 +115,7 @@ void StorePathsCommand::run(ref<Store> store)
|
||||||
}
|
}
|
||||||
|
|
||||||
else {
|
else {
|
||||||
for (auto & p : buildInstallables(store, false))
|
for (auto & p : toStorePaths(store, NoBuild))
|
||||||
storePaths.push_back(p);
|
storePaths.push_back(p);
|
||||||
|
|
||||||
if (recursive) {
|
if (recursive) {
|
||||||
|
@ -131,7 +131,7 @@ void StorePathsCommand::run(ref<Store> store)
|
||||||
|
|
||||||
void StorePathCommand::run(ref<Store> store)
|
void StorePathCommand::run(ref<Store> store)
|
||||||
{
|
{
|
||||||
auto storePaths = buildInstallables(store, false);
|
auto storePaths = toStorePaths(store, NoBuild);
|
||||||
|
|
||||||
if (storePaths.size() != 1)
|
if (storePaths.size() != 1)
|
||||||
throw UsageError("this command requires exactly one store path");
|
throw UsageError("this command requires exactly one store path");
|
||||||
|
|
|
@ -80,7 +80,9 @@ struct InstallablesCommand : virtual Args, StoreCommand
|
||||||
|
|
||||||
std::vector<std::shared_ptr<Installable>> parseInstallables(ref<Store> store, Strings ss);
|
std::vector<std::shared_ptr<Installable>> parseInstallables(ref<Store> store, Strings ss);
|
||||||
|
|
||||||
PathSet buildInstallables(ref<Store> store, bool dryRun);
|
enum ToStorePathsMode { Build, NoBuild, DryRun };
|
||||||
|
|
||||||
|
PathSet toStorePaths(ref<Store> store, ToStorePathsMode mode);
|
||||||
|
|
||||||
ref<EvalState> getEvalState();
|
ref<EvalState> getEvalState();
|
||||||
|
|
||||||
|
|
|
@ -214,7 +214,7 @@ std::vector<std::shared_ptr<Installable>> InstallablesCommand::parseInstallables
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
PathSet InstallablesCommand::buildInstallables(ref<Store> store, bool dryRun)
|
PathSet InstallablesCommand::toStorePaths(ref<Store> store, ToStorePathsMode mode)
|
||||||
{
|
{
|
||||||
PathSet buildables;
|
PathSet buildables;
|
||||||
|
|
||||||
|
@ -223,9 +223,9 @@ PathSet InstallablesCommand::buildInstallables(ref<Store> store, bool dryRun)
|
||||||
buildables.insert(b.begin(), b.end());
|
buildables.insert(b.begin(), b.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dryRun)
|
if (mode == DryRun)
|
||||||
printMissing(store, buildables);
|
printMissing(store, buildables);
|
||||||
else
|
else if (mode == Build)
|
||||||
store->buildPaths(buildables);
|
store->buildPaths(buildables);
|
||||||
|
|
||||||
PathSet outPaths;
|
PathSet outPaths;
|
||||||
|
|
|
@ -30,7 +30,7 @@ struct CmdRun : InstallablesCommand
|
||||||
|
|
||||||
void run(ref<Store> store) override
|
void run(ref<Store> store) override
|
||||||
{
|
{
|
||||||
auto outPaths = buildInstallables(store, false);
|
auto outPaths = toStorePaths(store, Build);
|
||||||
|
|
||||||
auto store2 = store.dynamic_pointer_cast<LocalStore>();
|
auto store2 = store.dynamic_pointer_cast<LocalStore>();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue