aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/store-api.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-11-17 14:01:04 +0100
committerGitHub <noreply@github.com>2020-11-17 14:01:04 +0100
commitdf5c69a94ef20c70bcff1602d9f00af5d32ab4e3 (patch)
tree1f36db7e78ceacc82617dd4edb81556b431cdb96 /src/libstore/store-api.cc
parente6b7c7b79c697f1d8508930964e8c810f04a8963 (diff)
parent3a63fc6cd515fb009b17d864fede23a356832a5e (diff)
Merge pull request #4180 from Ma27/ssh-ng-substitute
Allow substituting paths when building remotely using `ssh-ng://`
Diffstat (limited to 'src/libstore/store-api.cc')
-rw-r--r--src/libstore/store-api.cc22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc
index 7f808f45a..3b2be05cb 100644
--- a/src/libstore/store-api.cc
+++ b/src/libstore/store-api.cc
@@ -522,6 +522,28 @@ void Store::queryPathInfo(const StorePath & storePath,
}
+void Store::substitutePaths(const StorePathSet & paths)
+{
+ std::vector<StorePathWithOutputs> paths2;
+ for (auto & path : paths)
+ if (!path.isDerivation())
+ paths2.push_back({path});
+ uint64_t downloadSize, narSize;
+ StorePathSet willBuild, willSubstitute, unknown;
+ queryMissing(paths2,
+ willBuild, willSubstitute, unknown, downloadSize, narSize);
+
+ if (!willSubstitute.empty())
+ try {
+ std::vector<StorePathWithOutputs> subs;
+ for (auto & p : willSubstitute) subs.push_back({p});
+ buildPaths(subs);
+ } catch (Error & e) {
+ logWarning(e.info());
+ }
+}
+
+
StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag maybeSubstitute)
{
struct State