diff options
author | Ludovic Courtès <ludo@gnu.org> | 2014-07-11 13:59:54 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2014-07-11 23:20:48 +0200 |
commit | f1096964735512beacde6ff178a6ada1a14b91d3 (patch) | |
tree | 8478196681c996fabfef9984b1613a0ef5421baa | |
parent | 42e1394b11d1da7dd8c73bdeb1ad602b728d865b (diff) | |
download | guix-f1096964735512beacde6ff178a6ada1a14b91d3.tar guix-f1096964735512beacde6ff178a6ada1a14b91d3.tar.gz |
packages: Add printer for <origin>.
* guix/packages.scm (print-origin): New procedure.
(<origin>): Add it as record type printer.
-rw-r--r-- | guix/packages.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/packages.scm b/guix/packages.scm index b413e58b19..985a573fd3 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -125,6 +125,17 @@ (patch-guile origin-patch-guile ; package or #f (default #f))) +(define (print-origin origin port) + "Write a concise representation of ORIGIN to PORT." + (match origin + (($ <origin> uri method sha256 file-name patches) + (simple-format port "#<origin ~s ~a ~s ~a>" + uri (bytevector->base32-string sha256) + patches + (number->string (object-address origin) 16))))) + +(set-record-type-printer! <origin> print-origin) + (define-syntax base32 (lambda (s) "Return the bytevector corresponding to the given Nix-base32 |