mirror of
https://github.com/NixOS/nix.git
synced 2025-11-14 22:42:41 +01:00
Add makeFixedOutputPathFromCA function
This puts what we are already doing into a shared method. It just needs a path name and a ca and produces a store path.
This commit is contained in:
parent
006f1252d2
commit
b2cb288cdd
3 changed files with 26 additions and 22 deletions
|
|
@ -862,15 +862,10 @@ void LocalStore::querySubstitutablePathInfos(const StorePathSet & paths,
|
|||
for (auto & path : paths) {
|
||||
auto subPath(path.clone());
|
||||
|
||||
auto ca_ = pathsCA.find(printStorePath(path));
|
||||
auto ca = pathsCA.find(printStorePath(path));
|
||||
// recompute store path so that we can use a different store root
|
||||
if (ca_ != pathsCA.end()) {
|
||||
auto ca(ca_->second);
|
||||
if (!hasPrefix(ca, "fixed:"))
|
||||
continue;
|
||||
FileIngestionMethod ingestionMethod { ca.compare(6, 2, "r:") == 0 };
|
||||
Hash hash(std::string(ca, ingestionMethod == FileIngestionMethod::Recursive ? 8 : 6));
|
||||
subPath = makeFixedOutputPath(ingestionMethod, hash, path.name());
|
||||
if (ca != pathsCA.end() && (hasPrefix(ca->second, "fixed:") || hasPrefix(ca->second, "text:"))) {
|
||||
subPath = makeFixedOutputPathFromCA(path.name(), ca->second);
|
||||
if (subPath != path)
|
||||
debug("replaced path '%s' with '%s' for substituter '%s'", printStorePath(path), sub->printStorePath(subPath), sub->getUri());
|
||||
} else if (sub->storeDir != storeDir) continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue