mirror of
https://github.com/NixOS/nix.git
synced 2025-11-21 09:49:36 +01:00
Progress bar: Handle verify
This commit is contained in:
parent
2f512dd29f
commit
07ba1eb67e
3 changed files with 46 additions and 3 deletions
|
|
@ -122,6 +122,7 @@ private:
|
||||||
idQueryMissing,
|
idQueryMissing,
|
||||||
idCopyPaths,
|
idCopyPaths,
|
||||||
idBuilds,
|
idBuilds,
|
||||||
|
idVerifyPaths,
|
||||||
idStatus,
|
idStatus,
|
||||||
idQuit
|
idQuit
|
||||||
};
|
};
|
||||||
|
|
@ -448,12 +449,16 @@ public:
|
||||||
i->ignored = true;
|
i->ignored = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (type == actVerifyPath)
|
||||||
|
i->s = getS(fields, 0);
|
||||||
|
|
||||||
if (type == actFileTransfer
|
if (type == actFileTransfer
|
||||||
|| (type == actCopyPath && hasAncestor(*state, actSubstitute, parent)) // FIXME?
|
|| (type == actCopyPath && hasAncestor(*state, actSubstitute, parent)) // FIXME?
|
||||||
|| type == actBuild
|
|| type == actBuild
|
||||||
|| type == actSubstitute
|
|| type == actSubstitute
|
||||||
|| type == actLockFlake
|
|| type == actLockFlake
|
||||||
|| type == actQueryMissing)
|
|| type == actQueryMissing
|
||||||
|
|| type == actVerifyPath)
|
||||||
i->visible = false;
|
i->visible = false;
|
||||||
|
|
||||||
if (type == actBuild)
|
if (type == actBuild)
|
||||||
|
|
@ -613,6 +618,8 @@ public:
|
||||||
|
|
||||||
auto doneMark = ANSI_GREEN "✓";
|
auto doneMark = ANSI_GREEN "✓";
|
||||||
|
|
||||||
|
auto failMark = ANSI_RED "✗";
|
||||||
|
|
||||||
if (state.activitiesByType.count(actEvaluate)) {
|
if (state.activitiesByType.count(actEvaluate)) {
|
||||||
state.statusLines.insert_or_assign({idEvaluate, 0},
|
state.statusLines.insert_or_assign({idEvaluate, 0},
|
||||||
fmt("%s Evaluate",
|
fmt("%s Evaluate",
|
||||||
|
|
@ -719,7 +726,7 @@ public:
|
||||||
{idBuilds, n++},
|
{idBuilds, n++},
|
||||||
fmt("%s Build %d / %d derivations",
|
fmt("%s Build %d / %d derivations",
|
||||||
builds.failed
|
builds.failed
|
||||||
? ANSI_RED "✗"
|
? failMark
|
||||||
: builds.running || builds.done < builds.expected
|
: builds.running || builds.done < builds.expected
|
||||||
? busyMark
|
? busyMark
|
||||||
: doneMark,
|
: doneMark,
|
||||||
|
|
@ -742,6 +749,39 @@ public:
|
||||||
|
|
||||||
state.statusLines.insert_or_assign({idBuilds, n++}, "");
|
state.statusLines.insert_or_assign({idBuilds, n++}, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto verify = getActivityStats(state.activitiesByType[actVerifyPaths]);
|
||||||
|
|
||||||
|
if (verify.done || verify.expected) {
|
||||||
|
removeStatusLines(state, idVerifyPaths);
|
||||||
|
|
||||||
|
auto bad = state.corruptedPaths + state.untrustedPaths + verify.failed;
|
||||||
|
|
||||||
|
size_t n = 0;
|
||||||
|
state.statusLines.insert_or_assign(
|
||||||
|
{idVerifyPaths, n++},
|
||||||
|
fmt("%s Verify %d / %d paths",
|
||||||
|
verify.done < verify.expected
|
||||||
|
? busyMark
|
||||||
|
: bad
|
||||||
|
? failMark
|
||||||
|
: doneMark,
|
||||||
|
verify.done, verify.expected)
|
||||||
|
+ (state.corruptedPaths ? fmt(", %d corrupted", state.corruptedPaths) : "")
|
||||||
|
+ (state.untrustedPaths ? fmt(", %d untrusted", state.untrustedPaths) : "")
|
||||||
|
+ (verify.failed ? fmt(", %d failed", verify.failed) : "")
|
||||||
|
);
|
||||||
|
|
||||||
|
state.statusLines.insert_or_assign({idVerifyPaths, n++},
|
||||||
|
fmt(" %s", renderBar(verify.done - bad, bad, verify.running, verify.expected)));
|
||||||
|
|
||||||
|
for (auto & build : state.activitiesByType[actVerifyPath].its) {
|
||||||
|
state.statusLines.insert_or_assign({idVerifyPaths, n++},
|
||||||
|
fmt(ANSI_BOLD " ‣ %s", build.second->s));
|
||||||
|
}
|
||||||
|
|
||||||
|
state.statusLines.insert_or_assign({idVerifyPaths, n++}, "");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(State & state, std::optional<std::string_view> msg = {})
|
void draw(State & state, std::optional<std::string_view> msg = {})
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ typedef enum {
|
||||||
actEvaluate = 112,
|
actEvaluate = 112,
|
||||||
actLockFlake = 113,
|
actLockFlake = 113,
|
||||||
actQueryMissing = 114,
|
actQueryMissing = 114,
|
||||||
|
actVerifyPath = 115,
|
||||||
} ActivityType;
|
} ActivityType;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,9 @@ struct CmdVerify : StorePathsCommand
|
||||||
// Note: info->path can be different from storePath
|
// Note: info->path can be different from storePath
|
||||||
// for binary cache stores when using --all (since we
|
// for binary cache stores when using --all (since we
|
||||||
// can't enumerate names efficiently).
|
// can't enumerate names efficiently).
|
||||||
Activity act2(*logger, lvlInfo, actUnknown, fmt("checking '%s'", store->printStorePath(info->path)));
|
Activity act2(*logger, lvlInfo, actVerifyPath,
|
||||||
|
fmt("checking '%s'", store->printStorePath(info->path)),
|
||||||
|
{store->printStorePath(info->path)});
|
||||||
|
|
||||||
if (!noContents) {
|
if (!noContents) {
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue