aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/local-store.cc
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2020-06-12 16:36:35 -0500
committerMatthew Bauer <mjbauer95@gmail.com>2020-06-12 16:36:35 -0500
commitb2cb288cdd462cbca35ffd3afda9d7ec2d595209 (patch)
tree54664ee0bfc61bc6a0086f52a6279acc6e67e85a /src/libstore/local-store.cc
parent006f1252d2fdb36c7ee66bf79f0df2ab8cd16816 (diff)
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.
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r--src/libstore/local-store.cc11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc
index bf005a3b3..9158a52e0 100644
--- a/src/libstore/local-store.cc
+++ b/src/libstore/local-store.cc
@@ -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;