[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
03/08: derivations: 'substitution-oracle' returns a <substitutable>.
From: |
Ludovic Courtès |
Subject: |
03/08: derivations: 'substitution-oracle' returns a <substitutable>. |
Date: |
Fri, 2 Jun 2017 12:48:16 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit ef51ac21eec28de3b0fb693f88be5f3c494d464a
Author: Ludovic Courtès <address@hidden>
Date: Wed May 31 09:55:56 2017 +0200
derivations: 'substitution-oracle' returns a <substitutable>.
* guix/derivations.scm (substitution-oracle): Use
'substitution-path-info' instead of 'substitution-paths'. Turn SUBST
into a vhash from path to <substitutable>. Change the returned
procedure to provide a <substitutable> instead of a Boolean.
* tests/derivations.scm ("substitution-oracle and #:substitute? #f"):
Mock 'substitutable-path-info' instead of 'substitutable-paths'.
---
guix/derivations.scm | 16 ++++++++++++----
tests/derivations.scm | 2 +-
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index 9aaab05..5e457f1 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -271,13 +271,14 @@ result is the set of prerequisites of DRV not already in
valid."
(define* (substitution-oracle store drv
#:key (mode (build-mode normal)))
"Return a one-argument procedure that, when passed a store file name,
-returns #t if it's substitutable and #f otherwise. The returned procedure
+returns a 'substitutable?' if it's substitutable and #f otherwise.
+The returned procedure
knows about all substitutes for all the derivations listed in DRV, *except*
those that are already valid (that is, it won't bother checking whether an
item is substitutable if it's already on disk); it also knows about their
prerequisites, unless they are themselves substitutable.
-Creating a single oracle (thus making a single 'substitutable-paths' call) and
+Creating a single oracle (thus making a single 'substitutable-path-info' call)
and
reusing it is much more efficient than calling 'has-substitutes?' or similar
repeatedly, because it avoids the costs associated with launching the
substituter many times."
@@ -318,8 +319,15 @@ substituter many times."
(cons* self (dependencies drv) result)))))
'()
drv))))
- (subst (list->set (substitutable-paths store paths))))
- (cut set-contains? subst <>)))
+ (subst (fold (lambda (subst vhash)
+ (vhash-cons (substitutable-path subst) subst
+ vhash))
+ vlist-null
+ (substitutable-path-info store paths))))
+ (lambda (item)
+ (match (vhash-assoc item subst)
+ (#f #f)
+ ((key . value) value)))))
(define* (derivation-prerequisites-to-build store drv
#:key
diff --git a/tests/derivations.scm b/tests/derivations.scm
index cabbf7b..d4e1a32 100644
--- a/tests/derivations.scm
+++ b/tests/derivations.scm
@@ -919,7 +919,7 @@
(set! query paths)
'())
- (mock ((guix store) substitutable-paths
+ (mock ((guix store) substitutable-path-info
record-substitutable-path-query)
(let ((pred (substitution-oracle store (list drv))))
- branch master updated (835a658 -> 36a9d3f), Ludovic Courtès, 2017/06/02
- 03/08: derivations: 'substitution-oracle' returns a <substitutable>.,
Ludovic Courtès <=
- 08/08: substitute: Do not display the installed size., Ludovic Courtès, 2017/06/02
- 05/08: ui: 'show-what-to-build' displays how much will be downloaded., Ludovic Courtès, 2017/06/02
- 01/08: tests: Remove 't-profile-alt-*-link' files., Ludovic Courtès, 2017/06/02
- 04/08: derivations: 'derivation-prerequisites-to-build' returns <substitutable>., Ludovic Courtès, 2017/06/02
- 02/08: gnu: Move vtk to image-processing.scm., Ludovic Courtès, 2017/06/02
- 06/08: syscalls: Provide 'free-disk-space'., Ludovic Courtès, 2017/06/02
- 07/08: ui: 'show-what-to-build' warns when we don't have enough disk space., Ludovic Courtès, 2017/06/02