guix-commits
[Top][All Lists]
Advanced

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

02/04: guix build: Factorize build log query.


From: Ludovic Courtès
Subject: 02/04: guix build: Factorize build log query.
Date: Sun, 29 Nov 2015 18:18:56 +0000

civodul pushed a commit to branch master
in repository guix.

commit 841cb43c6b4b7cb6ce328962368c583bc5fdc114
Author: Ludovic Courtès <address@hidden>
Date:   Sun Nov 29 17:42:01 2015 +0100

    guix build: Factorize build log query.
    
    * guix/scripts/build.scm (show-build-log): New procedure.
    (guix-build): New variable 'items'.  Use it and 'show-build-log'.
---
 guix/scripts/build.scm |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 644ffe8..b415403 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -494,6 +494,15 @@ arguments with packages that use the specified source."
       ((head tail ...)
        (loop tail sources (cons head result))))))
 
+(define (show-build-log store file urls)
+  "Show the build log for FILE, falling back to remote logs from URLS if
+needed."
+  (let ((log (or (log-file store file)
+                 (log-url store file #:base-urls urls))))
+    (if log
+        (format #t "~a~%" log)
+        (leave (_ "no build log for '~a'~%") file))))
+
 
 ;;;
 ;;; Entry point.
@@ -515,9 +524,14 @@ arguments with packages that use the specified source."
                                  ;; daemon's substitute URLs.
                                  %default-substitute-urls)
                              '())))
+             (items (filter-map (match-lambda
+                                  (('argument . (? store-path? file))
+                                   file)
+                                  (_ #f))
+                                opts))
              (roots (filter-map (match-lambda
-                                 (('gc-root . root) root)
-                                 (_ #f))
+                                  (('gc-root . root) root)
+                                  (_ #f))
                                 opts)))
 
         (set-build-options-from-command-line store opts)
@@ -527,22 +541,10 @@ arguments with packages that use the specified source."
                               #:dry-run? (assoc-ref opts 'dry-run?)))
 
         (cond ((assoc-ref opts 'log-file?)
-               (for-each (lambda (file)
-                           (let ((log (or (log-file store file)
-                                          (log-url store file
-                                                   #:base-urls urls))))
-                             (if log
-                                 (format #t "~a~%" log)
-                                 (leave (_ "no build log for '~a'~%")
-                                        file))))
+               (for-each (cut show-build-log store <> urls)
                          (delete-duplicates
                           (append (map derivation-file-name drv)
-                                  (filter-map (match-lambda
-                                               (('argument
-                                                 . (? store-path? file))
-                                                file)
-                                               (_ #f))
-                                              opts)))))
+                                  items))))
               ((assoc-ref opts 'derivations-only?)
                (format #t "~{~a~%~}" (map derivation-file-name drv))
                (for-each (cut register-root store <> <>)



reply via email to

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