summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2018-08-07 18:00:16 +0200
committerRicardo Wurmus <rekado@elephly.net>2018-08-07 20:39:12 +0200
commitf60784228a05c21aabc0a97b62fb158ce479525c (patch)
treee0cad8e1db53a15d15e2da908e16ca7d854fc4eb
parent2246d564c85c5d794348b30c91e668abb99d753f (diff)
downloadguix-f60784228a05c21aabc0a97b62fb158ce479525c.tar.gz
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.
-rw-r--r--guix/import/cabal.scm7
-rw-r--r--guix/import/hackage.scm6
2 files changed, 8 insertions, 5 deletions
diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm
index 1b8bda6f4e..13c2f3f48c 100644
--- a/guix/import/cabal.scm
+++ b/guix/import/cabal.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; 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))
            (flags (make-cabal-section evaluated-sexp 'flag))
            (eval-environment '())
-           (custom-setup (match
-                          (make-cabal-section evaluated-sexp 'custom-setup)
-                          ((x) x))))
+           (custom-setup (match (make-cabal-section evaluated-sexp 'custom-setup)
+                           ((x) x)
+                           (_ #f))))
       (make-cabal-package name version license home-page-or-hackage
                           source-repository synopsis description executables lib
                           test-suites flags eval-environment custom-setup)))
diff --git a/guix/import/hackage.scm b/guix/import/hackage.scm
index 6f80d84b70..3b138f8c98 100644
--- a/guix/import/hackage.scm
+++ b/guix/import/hackage.scm
@@ -2,6 +2,7 @@
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Eric Bavier <bavier@member.fsf.org>
 ;;; Copyright © 2016 Nils Gillmann <ng0@n0.is>
+;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -178,8 +179,9 @@ object."
 (define (cabal-custom-setup-dependencies->names cabal)
   "Return the list of custom-setup dependencies from the CABAL package
 object."
-  (let* ((custom-setup-dependencies (and=> (cabal-package-custom-setup cabal)
-                                           cabal-custom-setup-dependencies)))
+  (let* ((custom-setup-dependencies (or (and=> (cabal-package-custom-setup cabal)
+                                               cabal-custom-setup-dependencies)
+                                        '())))
     (map cabal-dependency-name custom-setup-dependencies)))
 
 (define (filter-dependencies dependencies own-name)