diff options
author | Ludovic Courtès <ludo@gnu.org> | 2018-09-28 23:19:13 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2018-09-28 23:28:03 +0200 |
commit | fb94d82bc2dc8eec35520bc2b6101ab8aaf0a4a7 (patch) | |
tree | f1e032e1593d0d1026015442401679a9e7cacdb1 /guix/store.scm | |
parent | 258a6d944ed891fa92fa87a16731e5dfe0bac477 (diff) | |
download | gnu-guix-fb94d82bc2dc8eec35520bc2b6101ab8aaf0a4a7.tar gnu-guix-fb94d82bc2dc8eec35520bc2b6101ab8aaf0a4a7.tar.gz |
status: Be more defensive when looking for a log file.
* guix/store.scm (derivation-log-file): New procedure.o
(log-file): Use it.
* guix/status.scm (print-build-event): Use 'derivation-log-file' instead
of 'log-file'. Check wheter the return value is #f.
Diffstat (limited to 'guix/store.scm')
-rw-r--r-- | guix/store.scm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/guix/store.scm b/guix/store.scm index 7785a53aa1..8b35fc8d7a 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -152,6 +152,7 @@ store-path-package-name store-path-hash-part direct-store-path + derivation-log-file log-file)) (define %protocol-version #x162) @@ -1706,21 +1707,26 @@ syntactically valid store path." (and (string-every %nix-base32-charset hash) hash)))))) +(define (derivation-log-file drv) + "Return the build log file for DRV, a derivation file name, or #f if it +could not be found." + (let* ((base (basename drv)) + (log (string-append (dirname %state-directory) ; XXX + "/log/guix/drvs/" + (string-take base 2) "/" + (string-drop base 2))) + (log.gz (string-append log ".gz")) + (log.bz2 (string-append log ".bz2"))) + (cond ((file-exists? log.gz) log.gz) + ((file-exists? log.bz2) log.bz2) + ((file-exists? log) log) + (else #f)))) + (define (log-file store file) "Return the build log file for FILE, or #f if none could be found. FILE must be an absolute store file name, or a derivation file name." (cond ((derivation-path? file) - (let* ((base (basename file)) - (log (string-append (dirname %state-directory) ; XXX - "/log/guix/drvs/" - (string-take base 2) "/" - (string-drop base 2))) - (log.gz (string-append log ".gz")) - (log.bz2 (string-append log ".bz2"))) - (cond ((file-exists? log.gz) log.gz) - ((file-exists? log.bz2) log.bz2) - ((file-exists? log) log) - (else #f)))) + (derivation-log-file file)) (else (match (valid-derivers store file) ((derivers ...) |