about summary refs log tree commit diff
path: root/third_party/nix/src/nix-prefetch-url
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T03·52+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T03·52+0100
commit95a57f15ca795eb1b36363b7d6db6b88bfe444e2 (patch)
treead9328cded554eb7d3e153075c6750a17ca39803 /third_party/nix/src/nix-prefetch-url
parent9aa2ecd78cc865f69a9e978ae55ab0f3eda73c46 (diff)
refactor(3p/nix/nix-*): Replace logging with glog in binaries r/762
Diffstat (limited to 'third_party/nix/src/nix-prefetch-url')
-rw-r--r--third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc16
1 files changed, 6 insertions, 10 deletions
diff --git a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
index 223f65c4a8e4..0f6b9454c0bf 100644
--- a/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
+++ b/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
@@ -1,4 +1,5 @@
 #include <fcntl.h>
+#include <glog/logging.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <iostream>
@@ -10,7 +11,6 @@
 #include "finally.hh"
 #include "hash.hh"
 #include "legacy.hh"
-#include "progress-bar.hh"
 #include "shared.hh"
 #include "store-api.hh"
 
@@ -92,10 +92,6 @@ static int _main(int argc, char** argv) {
 
     if (args.size() > 2) throw UsageError("too many arguments");
 
-    Finally f([]() { stopProgressBar(); });
-
-    if (isatty(STDERR_FILENO)) startProgressBar();
-
     auto store = openStore();
     auto state = std::make_unique<EvalState>(myArgs.searchPath, store);
 
@@ -126,7 +122,7 @@ static int _main(int argc, char** argv) {
       /* Extract the hash mode. */
       attr = v.attrs->find(state->symbols.create("outputHashMode"));
       if (attr == v.attrs->end())
-        printInfo("warning: this does not look like a fetchurl call");
+        LOG(WARNING) << "this does not look like a fetchurl call";
       else
         unpack = state->forceString(*attr->value) == "recursive";
 
@@ -176,7 +172,7 @@ static int _main(int argc, char** argv) {
 
       /* Optionally unpack the file. */
       if (unpack) {
-        printInfo("unpacking...");
+        LOG(INFO) << "unpacking...";
         Path unpacked = (Path)tmpDir + "/unpacked";
         createDirs(unpacked);
         if (hasSuffix(baseNameOf(uri), ".zip"))
@@ -210,9 +206,9 @@ static int _main(int argc, char** argv) {
       assert(storePath == store->makeFixedOutputPath(unpack, hash, name));
     }
 
-    stopProgressBar();
-
-    if (!printPath) printInfo(format("path is '%1%'") % storePath);
+    if (!printPath) {
+      LOG(INFO) << "path is '" << storePath << "'";
+    }
 
     std::cout << printHash16or32(hash) << std::endl;
     if (printPath) std::cout << storePath << std::endl;