diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 1f945ecf6..a849576f6 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1246,10 +1246,8 @@ StorePath LocalStore::addToStoreFromDump( auto desc = ContentAddressWithReferences::fromParts( hashMethod, - methodsMatch - ? dumpHash - : hashPath(PosixSourceAccessor::createAtRoot(tempPath), hashMethod.getFileIngestionMethod(), hashAlgo) - .first, + methodsMatch ? dumpHash + : hashPath(makeFSSourceAccessor(tempPath), hashMethod.getFileIngestionMethod(), hashAlgo).first, { .others = references, // caller is not capable of creating a self-reference, because this is content-addressed without modulus @@ -1385,11 +1383,9 @@ bool LocalStore::verifyStore(bool checkContents, RepairFlag repair) checkInterrupt(); auto name = link.path().filename(); printMsg(lvlTalkative, "checking contents of %s", name); - std::string hash = hashPath( - PosixSourceAccessor::createAtRoot(link.path()), - FileIngestionMethod::NixArchive, - HashAlgorithm::SHA256) - .first.to_string(HashFormat::Nix32, false); + std::string hash = + hashPath(makeFSSourceAccessor(link.path()), FileIngestionMethod::NixArchive, HashAlgorithm::SHA256) + .first.to_string(HashFormat::Nix32, false); if (hash != name.string()) { printError("link %s was modified! expected hash %s, got '%s'", link.path(), name, hash); if (repair) { diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc index 3e02fa812..dca093e04 100644 --- a/src/libstore/optimise-store.cc +++ b/src/libstore/optimise-store.cc @@ -172,7 +172,7 @@ void LocalStore::optimisePath_( auto stLink = lstat(linkPath.string()); if (st.st_size != stLink.st_size || (repair && hash != ({ hashPath( - PosixSourceAccessor::createAtRoot(linkPath), + makeFSSourceAccessor(linkPath), FileSerialisationMethod::NixArchive, HashAlgorithm::SHA256) .hash; diff --git a/src/nix/prefetch.cc b/src/nix/prefetch.cc index d875f8e4b..57bc3740c 100644 --- a/src/nix/prefetch.cc +++ b/src/nix/prefetch.cc @@ -138,8 +138,7 @@ std::tuple prefetchFile( Activity act(*logger, lvlChatty, actUnknown, fmt("adding '%s' to the store", url.to_string())); - auto info = store->addToStoreSlow( - *name, PosixSourceAccessor::createAtRoot(tmpFile), method, hashAlgo, {}, expectedHash); + auto info = store->addToStoreSlow(*name, makeFSSourceAccessor(tmpFile), method, hashAlgo, {}, expectedHash); storePath = info.path; assert(info.ca); hash = info.ca->hash;