Restore activity metadata

This allows the progress bar to display "building perl-5.22.3" instead
of "building /nix/store/<hash>-perl-5.22.3.drv".
This commit is contained in:
Eelco Dolstra 2017-08-25 14:53:50 +02:00
parent 1f56235438
commit 0e9ddcc306
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
4 changed files with 43 additions and 27 deletions

View file

@ -93,7 +93,8 @@ public:
update(state);
}
void startActivity(ActivityId act, ActivityType type, const std::string & s) override
void startActivity(ActivityId act, ActivityType type, const std::string & s,
const Fields & fields) override
{
auto state(state_.lock());
@ -102,6 +103,13 @@ public:
state->its.emplace(act, i);
state->activitiesByType[type].its.emplace(act, i);
if (type == actBuild) {
auto name = storePathToName(getS(fields, 0));
if (hasSuffix(name, ".drv"))
name.resize(name.size() - 4);
i->s = fmt("building " ANSI_BOLD "%s" ANSI_NORMAL, name);
}
update(*state);
}