From 07c86312ca96d095ff5ebeae37940fd7c726c3e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 18 Sep 2013 11:10:02 +0200 Subject: [PATCH] derivations: Add a nicer printer. * guix/derivations.scm (): Add a printer. --- guix/derivations.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 @@ (define-record-type (path derivation-input-path) ; store path (sub-derivations derivation-input-sub-derivations)) ; list of strings +(set-record-type-printer! + (lambda (drv port) + (format port "# ~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')."