about summary refs log tree commit diff
path: root/src/nix/progress-bar.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-16T17·23+0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-16T18·56+0200
commitc2cab207320672fb6ed4af40a99fc9082ff55234 (patch)
treec966ed39598be295be7fe663054e2ff92ecf5e92 /src/nix/progress-bar.cc
parentb4ed97e3a3116909fcaa79f5ce84487ed3838112 (diff)
nix verify: Restore the progress indicator
Diffstat (limited to 'src/nix/progress-bar.cc')
-rw-r--r--src/nix/progress-bar.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc
index cc2928472d13..1616c420551a 100644
--- a/src/nix/progress-bar.cc
+++ b/src/nix/progress-bar.cc
@@ -57,6 +57,8 @@ private:
         std::map<ActivityType, ActivitiesByType> activitiesByType;
 
         uint64_t filesLinked = 0, bytesLinked = 0;
+
+        uint64_t corruptedPaths = 0, untrustedPaths = 0;
     };
 
     Sync<State> state_;
@@ -179,6 +181,16 @@ public:
                 update(*state);
             }
         }
+
+        else if (type == resUntrustedPath) {
+            state->untrustedPaths++;
+            update(*state);
+        }
+
+        else if (type == resCorruptedPath) {
+            state->corruptedPaths++;
+            update(*state);
+        }
     }
 
     void update()
@@ -285,6 +297,19 @@ public:
             }
         }
 
+        // FIXME: don't show "done" paths in green.
+        showActivity(actVerifyPaths, "%s paths verified");
+
+        if (state.corruptedPaths) {
+            if (!res.empty()) res += ", ";
+            res += fmt(ANSI_RED "%d corrupted" ANSI_NORMAL, state.corruptedPaths);
+        }
+
+        if (state.untrustedPaths) {
+            if (!res.empty()) res += ", ";
+            res += fmt(ANSI_RED "%d untrusted" ANSI_NORMAL, state.untrustedPaths);
+        }
+
         return res;
     }
 };