From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ricardo Wurmus Subject: bug#32387: [PATCH] import: cabal, hackage: Avoid error when custom setup section is missing. Date: Tue, 7 Aug 2018 18:00:16 +0200 Message-ID: <20180807160016.28728-1-ricardo.wurmus@mdc-berlin.de> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45405) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fn4Pz-0000pm-Gy for bug-guix@gnu.org; Tue, 07 Aug 2018 12:01:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fn4Pu-0000gN-Rv for bug-guix@gnu.org; Tue, 07 Aug 2018 12:01:07 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:38825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fn4Pu-0000fy-G2 for bug-guix@gnu.org; Tue, 07 Aug 2018 12:01:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1fn4Pu-0000RK-8K for bug-guix@gnu.org; Tue, 07 Aug 2018 12:01:02 -0400 In-Reply-To: Sender: "Debbugs-submit" Resent-Message-ID: List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+gcggb-bug-guix=m.gmane.org@gnu.org Sender: "bug-Guix" To: 32387@debbugs.gnu.org Cc: Ricardo Wurmus Fixes . * 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. --- guix/import/cabal.scm | 7 ++++--- guix/import/hackage.scm | 6 ++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/guix/import/cabal.scm b/guix/import/cabal.scm index 1b8bda6f4..13c2f3f48 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 +;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; 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 6f80d84b7..3b138f8c9 100644 --- a/guix/import/hackage.scm +++ b/guix/import/hackage.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Federico Beffa ;;; Copyright © 2016 Eric Bavier ;;; Copyright © 2016 Nils Gillmann +;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; 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) -- 2.18.0