about summary refs log tree commit diff
path: root/third_party/nix/src/libstore
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-24T00·36+0100
committerVincent Ambo <tazjin@google.com>2020-05-24T01·13+0100
commit06d7b4aebd9e4a1a87f77fe59a8c08392318be5d (patch)
tree264bfbef18b5b93596d6eb805fc9e5647ddadb4b /third_party/nix/src/libstore
parent10481d25861f1c25b53cfbd8119199ef2e918f9f (diff)
refactor(3p/nix/libutil): Replace chomp() with absl::strings r/835
Diffstat (limited to 'third_party/nix/src/libstore')
-rw-r--r--third_party/nix/src/libstore/build.cc9
-rw-r--r--third_party/nix/src/libstore/download.cc6
-rw-r--r--third_party/nix/src/libstore/meson.build2
-rw-r--r--third_party/nix/src/libstore/remote-store.cc3
-rw-r--r--third_party/nix/src/libstore/s3-binary-cache-store.cc3
5 files changed, 16 insertions, 7 deletions
diff --git a/third_party/nix/src/libstore/build.cc b/third_party/nix/src/libstore/build.cc
index feac6fcbfd..266cedc096 100644
--- a/third_party/nix/src/libstore/build.cc
+++ b/third_party/nix/src/libstore/build.cc
@@ -12,6 +12,7 @@
 #include <sstream>
 #include <thread>
 
+#include <absl/strings/ascii.h>
 #include <fcntl.h>
 #include <grp.h>
 #include <netdb.h>
@@ -461,7 +462,7 @@ void handleDiffHook(uid_t uid, uid_t gid, Path tryA, Path tryB, Path drvPath,
       }
 
       if (!diffRes.second.empty()) {
-        LOG(ERROR) << chomp(diffRes.second);
+        LOG(ERROR) << absl::StripTrailingAsciiWhitespace(diffRes.second);
       }
     } catch (Error& error) {
       LOG(ERROR) << "diff hook execution failed: " << error.what();
@@ -1640,7 +1641,8 @@ MakeError(NotDeterministic, BuildError)
 
       hookEnvironment.emplace("DRV_PATH", drvPath);
       hookEnvironment.emplace("OUT_PATHS",
-                              chomp(concatStringsSep(" ", outputPaths)));
+                              absl::StripTrailingAsciiWhitespace(
+                                  concatStringsSep(" ", outputPaths)));
 
       RunOptions opts(settings.postBuildHook, {});
       opts.environment = hookEnvironment;
@@ -1788,7 +1790,8 @@ HookReply DerivationGoal::tryBuildHook() {
   } catch (SysError& e) {
     if (e.errNo == EPIPE) {
       LOG(ERROR) << "build hook died unexpectedly: "
-                 << chomp(drainFD(worker.hook->fromHook.readSide.get()));
+                 << absl::StripTrailingAsciiWhitespace(
+                        drainFD(worker.hook->fromHook.readSide.get()));
       worker.hook = nullptr;
       return rpDecline;
     }
diff --git a/third_party/nix/src/libstore/download.cc b/third_party/nix/src/libstore/download.cc
index 7476dd50b5..8767344787 100644
--- a/third_party/nix/src/libstore/download.cc
+++ b/third_party/nix/src/libstore/download.cc
@@ -1,5 +1,7 @@
 #include "download.hh"
 
+#include <absl/strings/ascii.h>
+
 #include "archive.hh"
 #include "compression.hh"
 #include "finally.hh"
@@ -231,7 +233,9 @@ struct CurlDownloader : public Downloader {
     static int debugCallback(CURL* handle, curl_infotype type, char* data,
                              size_t size, void* userptr) {
       if (type == CURLINFO_TEXT) {
-        DLOG(INFO) << "curl: " << chomp(std::string(data, size));
+        DLOG(INFO) << "curl: "
+                   << absl::StripTrailingAsciiWhitespace(
+                          std::string(data, size));
       }
       return 0;
     }
diff --git a/third_party/nix/src/libstore/meson.build b/third_party/nix/src/libstore/meson.build
index 47f6ddf259..b8564f24f8 100644
--- a/third_party/nix/src/libstore/meson.build
+++ b/third_party/nix/src/libstore/meson.build
@@ -80,7 +80,7 @@ libstore_dep_list = [
     pthread_dep,
     sqlite3_dep,
     libsodium_dep
-]
+] + absl_deps
 
 if sys_name.contains('linux')
     libstore_dep_list += libseccomp_dep
diff --git a/third_party/nix/src/libstore/remote-store.cc b/third_party/nix/src/libstore/remote-store.cc
index c4215800da..cc6f6ebae9 100644
--- a/third_party/nix/src/libstore/remote-store.cc
+++ b/third_party/nix/src/libstore/remote-store.cc
@@ -3,6 +3,7 @@
 #include <cerrno>
 #include <cstring>
 
+#include <absl/strings/ascii.h>
 #include <fcntl.h>
 #include <glog/logging.h>
 #include <sys/socket.h>
@@ -715,7 +716,7 @@ std::exception_ptr RemoteStore::Connection::processStderr(Sink* sink,
     }
 
     else if (msg == STDERR_NEXT) {
-      LOG(ERROR) << chomp(readString(from));
+      LOG(ERROR) << absl::StripTrailingAsciiWhitespace(readString(from));
     }
 
     else if (msg == STDERR_START_ACTIVITY) {
diff --git a/third_party/nix/src/libstore/s3-binary-cache-store.cc b/third_party/nix/src/libstore/s3-binary-cache-store.cc
index 483ddc19a3..df3afab3cf 100644
--- a/third_party/nix/src/libstore/s3-binary-cache-store.cc
+++ b/third_party/nix/src/libstore/s3-binary-cache-store.cc
@@ -2,6 +2,7 @@
 
 #include "s3-binary-cache-store.hh"
 
+#include <absl/strings/ascii.h>
 #include <aws/core/Aws.h>
 #include <aws/core/VersionConfig.h>
 #include <aws/core/auth/AWSCredentialsProvider.h>
@@ -50,7 +51,7 @@ class AwsLogger : public Aws::Utils::Logging::FormattedLogSystem {
   using Aws::Utils::Logging::FormattedLogSystem::FormattedLogSystem;
 
   void ProcessFormattedStatement(Aws::String&& statement) override {
-    debug("AWS: %s", chomp(statement));
+    debug("AWS: %s", absl::StripTrailingAsciiWhitespace(statement));
   }
 };