import: cabal, hackage: Avoid error when custom setup section is missing.

Fixes <https://debbugs.gnu.org/32387>.

* guix/import/cabal.scm (eval-cabal): Avoid mis-match when the custom-setup
section cannot be created.
* guix/import/hackage.scm (cabal-custom-setup-dependencies->names): Do not
crash when cabal-package-custom-setup returns #F.
This commit is contained in:
Ricardo Wurmus 2018-08-07 18:00:16 +02:00 committed by Ricardo Wurmus
parent 2246d564c8
commit f60784228a
No known key found for this signature in database
GPG Key ID: 197A5888235FACAC
2 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -831,9 +832,9 @@ See the manual for limitations.")))))))
(test-suites (make-cabal-section evaluated-sexp 'test-suite)) (test-suites (make-cabal-section evaluated-sexp 'test-suite))
(flags (make-cabal-section evaluated-sexp 'flag)) (flags (make-cabal-section evaluated-sexp 'flag))
(eval-environment '()) (eval-environment '())
(custom-setup (match (custom-setup (match (make-cabal-section evaluated-sexp 'custom-setup)
(make-cabal-section evaluated-sexp 'custom-setup) ((x) x)
((x) x)))) (_ #f))))
(make-cabal-package name version license home-page-or-hackage (make-cabal-package name version license home-page-or-hackage
source-repository synopsis description executables lib source-repository synopsis description executables lib
test-suites flags eval-environment custom-setup))) test-suites flags eval-environment custom-setup)))

View File

@ -2,6 +2,7 @@
;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch> ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org> ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2016 Nils Gillmann <ng0@n0.is> ;;; Copyright © 2016 Nils Gillmann <ng0@n0.is>
;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -178,8 +179,9 @@ object."
(define (cabal-custom-setup-dependencies->names cabal) (define (cabal-custom-setup-dependencies->names cabal)
"Return the list of custom-setup dependencies from the CABAL package "Return the list of custom-setup dependencies from the CABAL package
object." object."
(let* ((custom-setup-dependencies (and=> (cabal-package-custom-setup cabal) (let* ((custom-setup-dependencies (or (and=> (cabal-package-custom-setup cabal)
cabal-custom-setup-dependencies))) cabal-custom-setup-dependencies)
'())))
(map cabal-dependency-name custom-setup-dependencies))) (map cabal-dependency-name custom-setup-dependencies)))
(define (filter-dependencies dependencies own-name) (define (filter-dependencies dependencies own-name)