From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38880) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d9In8-0002LX-0H for guix-patches@gnu.org; Fri, 12 May 2017 18:12:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d9In4-0002E2-5z for guix-patches@gnu.org; Fri, 12 May 2017 18:12:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:38740) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d9In4-0002Dv-1y for guix-patches@gnu.org; Fri, 12 May 2017 18:12:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d9In3-0004ym-Rw for guix-patches@gnu.org; Fri, 12 May 2017 18:12:01 -0400 Subject: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170504100627.27553-1-m.othacehe@gmail.com> <20170504100627.27553-2-m.othacehe@gmail.com> Date: Sat, 13 May 2017 00:11:04 +0200 In-Reply-To: <20170504100627.27553-2-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Thu, 4 May 2017 12:06:26 +0200") Message-ID: <87bmqx6807.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: Mathieu Othacehe Cc: 26772@debbugs.gnu.org Mathieu Othacehe skribis: > * 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. [...] > @@ -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))) This can be written as: (and start end (substring url =E2=80=A6)) > @@ -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=3D> (package-source package) origin-uri) > ((? string? uri) > (string-prefix? "mirror://cran" uri)) OK! Do you think you could add this specific case (r-minimal) as a test case for =E2=80=98cran-package?=E2=80=99 in tests/cran.scm? That would be aweso= me. Otherwise LGTM, thanks! Ludo=E2=80=99.