daemon: Substitute queries return immediately when substitutes are disabled.
Reported by Federico Beffa <beffa@ieee.org> at <https://lists.gnu.org/archive/html/guix-devel/2016-05/msg00928.html>. * nix/libstore/local-store.cc (LocalStore::querySubstitutablePaths) (LocalStore::querySubstitutablePathInfos): Return when 'settings.useSubstitutes' is false. * tests/store.scm ("references/substitutes missing reference info"): Make sure to return #f on failure. * tests/store.scm ("substitutable-path-info when substitutes are turned off"): ("substitutable-paths when substitutes are turned off"): New tests.
This commit is contained in:
parent
4078fa8f72
commit
151afd84dc
2 changed files with 33 additions and 1 deletions
|
@ -1213,6 +1213,9 @@ template<class T> T LocalStore::getIntLineFromSubstituter(RunningSubstituter & r
|
||||||
PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
|
PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
|
||||||
{
|
{
|
||||||
PathSet res;
|
PathSet res;
|
||||||
|
|
||||||
|
if (!settings.useSubstitutes) return res;
|
||||||
|
|
||||||
foreach (Paths::iterator, i, settings.substituters) {
|
foreach (Paths::iterator, i, settings.substituters) {
|
||||||
if (res.size() == paths.size()) break;
|
if (res.size() == paths.size()) break;
|
||||||
RunningSubstituter & run(runningSubstituters[*i]);
|
RunningSubstituter & run(runningSubstituters[*i]);
|
||||||
|
@ -1239,6 +1242,8 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths)
|
||||||
void LocalStore::querySubstitutablePathInfos(const Path & substituter,
|
void LocalStore::querySubstitutablePathInfos(const Path & substituter,
|
||||||
PathSet & paths, SubstitutablePathInfos & infos)
|
PathSet & paths, SubstitutablePathInfos & infos)
|
||||||
{
|
{
|
||||||
|
if (!settings.useSubstitutes) return;
|
||||||
|
|
||||||
RunningSubstituter & run(runningSubstituters[substituter]);
|
RunningSubstituter & run(runningSubstituters[substituter]);
|
||||||
startSubstituter(substituter, run);
|
startSubstituter(substituter, run);
|
||||||
if (run.disabled) return;
|
if (run.disabled) return;
|
||||||
|
|
|
@ -205,7 +205,8 @@
|
||||||
(%current-system))))
|
(%current-system))))
|
||||||
(d (derivation s "the-thing" b '("--help")
|
(d (derivation s "the-thing" b '("--help")
|
||||||
#:inputs `((,b)))))
|
#: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"
|
(test-assert "references/substitutes with substitute info"
|
||||||
(with-store s
|
(with-store s
|
||||||
|
@ -231,6 +232,32 @@
|
||||||
(,t1) ;refs of T2
|
(,t1) ;refs of T2
|
||||||
())))))) ;refs of T1
|
())))))) ;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"
|
(test-assert "requisites"
|
||||||
(let* ((t1 (add-text-to-store %store "random1"
|
(let* ((t1 (add-text-to-store %store "random1"
|
||||||
(random-text) '()))
|
(random-text) '()))
|
||||||
|
|
Reference in a new issue