summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2013-09-18 11:10:02 +0200
committerLudovic Courtès <ludo@gnu.org>2013-09-18 11:10:02 +0200
commit07c86312ca96d095ff5ebeae37940fd7c726c3e5 (patch)
treea63247ef06182709c8db99e0befe4f6501af4022
parent6a446d56801bfb197b1561bbe660675caa31c96c (diff)
downloadguix-07c86312ca96d095ff5ebeae37940fd7c726c3e5.tar.gz
derivations: Add a nicer printer.
* guix/derivations.scm (<derivation>): Add a printer.
-rw-r--r--guix/derivations.scm12
1 files changed, 12 insertions, 0 deletions
diff --git a/guix/derivations.scm b/guix/derivations.scm
index f0f9ec7c21..43ea328b0e 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -19,6 +19,7 @@
 (define-module (guix derivations)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-9)
+  #:use-module (srfi srfi-9 gnu)
   #:use-module (srfi srfi-26)
   #:use-module (rnrs io ports)
   #:use-module (rnrs bytevectors)
@@ -97,6 +98,17 @@
   (path            derivation-input-path)             ; store path
   (sub-derivations derivation-input-sub-derivations)) ; list of strings
 
+(set-record-type-printer! <derivation>
+                          (lambda (drv port)
+                            (format port "#<derivation ~a => ~a ~a>"
+                                    (derivation-file-name drv)
+                                    (string-join
+                                     (map (match-lambda
+                                           ((_ . output)
+                                            (derivation-output-path output)))
+                                          (derivation-outputs drv)))
+                                    (number->string (object-address drv) 16))))
+
 (define (fixed-output-derivation? drv)
   "Return #t if DRV is a fixed-output derivation, such as the result of a
 download with a fixed hash (aka. `fetchurl')."