From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60443) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er2bU-0001Bd-Lk for guix-patches@gnu.org; Wed, 28 Feb 2018 09:21:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er2bO-0007x2-Jp for guix-patches@gnu.org; Wed, 28 Feb 2018 09:21:08 -0500 Received: from debbugs.gnu.org ([208.118.235.43]:56947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1er2bO-0007wc-Ev for guix-patches@gnu.org; Wed, 28 Feb 2018 09:21:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1er2bO-0007Vx-63 for guix-patches@gnu.org; Wed, 28 Feb 2018 09:21:02 -0500 Subject: [bug#30647] [PATCH] guix build: Support '--remote-log-file=PACKAGE'. Resent-Message-ID: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60316) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1er2b6-00011F-E4 for guix-patches@gnu.org; Wed, 28 Feb 2018 09:20:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1er2b3-0007fd-3Y for guix-patches@gnu.org; Wed, 28 Feb 2018 09:20:44 -0500 Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:47012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1er2b2-0007f6-Nl for guix-patches@gnu.org; Wed, 28 Feb 2018 09:20:41 -0500 Received: by mail-lf0-x22e.google.com with SMTP id r80so3726051lfe.13 for ; Wed, 28 Feb 2018 06:20:40 -0800 (PST) From: Oleg Pykhalov Date: Wed, 28 Feb 2018 17:19:59 +0300 Message-Id: <20180228141959.19789-1-go.wigust@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 30647@debbugs.gnu.org ‘--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 -@var{package-or-derivation}, or raise an error if build logs are -missing. +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}.) +@item --remote-log-file +@cindex 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: @example -$ guix build --log-file gdb -s mips64el-linux +$ guix build --remote-log-file gdb -s mips64el-linux https://hydra.gnu.org/log/@dots{}-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 %standard-build-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 -needed." - (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))) + (with-error-handling ;; 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." opts))) (unless (or (assoc-ref opts 'log-file?) + (assoc-ref opts 'remote-log-file?) (assoc-ref opts 'derivations-only?)) (show-what-to-build store drv #:use-substitutes? @@ -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 <> <>) -- 2.16.1