From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51736) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Df8-0001a5-Vo for guix-patches@gnu.org; Thu, 04 May 2017 06:07:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Df4-0007er-TI for guix-patches@gnu.org; Thu, 04 May 2017 06:07:06 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:55378) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6Df4-0007ef-Px for guix-patches@gnu.org; Thu, 04 May 2017 06:07:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d6Df4-00081q-LC for guix-patches@gnu.org; Thu, 04 May 2017 06:07:02 -0400 Subject: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?. Resent-Message-ID: From: Mathieu Othacehe Date: Thu, 4 May 2017 12:06:26 +0200 Message-Id: <20170504100627.27553-2-m.othacehe@gmail.com> In-Reply-To: <20170504100627.27553-1-m.othacehe@gmail.com> References: <20170504100627.27553-1-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: 26772@debbugs.gnu.org * guix/import/cran.scm (package->upstream-name): Return #f if url start and end index could not be determined. (cran-package?): Check if the upstream-name can be extracted from given package. This fixes a failure of guix refresh on r-minimal because no upsteam-name can be determined from ".../R-version.tar.gz" uri. --- guix/import/cran.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/guix/import/cran.scm b/guix/import/cran.scm index be34a75c8..20009e2af 100644 --- a/guix/import/cran.scm +++ b/guix/import/cran.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2016, 2017 Ricardo Wurmus ;;; Copyright © 2015, 2016, 2017 Ludovic Courtès +;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -374,7 +375,8 @@ dependencies." (start (string-rindex url #\/))) ;; The URL ends on ;; (string-append "/" name "_" version ".tar.gz") - (substring url (+ start 1) end))) + (if (and start end) + (substring url (+ start 1) end) #f))) (_ #f))) (_ #f))))) @@ -415,6 +417,9 @@ dependencies." (define (cran-package? package) "Return true if PACKAGE is an R package from CRAN." (and (string-prefix? "r-" (package-name package)) + ;; Check if the upstream name can be extracted from package uri. + (package->upstream-name package) + ;; Check if package uri(s) are prefixed by "mirror://cran". (match (and=> (package-source package) origin-uri) ((? string? uri) (string-prefix? "mirror://cran" uri)) -- 2.12.2