about summary refs log tree commit diff
path: root/third_party/nix/src/libexpr/primops
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-19T00·24+0100
committerVincent Ambo <tazjin@google.com>2020-05-19T00·24+0100
commit939dd9f8176266add4d88572203739fa74b14fa5 (patch)
treea1458c60656ee8d11651888b3b622039e65d8bca /third_party/nix/src/libexpr/primops
parentd0c44425e147ab7d38410f400825ad20da15037b (diff)
refactor(3p/nix/libexpr): Replace logging.h with glog r/758
Diffstat (limited to '')
-rw-r--r--third_party/nix/src/libexpr/primops.cc16
-rw-r--r--third_party/nix/src/libexpr/primops/fetchGit.cc6
-rw-r--r--third_party/nix/src/libexpr/primops/fetchMercurial.cc9
3 files changed, 15 insertions, 16 deletions
diff --git a/third_party/nix/src/libexpr/primops.cc b/third_party/nix/src/libexpr/primops.cc
index 9d6d4eaba5..05fa9c4828 100644
--- a/third_party/nix/src/libexpr/primops.cc
+++ b/third_party/nix/src/libexpr/primops.cc
@@ -19,6 +19,7 @@
 #include "util.hh"
 #include "value-to-json.hh"
 #include "value-to-xml.hh"
+#include <glog/logging.h>
 
 namespace nix {
 
@@ -139,7 +140,7 @@ static void prim_scopedImport(EvalState& state, const Pos& pos, Value** args,
         env->values[displ++] = attr.value;
       }
 
-      printTalkative("evaluating file '%1%'", realPath);
+      DLOG(INFO) << "evaluating file '" << realPath << "'";
       Expr* e = state.parseExprFromFile(resolveExprPath(realPath), staticEnv);
 
       e->eval(state, *env, v);
@@ -504,10 +505,11 @@ static void prim_deepSeq(EvalState& state, const Pos& pos, Value** args,
 static void prim_trace(EvalState& state, const Pos& pos, Value** args,
                        Value& v) {
   state.forceValue(*args[0]);
-  if (args[0]->type == tString)
-    printError(format("trace: %1%") % args[0]->string.s);
-  else
-    printError(format("trace: %1%") % *args[0]);
+  if (args[0]->type == tString) {
+    DLOG(INFO) << "trace: " << args[0]->string.s;
+  } else {
+    DLOG(INFO)<< "trace: " << *args[0];
+  }
   state.forceValue(*args[1]);
   v = *args[1];
 }
@@ -575,7 +577,6 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
   for (auto& i : args[0]->attrs->lexicographicOrder()) {
     if (i->name == state.sIgnoreNulls) continue;
     const string& key = i->name;
-    vomit("processing attribute '%1%'", key);
 
     auto handleHashMode = [&](const std::string& s) {
       if (s == "recursive")
@@ -781,8 +782,7 @@ static void prim_derivationStrict(EvalState& state, const Pos& pos,
   /* Write the resulting term into the Nix store directory. */
   Path drvPath = writeDerivation(state.store, drv, drvName, state.repair);
 
-  printMsg(lvlChatty,
-           format("instantiated '%1%' -> '%2%'") % drvName % drvPath);
+  DLOG(INFO) << "instantiated '" << drvName << "' -> '" << drvPath << "'";
 
   /* Optimisation, but required in read-only mode! because in that
      case we don't actually write store derivations, so we can't
diff --git a/third_party/nix/src/libexpr/primops/fetchGit.cc b/third_party/nix/src/libexpr/primops/fetchGit.cc
index e1edf9a3e5..07a0770a3f 100644
--- a/third_party/nix/src/libexpr/primops/fetchGit.cc
+++ b/third_party/nix/src/libexpr/primops/fetchGit.cc
@@ -7,6 +7,7 @@
 #include "pathlocks.hh"
 #include "primops.hh"
 #include "store-api.hh"
+#include <glog/logging.h>
 
 using namespace std::string_literals;
 
@@ -119,8 +120,7 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
               (uint64_t)st.st_mtime + settings.tarballTtl <= (uint64_t)now;
   }
   if (doFetch) {
-    Activity act(*logger, lvlTalkative, actUnknown,
-                 fmt("fetching Git repository '%s'", uri));
+    DLOG(INFO) << "fetching Git repository '" << uri << "'";
 
     // FIXME: git stderr messes up our progress indicator, so
     // we're using --quiet for now. Should process its stderr.
@@ -142,7 +142,7 @@ GitInfo exportGit(ref<Store> store, const std::string& uri,
   gitInfo.rev = rev != "" ? rev : chomp(readFile(localRefFile));
   gitInfo.shortRev = std::string(gitInfo.rev, 0, 7);
 
-  printTalkative("using revision %s of repo '%s'", gitInfo.rev, uri);
+  DLOG(INFO) << "using revision " << gitInfo.rev << " of repo '" << uri << "'";
 
   std::string storeLinkName =
       hashString(htSHA512, name + std::string("\0"s) + gitInfo.rev)
diff --git a/third_party/nix/src/libexpr/primops/fetchMercurial.cc b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
index 1ee12542ef..677855e853 100644
--- a/third_party/nix/src/libexpr/primops/fetchMercurial.cc
+++ b/third_party/nix/src/libexpr/primops/fetchMercurial.cc
@@ -1,3 +1,4 @@
+#include <glog/logging.h>
 #include <sys/time.h>
 #include <nlohmann/json.hpp>
 #include <regex>
@@ -36,7 +37,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
       /* This is an unclean working tree. So copy all tracked
          files. */
 
-      printTalkative("copying unclean Mercurial working tree '%s'", uri);
+      DLOG(INFO) << "copying unclean Mercurial working tree '" << uri << "'";
 
       HgInfo hgInfo;
       hgInfo.rev = "0000000000000000000000000000000000000000";
@@ -91,8 +92,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
                                        "--template", "1"})
                          .killStderr(true))
                   .second == "1")) {
-      Activity act(*logger, lvlTalkative, actUnknown,
-                   fmt("fetching Mercurial repository '%s'", uri));
+      DLOG(INFO) << "fetching Mercurial repository '" << uri << "'";
 
       if (pathExists(cacheDir)) {
         try {
@@ -141,8 +141,7 @@ HgInfo exportMercurial(ref<Store> store, const std::string& uri,
     hgInfo.storePath = json["storePath"];
 
     if (store->isValidPath(hgInfo.storePath)) {
-      printTalkative("using cached Mercurial store path '%s'",
-                     hgInfo.storePath);
+      DLOG(INFO) << "using cached Mercurial store path '" << hgInfo.storePath << "'";
       return hgInfo;
     }