refactor(3p/nix/libutil): Replace chomp() with absl::strings

This commit is contained in:
Vincent Ambo 2020-05-24 01:36:11 +01:00
parent 10481d2586
commit 06d7b4aebd
15 changed files with 40 additions and 26 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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

View file

@ -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) {

View file

@ -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));
}
};