Progress indicator: Show on what machine we're building

E.g.

  $ nix build nixpkgs.hello --builders 'root@wendy'
  [1/0/1 built] building hello-2.10 on ssh://root@wendy: checking for minix/config.h... no
This commit is contained in:
Eelco Dolstra 2017-10-24 14:24:57 +02:00
parent f8624762ac
commit be220702a7
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 11 additions and 4 deletions

View file

@ -196,7 +196,7 @@ int main (int argc, char * * argv)
} }
connected: connected:
std::cerr << "# accept\n"; std::cerr << "# accept\n" << storeUri << "\n";
auto inputs = readStrings<PathSet>(source); auto inputs = readStrings<PathSet>(source);
auto outputs = readStrings<PathSet>(source); auto outputs = readStrings<PathSet>(source);

View file

@ -852,6 +852,9 @@ private:
std::map<ActivityId, Activity> builderActivities; std::map<ActivityId, Activity> builderActivities;
/* The remote machine on which we're building. */
std::string machineName;
public: public:
DerivationGoal(const Path & drvPath, const StringSet & wantedOutputs, DerivationGoal(const Path & drvPath, const StringSet & wantedOutputs,
Worker & worker, BuildMode buildMode = bmNormal); Worker & worker, BuildMode buildMode = bmNormal);
@ -1400,7 +1403,8 @@ void DerivationGoal::tryToBuild()
auto started = [&]() { auto started = [&]() {
act = std::make_unique<Activity>(*logger, lvlInfo, actBuild, act = std::make_unique<Activity>(*logger, lvlInfo, actBuild,
fmt("building '%s'", drvPath), Logger::Fields{drvPath}); fmt("building '%s'", drvPath),
Logger::Fields{drvPath, hook ? machineName : ""});
mcRunningBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds); mcRunningBuilds = std::make_unique<MaintainCount<uint64_t>>(worker.runningBuilds);
worker.updateProgress(); worker.updateProgress();
}; };
@ -1691,10 +1695,10 @@ HookReply DerivationGoal::tryBuildHook()
throw; throw;
} }
printMsg(lvlTalkative, format("using hook to build path(s) %1%") % showPaths(missingPaths));
hook = std::move(worker.hook); hook = std::move(worker.hook);
machineName = readLine(hook->fromHook.readSide.get());
/* Tell the hook all the inputs that have to be copied to the /* Tell the hook all the inputs that have to be copied to the
remote system. */ remote system. */
hook->sink << inputPaths; hook->sink << inputPaths;

View file

@ -156,6 +156,9 @@ public:
if (hasSuffix(name, ".drv")) if (hasSuffix(name, ".drv"))
name.resize(name.size() - 4); name.resize(name.size() - 4);
i->s = fmt("building " ANSI_BOLD "%s" ANSI_NORMAL, name); i->s = fmt("building " ANSI_BOLD "%s" ANSI_NORMAL, name);
auto machineName = getS(fields, 1);
if (machineName != "")
i->s += fmt(" on " ANSI_BOLD "%s" ANSI_NORMAL, machineName);
} }
if (type == actSubstitute) { if (type == actSubstitute) {