snix: Gracefully handle `null' in Nix build inputs.

* guix/snix.scm (snix-derivation->guix-package)[convert-inputs]:
  Gracefully handle `null' as an input.
This commit is contained in:
Ludovic Courtès 2013-01-07 22:23:50 +01:00
parent 708d0ceb50
commit ab8ed44fce

View file

@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2010, 2011, 2012 Ludovic Courtès <ludo@gnu.org> ;;; Copyright © 2010, 2011, 2012, 2013 Ludovic Courtès <ludo@gnu.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -366,15 +366,18 @@ (define (convert-inputs type)
attribute-value) attribute-value)
(#f (#f
'()) '())
((('derivation _ _ (attributes ...)) ...) ((inputs ...)
(map (lambda (attrs) ;; Inputs can be either derivations or the null value.
(let* ((full-name (attribute-value (filter-map (match-lambda
(find-attribute-by-name "name" attrs))) (('derivation _ _ (attributes ...))
(let* ((full-name
(attribute-value
(find-attribute-by-name "name" attributes)))
(name (package-name->name+version full-name))) (name (package-name->name+version full-name)))
(list name (list name
(list 'unquote (list 'unquote (string->symbol name)))))
(string->symbol name))))) ('null #f))
attributes)))) inputs))))
(define (maybe-inputs guix-name inputs) (define (maybe-inputs guix-name inputs)
(match inputs (match inputs