mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-11-07 15:36:20 -05:00
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'.
This commit is contained in:
parent
4eae798075
commit
841cb43c6b
1 changed files with 18 additions and 16 deletions
|
@ -494,6 +494,15 @@ (define new-sources
|
||||||
((head tail ...)
|
((head tail ...)
|
||||||
(loop tail sources (cons head result))))))
|
(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.
|
;;; Entry point.
|
||||||
|
@ -515,9 +524,14 @@ (define (guix-build . args)
|
||||||
;; daemon's substitute URLs.
|
;; daemon's substitute URLs.
|
||||||
%default-substitute-urls)
|
%default-substitute-urls)
|
||||||
'())))
|
'())))
|
||||||
|
(items (filter-map (match-lambda
|
||||||
|
(('argument . (? store-path? file))
|
||||||
|
file)
|
||||||
|
(_ #f))
|
||||||
|
opts))
|
||||||
(roots (filter-map (match-lambda
|
(roots (filter-map (match-lambda
|
||||||
(('gc-root . root) root)
|
(('gc-root . root) root)
|
||||||
(_ #f))
|
(_ #f))
|
||||||
opts)))
|
opts)))
|
||||||
|
|
||||||
(set-build-options-from-command-line store opts)
|
(set-build-options-from-command-line store opts)
|
||||||
|
@ -527,22 +541,10 @@ (define (guix-build . args)
|
||||||
#:dry-run? (assoc-ref opts 'dry-run?)))
|
#:dry-run? (assoc-ref opts 'dry-run?)))
|
||||||
|
|
||||||
(cond ((assoc-ref opts 'log-file?)
|
(cond ((assoc-ref opts 'log-file?)
|
||||||
(for-each (lambda (file)
|
(for-each (cut show-build-log store <> urls)
|
||||||
(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))))
|
|
||||||
(delete-duplicates
|
(delete-duplicates
|
||||||
(append (map derivation-file-name drv)
|
(append (map derivation-file-name drv)
|
||||||
(filter-map (match-lambda
|
items))))
|
||||||
(('argument
|
|
||||||
. (? store-path? file))
|
|
||||||
file)
|
|
||||||
(_ #f))
|
|
||||||
opts)))))
|
|
||||||
((assoc-ref opts 'derivations-only?)
|
((assoc-ref opts 'derivations-only?)
|
||||||
(format #t "~{~a~%~}" (map derivation-file-name drv))
|
(format #t "~{~a~%~}" (map derivation-file-name drv))
|
||||||
(for-each (cut register-root store <> <>)
|
(for-each (cut register-root store <> <>)
|
||||||
|
|
Loading…
Reference in a new issue