[Top][All Lists]

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

[bug#30647] [PATCH] guix build: Support '--remote-log-file=PACKAGE'.

From: Oleg Pykhalov
Subject: [bug#30647] [PATCH] guix build: Support '--remote-log-file=PACKAGE'.
Date: Wed, 28 Feb 2018 17:19:59 +0300

‘--remote-log-file’ allows to get a URL for a build log file on a substitute
server regardless is it built locally.  ‘--log-file’ returns always local
build log file.

* guix/scripts/build.scm (show-build-log): Split function.
(show-remote-build-log): New function.
(guix-build): Add this.
* doc/guix.texi (Invoking guix build): Document this.
 doc/guix.texi          | 18 +++++++++---------
 guix/scripts/build.scm | 31 ++++++++++++++++++++++---------
 2 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 24db16761..782e532ce 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -5812,9 +5812,8 @@ more on GC roots.
 @item --log-file
 @cindex build logs, access
-Return the build log file names or URLs for the given
address@hidden, or raise an error if build logs are
+Return the build log file names @var{package-or-derivation}, or raise an
+error if build logs are missing.
 This works regardless of how packages or derivations are specified.  For
 instance, the following invocations are equivalent:
@@ -5826,15 +5825,16 @@ guix build --log-file guile
 guix build --log-file -e '(@@ (gnu packages guile) guile-2.0)'
 @end example
-If a log is unavailable locally, and unless @code{--no-substitutes} is
-passed, the command looks for a corresponding log on one of the
-substitute servers (as specified with @code{--substitute-urls}.)
address@hidden --remote-log-file
address@hidden build logs, access
+Same as @code{--log-file} but on one of the substitute servers (as
+specified with @code{--substitute-urls}.
-So for instance, imagine you want to see the build log of GDB on MIPS,
-but you are actually on an @code{x86_64} machine:
+For example, you want to see the build log of GDB on MIPS:
-$ guix build --log-file gdb -s mips64el-linux
+$ guix build --remote-log-file gdb -s mips64el-linux{}-gdb-7.10
 @end example
diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 57f2d82c5..c45271e50 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -601,6 +601,9 @@ must be one of 'package', 'all', or 'transitive'~%")
          (option '("log-file") #f #f
                  (lambda (opt name arg result)
                    (alist-cons 'log-file? #t result)))
+         (option '("remote-log-file") #f #f
+                 (lambda (opt name arg result)
+                   (alist-cons 'remote-log-file? #t result)))
          (append %transformation-options
@@ -691,15 +694,20 @@ package '~a' has no source~%")
                 (map (cut transform store <>)
                      (options->things-to-build opts)))))
-(define (show-build-log store file urls)
-  "Show the build log for FILE, falling back to remote logs from URLS if
-  (let ((log (or (log-file store file)
-                 (log-url store file #:base-urls urls))))
+(define (show-build-log store file)
+  "Show the build log for FILE."
+  (let ((log (log-file store file)))
     (if log
         (format #t "~a~%" log)
         (leave (G_ "no build log for '~a'~%") file))))
+(define (show-remote-build-log store file urls)
+  "Show the remote build log for FILE from URLS."
+  (let ((log (log-url store file #:base-urls urls)))
+    (if log
+        (format #t "~a~%" log)
+        (leave (G_ "no remote build log for '~a'~%") file))))
 ;;; Entry point.
@@ -713,6 +721,9 @@ needed."
   (define quiet?
     (assoc-ref opts 'quiet?))
+  (define (derivation-file-names drv items)
+    (delete-duplicates (append (map derivation-file-name drv) items)))
     ;; Ask for absolute file names so that .drv file names passed from the
     ;; user to 'read-derivation' are absolute when it returns.
@@ -744,6 +755,7 @@ needed."
             (unless (or (assoc-ref opts 'log-file?)
+                        (assoc-ref opts 'remote-log-file?)
                         (assoc-ref opts 'derivations-only?))
               (show-what-to-build store drv
@@ -752,10 +764,11 @@ needed."
                                   #:mode mode))
             (cond ((assoc-ref opts 'log-file?)
-                   (for-each (cut show-build-log store <> urls)
-                             (delete-duplicates
-                              (append (map derivation-file-name drv)
-                                      items))))
+                   (for-each (cut show-build-log store <>)
+                             (derivation-file-names drv items)))
+                  ((assoc-ref opts 'remote-log-file?)
+                   (for-each (cut show-remote-build-log store <> urls)
+                             (derivation-file-names drv 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]