forked from lix-project/lix
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
This commit is contained in:
parent
c137c0a5eb
commit
0ac35b67b8
|
@ -3325,6 +3325,11 @@ void DerivationGoal::flushLine()
|
||||||
i->second.progress(json.value("done", 0), json.value("expected", 0), json.value("running", 0), json.value("failed", 0));
|
i->second.progress(json.value("done", 0), json.value("expected", 0), json.value("running", 0), json.value("failed", 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (action == "setPhase") {
|
||||||
|
std::string phase = json["phase"];
|
||||||
|
act->result(resSetPhase, phase);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (std::exception & e) {
|
} catch (std::exception & e) {
|
||||||
printError("bad log message from builder: %s", e.what());
|
printError("bad log message from builder: %s", e.what());
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ typedef enum {
|
||||||
resBuildLogLine = 101,
|
resBuildLogLine = 101,
|
||||||
resUntrustedPath = 102,
|
resUntrustedPath = 102,
|
||||||
resCorruptedPath = 103,
|
resCorruptedPath = 103,
|
||||||
|
resSetPhase = 104,
|
||||||
} ResultType;
|
} ResultType;
|
||||||
|
|
||||||
typedef uint64_t ActivityId;
|
typedef uint64_t ActivityId;
|
||||||
|
|
|
@ -66,7 +66,7 @@ private:
|
||||||
|
|
||||||
struct ActInfo
|
struct ActInfo
|
||||||
{
|
{
|
||||||
std::string s, s2;
|
std::string s, lastLine, phase;
|
||||||
ActivityType type = actUnknown;
|
ActivityType type = actUnknown;
|
||||||
uint64_t done = 0;
|
uint64_t done = 0;
|
||||||
uint64_t expected = 0;
|
uint64_t expected = 0;
|
||||||
|
@ -232,13 +232,13 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type == resBuildLogLine) {
|
else if (type == resBuildLogLine) {
|
||||||
auto s2 = trim(getS(fields, 0));
|
auto lastLine = trim(getS(fields, 0));
|
||||||
if (!s2.empty()) {
|
if (!lastLine.empty()) {
|
||||||
auto i = state->its.find(act);
|
auto i = state->its.find(act);
|
||||||
assert(i != state->its.end());
|
assert(i != state->its.end());
|
||||||
ActInfo info = *i->second;
|
ActInfo info = *i->second;
|
||||||
state->activities.erase(i->second);
|
state->activities.erase(i->second);
|
||||||
info.s2 = s2;
|
info.lastLine = lastLine;
|
||||||
state->activities.emplace_back(info);
|
state->activities.emplace_back(info);
|
||||||
i->second = std::prev(state->activities.end());
|
i->second = std::prev(state->activities.end());
|
||||||
update(*state);
|
update(*state);
|
||||||
|
@ -254,6 +254,12 @@ public:
|
||||||
state->corruptedPaths++;
|
state->corruptedPaths++;
|
||||||
update(*state);
|
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()
|
void update()
|
||||||
|
@ -277,14 +283,19 @@ public:
|
||||||
if (!status.empty()) line += " ";
|
if (!status.empty()) line += " ";
|
||||||
auto i = state.activities.rbegin();
|
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;
|
++i;
|
||||||
|
|
||||||
if (i != state.activities.rend()) {
|
if (i != state.activities.rend()) {
|
||||||
line += i->s;
|
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 += ": ";
|
if (!i->s.empty()) line += ": ";
|
||||||
line += i->s2;
|
line += i->lastLine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue