aboutsummaryrefslogtreecommitdiff
path: root/src/libfetchers/tarball.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libfetchers/tarball.cc')
-rw-r--r--src/libfetchers/tarball.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/libfetchers/tarball.cc b/src/libfetchers/tarball.cc
index b6e57379b..e8e5231d2 100644
--- a/src/libfetchers/tarball.cc
+++ b/src/libfetchers/tarball.cc
@@ -66,11 +66,14 @@ DownloadFileResult downloadFile(
} else {
StringSink sink;
dumpString(*res.data, sink);
- auto hash = hashString(htSHA256, *res.data);
+ auto hash = hashString(HashType::SHA256, *res.data);
ValidPathInfo info(store->makeFixedOutputPath(FileIngestionMethod::Flat, hash, name));
- info.narHash = hashString(htSHA256, *sink.s);
+ info.narHash = hashString(HashType::SHA256, *sink.s);
info.narSize = sink.s->size();
- info.ca = makeFixedOutputCA(FileIngestionMethod::Flat, hash);
+ info.ca = FileSystemHash {
+ .method = FileIngestionMethod::Flat,
+ .hash = hash,
+ };
auto source = StringSource { *sink.s };
store->addToStore(info, source, NoRepair, NoCheckSigs);
storePath = std::move(info.path);
@@ -142,7 +145,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, htSHA256, defaultPathFilter, NoRepair);
+ unpackedStorePath = store->addToStore(name, topDir, FileIngestionMethod::Recursive, HashType::SHA256, defaultPathFilter, NoRepair);
}
Attrs infoAttrs({
@@ -196,9 +199,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(SRI));
+ url2.query.insert_or_assign("narHash", narHash->to_string(Base::SRI));
else if (hash)
- url2.query.insert_or_assign("hash", hash->to_string(SRI));
+ url2.query.insert_or_assign("hash", hash->to_string(Base::SRI));
return url2;
}
@@ -207,7 +210,7 @@ struct TarballInput : Input
Attrs attrs;
attrs.emplace("url", url.to_string());
if (hash)
- attrs.emplace("hash", hash->to_string(SRI));
+ attrs.emplace("hash", hash->to_string(Base::SRI));
return attrs;
}