guix-commits
[Top][All Lists]
Advanced

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

01/02: channels: Call 'build-self.scm' procedure with a trivial build ha


From: guix-commits
Subject: 01/02: channels: Call 'build-self.scm' procedure with a trivial build handler.
Date: Mon, 6 Apr 2020 18:02:31 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 42a87136f0c99c0f1956e053d92f23bf096bddb6
Author: Ludovic Courtès <address@hidden>
AuthorDate: Mon Apr 6 23:21:43 2020 +0200

    channels: Call 'build-self.scm' procedure with a trivial build handler.
    
    Previously, "TESTS=installed-os guix build -m etc/system-tests.scm"
    would repeat the "Computing Guix derivation" phase ~5 times due to the
    fact that there were several call paths, within a build-accumulator,
    leading to (package-derivation store guix).
    
    * guix/channels.scm (with-trivial-build-handler): New procedure.
    (build-from-source): Wrap 'build' call in 'with-trivial-build-handler'.
---
 guix/channels.scm | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/guix/channels.scm b/guix/channels.scm
index f0261dc..785b977 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -349,6 +349,15 @@ to '%package-module-path'."
       (((predicate . guile) rest ...)
        (if (predicate source) (guile) (loop rest))))))
 
+(define (with-trivial-build-handler mvalue)
+  "Run MVALUE, a monadic value, with a \"trivial\" build handler installed
+that unconditionally resumes the continuation."
+  (lambda (store)
+    (with-build-handler (lambda (continue . _)
+                          (continue #t))
+      (values (run-with-store store mvalue)
+              store))))
+
 (define* (build-from-source name source
                             #:key core verbose? commit
                             (dependencies '()))
@@ -381,8 +390,14 @@ package modules under SOURCE using CORE, an instance of 
Guix."
         (mbegin %store-monad
           (mwhen guile
             (set-guile-for-build guile))
-          (build source #:verbose? verbose? #:version commit
-                 #:pull-version %pull-version)))
+
+          ;; BUILD is usually quite costly.  Install a "trivial" build handler
+          ;; so we don't bounce an outer build-accumulator handler that could
+          ;; cause us to redo half of the BUILD computation several times just
+          ;; to realize it gives the same result.
+          (with-trivial-build-handler
+           (build source #:verbose? verbose? #:version commit
+                  #:pull-version %pull-version))))
 
       ;; Build a set of modules that extend Guix using the standard method.
       (standard-module-derivation name source core dependencies)))



reply via email to

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