guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

02/13: grafts: 'references-oracle' now takes a derivation input.


From: guix-commits
Subject: 02/13: grafts: 'references-oracle' now takes a derivation input.
Date: Tue, 2 Jul 2019 12:34:03 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 9616b81e9861c831159a0e1a5993854b9ad3c3e5
Author: Ludovic Court├Ęs <address@hidden>
Date:   Tue Jul 2 16:45:12 2019 +0200

    grafts: 'references-oracle' now takes a derivation input.
    
    That way, if we end up calling 'build-derivations', we'll only build the
    outputs that we really need.
    
    * guix/grafts.scm (references-oracle): Rename 'drv' to 'input'.
    [output-paths]: Remove.
    Adjust accordingly.
    (graft-derivation): Adjust call to 'references-oracle'.
---
 guix/grafts.scm | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/guix/grafts.scm b/guix/grafts.scm
index 3b43e11..adc7bfa 100644
--- a/guix/grafts.scm
+++ b/guix/grafts.scm
@@ -163,16 +163,11 @@ references.  Call REFERENCES to get the list of 
references."
                  items))))
     (remove (cut member <> self) refs)))
 
-(define (references-oracle store drv)
-  "Return a one-argument procedure that, when passed the file name of DRV's
-outputs or their dependencies, returns the list of references of that item.
-Use either local info or substitute info; build DRV if no information is
-available."
-  (define (output-paths drv)
-    (match (derivation->output-paths drv)
-      (((names . items) ...)
-       items)))
-
+(define (references-oracle store input)
+  "Return a one-argument procedure that, when passed the output file names of
+INPUT, a derivation input, or their dependencies, returns the list of
+references of that item.  Use either local info or substitute info; build
+INPUT if no information is available."
   (define (references* items)
     (guard (c ((store-protocol-error? c)
                ;; As a last resort, build DRV and query the references of the
@@ -181,13 +176,14 @@ available."
                ;; Warm up the narinfo cache, otherwise each derivation build
                ;; will result in one HTTP request to get one narinfo, which is
                ;; much less efficient than fetching them all upfront.
-               (substitution-oracle store (list drv))
+               (substitution-oracle store
+                                    (list (derivation-input-derivation input)))
 
-               (and (build-derivations store (list drv))
+               (and (build-derivations store (list input))
                     (map (cut references store <>) items))))
       (references/substitutes store items)))
 
-  (let loop ((items (output-paths drv))
+  (let loop ((items (derivation-input-output-paths input))
              (result vlist-null))
     (match items
       (()
@@ -324,7 +320,7 @@ DRV, and graft DRV itself to refer to those grafted 
dependencies."
   ;; upfront to have as much parallelism as possible when querying substitute
   ;; info or when building DRV.
   (define references
-    (references-oracle store drv))
+    (references-oracle store (derivation-input drv outputs)))
 
   (match (run-with-state
              (cumulative-grafts store drv grafts references



reply via email to

[Prev in Thread] Current Thread [Next in Thread]