aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nix/libstore/local-store.cc5
-rw-r--r--tests/store.scm29
2 files changed, 33 insertions, 1 deletions
diff --git a/nix/libstore/local-store.cc b/nix/libstore/local-store.cc
index 1eed0ca77f..347e8a703f 100644
--- a/nix/libstore/local-store.cc
+++ b/nix/libstore/local-store.cc
@@ -1213,6 +1213,9 @@ template<class T> T LocalStore::getIntLineFromSubstituter(RunningSubstituter & r
PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
{
PathSet res;
+
+ if (!settings.useSubstitutes) return res;
+
foreach (Paths::iterator, i, settings.substituters) {
if (res.size() == paths.size()) break;
RunningSubstituter & run(runningSubstituters[*i]);
@@ -1239,6 +1242,8 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
void LocalStore::querySubstitutablePathInfos(const Path & substituter,
PathSet & paths, SubstitutablePathInfos & infos)
{
+ if (!settings.useSubstitutes) return;
+
RunningSubstituter & run(runningSubstituters[substituter]);
startSubstituter(substituter, run);
if (run.disabled) return;
diff --git a/tests/store.scm b/tests/store.scm
index 3c2c247561..38b8efce96 100644
--- a/tests/store.scm
+++ b/tests/store.scm
@@ -205,7 +205,8 @@
(%current-system))))
(d (derivation s "the-thing" b '("--help")
#:inputs `((,b)))))
- (references/substitutes s (list (derivation->output-path d) b))))))
+ (references/substitutes s (list (derivation->output-path d) b))
+ #f))))
(test-assert "references/substitutes with substitute info"
(with-store s
@@ -231,6 +232,32 @@
(,t1) ;refs of T2
())))))) ;refs of T1
+(test-equal "substitutable-path-info when substitutes are turned off"
+ '()
+ (with-store s
+ (set-build-options s #:use-substitutes? #f)
+ (let* ((b (add-to-store s "bash" #t "sha256"
+ (search-bootstrap-binary "bash"
+ (%current-system))))
+ (d (derivation s "the-thing" b '("--version")
+ #:inputs `((,b))))
+ (o (derivation->output-path d)))
+ (with-derivation-narinfo d
+ (substitutable-path-info s (list o))))))
+
+(test-equal "substitutable-paths when substitutes are turned off"
+ '()
+ (with-store s
+ (set-build-options s #:use-substitutes? #f)
+ (let* ((b (add-to-store s "bash" #t "sha256"
+ (search-bootstrap-binary "bash"
+ (%current-system))))
+ (d (derivation s "the-thing" b '("--version")
+ #:inputs `((,b))))
+ (o (derivation->output-path d)))
+ (with-derivation-narinfo d
+ (substitutable-paths s (list o))))))
+
(test-assert "requisites"
(let* ((t1 (add-text-to-store %store "random1"
(random-text) '()))