aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfetchers')
-rw-r--r--src/libfetchers/fetchers.cc4
-rw-r--r--src/libfetchers/git.cc18
-rw-r--r--src/libfetchers/github.cc12
-rw-r--r--src/libfetchers/mercurial.cc12
-rw-r--r--src/libfetchers/path.cc4
-rw-r--r--src/libfetchers/tarball.cc12
6 files changed, 31 insertions, 31 deletions
diff --git a/src/libfetchers/fetchers.cc b/src/libfetchers/fetchers.cc
index 02fafc65b..9174c3de4 100644
--- a/src/libfetchers/fetchers.cc
+++ b/src/libfetchers/fetchers.cc
@@ -47,7 +47,7 @@ Attrs Input::toAttrs() const
{
auto attrs = toAttrsInternal();
if (narHash)
- attrs.emplace("narHash", narHash->to_string(Base::SRI, true));
+ attrs.emplace("narHash", narHash->to_string(SRI, true));
attrs.emplace("type", type());
return attrs;
}
@@ -67,7 +67,7 @@ std::pair<Tree, std::shared_ptr<const Input>> Input::fetchTree(ref<Store> store)
if (narHash && narHash != input->narHash)
throw Error("NAR hash mismatch in input '%s' (%s), expected '%s', got '%s'",
- to_string(), tree.actualPath, narHash->to_string(Base::SRI, true), input->narHash->to_string(Base::SRI, true));
+ to_string(), tree.actualPath, narHash->to_string(SRI, true), input->narHash->to_string(SRI, true));
return {std::move(tree), input};
}
diff --git a/src/libfetchers/git.cc b/src/libfetchers/git.cc
index 75d70c1b4..75ce5ee8b 100644
--- a/src/libfetchers/git.cc
+++ b/src/libfetchers/git.cc
@@ -95,7 +95,7 @@ struct GitInput : Input
auto input = std::make_shared<GitInput>(*this);
- assert(!rev || rev->type == HashType::SHA1);
+ assert(!rev || rev->type == htSHA1);
std::string cacheType = "git";
if (shallow) cacheType += "-shallow";
@@ -195,7 +195,7 @@ struct GitInput : Input
return files.count(file);
};
- auto storePath = store->addToStore("source", actualUrl, FileIngestionMethod::Recursive, HashType::SHA256, filter);
+ auto storePath = store->addToStore("source", actualUrl, FileIngestionMethod::Recursive, htSHA256, filter);
auto tree = Tree {
.actualPath = store->printStorePath(storePath),
@@ -225,21 +225,21 @@ struct GitInput : Input
if (isLocal) {
if (!input->rev)
- input->rev = Hash(chomp(runProgram("git", true, { "-C", actualUrl, "rev-parse", *input->ref })), HashType::SHA1);
+ input->rev = Hash(chomp(runProgram("git", true, { "-C", actualUrl, "rev-parse", *input->ref })), htSHA1);
repoDir = actualUrl;
} else {
if (auto res = getCache()->lookup(store, mutableAttrs)) {
- auto rev2 = Hash(getStrAttr(res->first, "rev"), HashType::SHA1);
+ auto rev2 = Hash(getStrAttr(res->first, "rev"), htSHA1);
if (!rev || rev == rev2) {
input->rev = rev2;
return makeResult(res->first, std::move(res->second));
}
}
- Path cacheDir = getCacheDir() + "/nix/gitv3/" + hashString(HashType::SHA256, actualUrl).to_string(Base::Base32, false);
+ Path cacheDir = getCacheDir() + "/nix/gitv3/" + hashString(htSHA256, actualUrl).to_string(Base32, false);
repoDir = cacheDir;
if (!pathExists(cacheDir)) {
@@ -277,7 +277,7 @@ struct GitInput : Input
}
if (doFetch) {
- Activity act(*logger, Verbosity::Talkative, ActivityType::Unknown, fmt("fetching Git repository '%s'", actualUrl));
+ Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Git repository '%s'", actualUrl));
// FIXME: git stderr messes up our progress indicator, so
// we're using --quiet for now. Should process its stderr.
@@ -301,7 +301,7 @@ struct GitInput : Input
}
if (!input->rev)
- input->rev = Hash(chomp(readFile(localRefFile)), HashType::SHA1);
+ input->rev = Hash(chomp(readFile(localRefFile)), htSHA1);
}
bool isShallow = chomp(runProgram("git", true, { "-C", repoDir, "rev-parse", "--is-shallow-repository" })) == "true";
@@ -350,7 +350,7 @@ struct GitInput : Input
unpackTarfile(*source, tmpDir);
}
- auto storePath = store->addToStore(name, tmpDir, FileIngestionMethod::Recursive, HashType::SHA256, filter);
+ auto storePath = store->addToStore(name, tmpDir, FileIngestionMethod::Recursive, htSHA256, filter);
auto lastModified = std::stoull(runProgram("git", true, { "-C", repoDir, "log", "-1", "--format=%ct", input->rev->gitRev() }));
@@ -426,7 +426,7 @@ struct GitInputScheme : InputScheme
input->ref = *ref;
}
if (auto rev = maybeGetStrAttr(attrs, "rev"))
- input->rev = Hash(*rev, HashType::SHA1);
+ input->rev = Hash(*rev, htSHA1);
input->shallow = maybeGetBoolAttr(attrs, "shallow").value_or(false);
diff --git a/src/libfetchers/github.cc b/src/libfetchers/github.cc
index ec0573ca3..0bee1d6b3 100644
--- a/src/libfetchers/github.cc
+++ b/src/libfetchers/github.cc
@@ -45,7 +45,7 @@ struct GitHubInput : Input
auto path = owner + "/" + repo;
assert(!(ref && rev));
if (ref) path += "/" + *ref;
- if (rev) path += "/" + rev->to_string(Base::Base16, false);
+ if (rev) path += "/" + rev->to_string(Base16, false);
return ParsedURL {
.scheme = "github",
.path = path,
@@ -76,7 +76,7 @@ struct GitHubInput : Input
readFile(
store->toRealPath(
downloadFile(store, url, "source", false).storePath)));
- rev = Hash(std::string { json["sha"] }, HashType::SHA1);
+ rev = Hash(std::string { json["sha"] }, htSHA1);
debug("HEAD revision for '%s' is %s", url, rev->gitRev());
}
@@ -106,7 +106,7 @@ struct GitHubInput : Input
// might have stricter rate limits.
auto url = fmt("https://api.github.com/repos/%s/%s/tarball/%s",
- owner, repo, rev->to_string(Base::Base16, false));
+ owner, repo, rev->to_string(Base16, false));
std::string accessToken = settings.githubAccessToken.get();
if (accessToken != "")
@@ -140,7 +140,7 @@ struct GitHubInputScheme : InputScheme
if (path.size() == 2) {
} else if (path.size() == 3) {
if (std::regex_match(path[2], revRegex))
- input->rev = Hash(path[2], HashType::SHA1);
+ input->rev = Hash(path[2], htSHA1);
else if (std::regex_match(path[2], refRegex))
input->ref = path[2];
else
@@ -152,7 +152,7 @@ struct GitHubInputScheme : InputScheme
if (name == "rev") {
if (input->rev)
throw BadURL("GitHub URL '%s' contains multiple commit hashes", url.url);
- input->rev = Hash(value, HashType::SHA1);
+ input->rev = Hash(value, htSHA1);
}
else if (name == "ref") {
if (!std::regex_match(value, refRegex))
@@ -185,7 +185,7 @@ struct GitHubInputScheme : InputScheme
input->repo = getStrAttr(attrs, "repo");
input->ref = maybeGetStrAttr(attrs, "ref");
if (auto rev = maybeGetStrAttr(attrs, "rev"))
- input->rev = Hash(*rev, HashType::SHA1);
+ input->rev = Hash(*rev, htSHA1);
return input;
}
};
diff --git a/src/libfetchers/mercurial.cc b/src/libfetchers/mercurial.cc
index feffc48d6..2e0d4bf4d 100644
--- a/src/libfetchers/mercurial.cc
+++ b/src/libfetchers/mercurial.cc
@@ -114,7 +114,7 @@ struct MercurialInput : Input
return files.count(file);
};
- auto storePath = store->addToStore("source", actualUrl, FileIngestionMethod::Recursive, HashType::SHA256, filter);
+ auto storePath = store->addToStore("source", actualUrl, FileIngestionMethod::Recursive, htSHA256, filter);
return {Tree {
.actualPath = store->printStorePath(storePath),
@@ -167,14 +167,14 @@ struct MercurialInput : Input
});
if (auto res = getCache()->lookup(store, mutableAttrs)) {
- auto rev2 = Hash(getStrAttr(res->first, "rev"), HashType::SHA1);
+ auto rev2 = Hash(getStrAttr(res->first, "rev"), htSHA1);
if (!rev || rev == rev2) {
input->rev = rev2;
return makeResult(res->first, std::move(res->second));
}
}
- Path cacheDir = fmt("%s/nix/hg/%s", getCacheDir(), hashString(HashType::SHA256, actualUrl).to_string(Base::Base32, false));
+ Path cacheDir = fmt("%s/nix/hg/%s", getCacheDir(), hashString(htSHA256, actualUrl).to_string(Base32, false));
/* If this is a commit hash that we already have, we don't
have to pull again. */
@@ -184,7 +184,7 @@ struct MercurialInput : Input
RunOptions("hg", { "log", "-R", cacheDir, "-r", input->rev->gitRev(), "--template", "1" })
.killStderr(true)).second == "1"))
{
- Activity act(*logger, Verbosity::Talkative, ActivityType::Unknown, fmt("fetching Mercurial repository '%s'", actualUrl));
+ Activity act(*logger, lvlTalkative, actUnknown, fmt("fetching Mercurial repository '%s'", actualUrl));
if (pathExists(cacheDir)) {
try {
@@ -210,7 +210,7 @@ struct MercurialInput : Input
runProgram("hg", true, { "log", "-R", cacheDir, "-r", revOrRef, "--template", "{node} {rev} {branch}" }));
assert(tokens.size() == 3);
- input->rev = Hash(tokens[0], HashType::SHA1);
+ input->rev = Hash(tokens[0], htSHA1);
auto revCount = std::stoull(tokens[1]);
input->ref = tokens[2];
@@ -293,7 +293,7 @@ struct MercurialInputScheme : InputScheme
input->ref = *ref;
}
if (auto rev = maybeGetStrAttr(attrs, "rev"))
- input->rev = Hash(*rev, HashType::SHA1);
+ input->rev = Hash(*rev, htSHA1);
return input;
}
};
diff --git a/src/libfetchers/path.cc b/src/libfetchers/path.cc
index 3f50addd8..ba2cc192e 100644
--- a/src/libfetchers/path.cc
+++ b/src/libfetchers/path.cc
@@ -101,7 +101,7 @@ struct PathInputScheme : InputScheme
for (auto & [name, value] : url.query)
if (name == "rev")
- input->rev = Hash(value, HashType::SHA1);
+ input->rev = Hash(value, htSHA1);
else if (name == "revCount") {
uint64_t revCount;
if (!string2Int(value, revCount))
@@ -129,7 +129,7 @@ struct PathInputScheme : InputScheme
for (auto & [name, value] : attrs)
if (name == "rev")
- input->rev = Hash(getStrAttr(attrs, "rev"), HashType::SHA1);
+ input->rev = Hash(getStrAttr(attrs, "rev"), htSHA1);
else if (name == "revCount")
input->revCount = getIntAttr(attrs, "revCount");
else if (name == "lastModified")
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index c82b6dd09..ac83d52b9 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -66,9 +66,9 @@ DownloadFileResult downloadFile(
} else {
StringSink sink;
dumpString(*res.data, sink);
- auto hash = hashString(HashType::SHA256, *res.data);
+ auto hash = hashString(htSHA256, *res.data);
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Flat, hash, name));
- info.narHash = hashString(HashType::SHA256, *sink.s);
+ info.narHash = hashString(htSHA256, *sink.s);
info.narSize = sink.s->size();
info.ca = makeFixedOutputCA(FileIngestionMethod::Flat, hash);
auto source = StringSource { *sink.s };
@@ -142,7 +142,7 @@ Tree downloadTarball(
throw nix::Error("tarball '%s' contains an unexpected number of top-level files", url);
auto topDir = tmpDir + "/" + members.begin()->name;
lastModified = lstat(topDir).st_mtime;
- unpackedStorePath = store->addToStore(name, topDir, FileIngestionMethod::Recursive, HashType::SHA256, defaultPathFilter, NoRepair);
+ unpackedStorePath = store->addToStore(name, topDir, FileIngestionMethod::Recursive, htSHA256, defaultPathFilter, NoRepair);
}
Attrs infoAttrs({
@@ -196,9 +196,9 @@ struct TarballInput : Input
// NAR hashes are preferred over file hashes since tar/zip files
// don't have a canonical representation.
if (narHash)
- url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI, true));
+ url2.query.insert_or_assign("narHash", narHash->to_string(SRI, true));
else if (hash)
- url2.query.insert_or_assign("hash", hash->to_string(Base::SRI, true));
+ url2.query.insert_or_assign("hash", hash->to_string(SRI, true));
return url2;
}
@@ -207,7 +207,7 @@ struct TarballInput : Input
Attrs attrs;
attrs.emplace("url", url.to_string());
if (hash)
- attrs.emplace("hash", hash->to_string(Base::SRI, true));
+ attrs.emplace("hash", hash->to_string(SRI, true));
return attrs;
}