about summary refs log tree commit diff
path: root/third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
committerVincent Ambo <tazjin@google.com>2020-05-25T01·19+0100
commitb99b368d17f2e806a61f7abb83c6d3a9e4bbdc38 (patch)
tree1f76047dd027421dcf79cdf4804fa5ff1bb08b2b /third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc
parent8cf1322a6fd5ae282d8a09fdba634f27a1a88560 (diff)
refactor(3p/nix/libutil): Replace hasPrefix/Suffix with Abseil r/845
Uses the equivalent absl::StartsWith and absl::EndsWith functions
instead.
Diffstat (limited to 'third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc')
-rw-r--r--third_party/nix/src/nix-prefetch-url/nix-prefetch-url.cc6
1 files changed, 4 insertions, 2 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 a2cd570986e8..c5b649fac7d7 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,5 +1,6 @@
 #include <iostream>
 
+#include <absl/strings/match.h>
 #include <fcntl.h>
 #include <glog/logging.h>
 #include <sys/stat.h>
@@ -51,7 +52,8 @@ std::string resolveMirrorUri(EvalState& state, std::string uri) {
 
   std::string mirror =
       state.forceString(*mirrorList->second.value->listElems()[0]);
-  return mirror + (hasSuffix(mirror, "/") ? "" : "/") + std::string(s, p + 1);
+  return mirror + (absl::EndsWith(mirror, "/") ? "" : "/") +
+         std::string(s, p + 1);
 }
 
 static int _main(int argc, char** argv) {
@@ -203,7 +205,7 @@ static int _main(int argc, char** argv) {
         LOG(INFO) << "unpacking...";
         Path unpacked = (Path)tmpDir + "/unpacked";
         createDirs(unpacked);
-        if (hasSuffix(baseNameOf(uri), ".zip")) {
+        if (absl::EndsWith(baseNameOf(uri), ".zip")) {
           runProgram("unzip", true, {"-qq", tmpFile, "-d", unpacked});
         } else {
           // FIXME: this requires GNU tar for decompression.