diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-08-25T16·04+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-08-25T16·04+0200 |
commit | 0ac35b67b8035ad1166df3fb199590bc346d71f2 (patch) | |
tree | ee26ea6fc3ef46a056e8adfa17383f844c8b410a /src/nix | |
parent | c137c0a5ebc0d58c53f86986ab66967ac8629cbe (diff) |
Allow derivations to update the build phase
So the progress bar can show [1/0/1 built, 0.0 MiB DL] building hello-2.10 (configuring): checking whether pread is declared without a macro... yes
Diffstat (limited to 'src/nix')
-rw-r--r-- | src/nix/progress-bar.cc | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc index 1b597433b30e..90e54ed48a21 100644 --- a/src/nix/progress-bar.cc +++ b/src/nix/progress-bar.cc @@ -66,7 +66,7 @@ private: struct ActInfo { - std::string s, s2; + std::string s, lastLine, phase; ActivityType type = actUnknown; uint64_t done = 0; uint64_t expected = 0; @@ -232,13 +232,13 @@ public: } else if (type == resBuildLogLine) { - auto s2 = trim(getS(fields, 0)); - if (!s2.empty()) { + auto lastLine = trim(getS(fields, 0)); + if (!lastLine.empty()) { auto i = state->its.find(act); assert(i != state->its.end()); ActInfo info = *i->second; state->activities.erase(i->second); - info.s2 = s2; + info.lastLine = lastLine; state->activities.emplace_back(info); i->second = std::prev(state->activities.end()); update(*state); @@ -254,6 +254,12 @@ public: state->corruptedPaths++; update(*state); } + + else if (type == resSetPhase) { + auto i = state->its.find(act); + assert(i != state->its.end()); + i->second->phase = getS(fields, 0); + } } void update() @@ -277,14 +283,19 @@ public: if (!status.empty()) line += " "; auto i = state.activities.rbegin(); - while (i != state.activities.rend() && (!i->visible || (i->s.empty() && i->s2.empty()))) + while (i != state.activities.rend() && (!i->visible || (i->s.empty() && i->lastLine.empty()))) ++i; if (i != state.activities.rend()) { line += i->s; - if (!i->s2.empty()) { + if (!i->phase.empty()) { + line += " ("; + line += i->phase; + line += ")"; + } + if (!i->lastLine.empty()) { if (!i->s.empty()) line += ": "; - line += i->s2; + line += i->lastLine; } } } |