summaryrefslogtreecommitdiff
path: root/guix/packages.scm
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2012-09-01 19:21:06 +0200
committerLudovic Courtès <ludo@gnu.org>2012-09-02 15:41:52 +0200
commit946b72c92408c59ac02d0f97d4e241a9098d742f (patch)
tree367b5e5b76bb9f1190fba2a4dea2b0ab6d4a16fc /guix/packages.scm
parentaaa848f3afa81ec79579071f99d9bea5f8456f32 (diff)
packages: Add a printer for <package>.
* guix/packages.scm (<package>): Add record printer.
Diffstat (limited to 'guix/packages.scm')
-rw-r--r--guix/packages.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix/packages.scm b/guix/packages.scm
index a1257b293f..0ecd4ca6d4 100644
--- a/guix/packages.scm
+++ b/guix/packages.scm
@@ -23,6 +23,7 @@
#:use-module (ice-9 match)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-9 gnu)
#:use-module (srfi srfi-34)
#:use-module (srfi srfi-35)
#:export (location
@@ -164,6 +165,19 @@ representation."
(default (and=> (current-source-location)
source-properties->location))))
+(set-record-type-printer! <package>
+ (lambda (package port)
+ (let ((loc (package-location package))
+ (format simple-format))
+ (format port "#<package ~a-~a ~a:~a ~a>"
+ (package-name package)
+ (package-version package)
+ (location-file loc)
+ (location-line loc)
+ (number->string (object-address
+ package)
+ 16)))))
+
;; Error conditions.