From: ludo@gnu.org (Ludovic Courtès)
To: Mathieu Othacehe <m.othacehe@gmail.com>
Cc: 26772@debbugs.gnu.org
Subject: bug#26772: [PATCH 2/3] import: cran: Robustify cran-package?.
Date: Sat, 13 May 2017 00:11:04 +0200 [thread overview]
Message-ID: <87bmqx6807.fsf@gnu.org> (raw)
In-Reply-To: <20170504100627.27553-2-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Thu, 4 May 2017 12:06:26 +0200")
Mathieu Othacehe <m.othacehe@gmail.com> 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 …))
> @@ -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!
Ludo’.
next prev parent reply other threads:[~2017-05-12 22:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-04 10:04 bug#26772: [PATCH 0/3] Fix guix refresh errors Mathieu Othacehe
2017-05-04 10:06 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
2017-05-04 10:06 ` bug#26772: [PATCH 2/3] import: cran: Robustify cran-package? Mathieu Othacehe
2017-05-12 22:11 ` Ludovic Courtès [this message]
2017-05-13 10:44 ` Mathieu Othacehe
2017-05-13 13:12 ` Ludovic Courtès
2017-05-04 10:06 ` bug#26772: [PATCH 3/3] import: pypi: Robustify latest-release Mathieu Othacehe
2017-05-12 22:11 ` Ludovic Courtès
2017-05-04 10:09 ` bug#26772: [PATCH 1/3] gnu: python-termcolor: Fix uri Mathieu Othacehe
2017-05-12 22:07 ` Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87bmqx6807.fsf@gnu.org \
--to=ludo@gnu.org \
--cc=26772@debbugs.gnu.org \
--cc=m.othacehe@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).