Subject: Re: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
From: Mathieu Othacehe <[email-masked]>
To: Ludovic Courtès <[email-masked]>
Cc: [email-masked]
Date: Sat, 13 May 2017 12:44:57 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi Ludo !

Thanks for the review.

> This can be written as:
>
>   (and start end (substring url …))

Done.

>
>> @@ -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))
>
> OK!
>
> Do you think you could add this specific case (r-minimal) as a test case
> for ‘cran-package?’ in tests/cran.scm?  That would be awesome.
>
> Otherwise LGTM, thanks!

Sure I pushed this patch with the change above and a new test in
tests/cran.scm :

--8<---------------cut here---------------start------------->8---
(test-equal "r-mininal is not a cran package"
  #f
  ((@@ (guix import cran) cran-package?) r-minimal))
--8<---------------cut here---------------end--------------->8---

I also pushed the two other patches of the serie.

Mathieu