Hello Guix! Ricardo Wurmus <ricardo.wur...@mdc-berlin.de> skribis:
> attached is a patch to add a new importer for R packages published on > CRAN. (I still have to add tests for this.) Yay! > The importer fetches the HTML description of an R package from > http://cran.r-project.org, converts it to SXML, and then tries to > extract the relevant information from the SXML expression. Do you have an idea of how stable that HTML page is? > When I finished I thought that maybe this could be done with less effort > by downloading the tarball from CRAN, extracting the plain text > DESCRIPTION file containing the same information and parse that instead. > But in order to get the tarball I’d have to parse the HTML anyway, so > maybe that’s not so much better after all. OK. > This generates package expressions using the r-build-system — this build > system does not yet exist, but I’ll prepare one soon, not least to test > the importer. Sounds good. > From 8cb9622785feb79fbbe593099105160617ff6acb Mon Sep 17 00:00:00 2001 > From: Ricardo Wurmus <ricardo.wur...@mdc-berlin.de> > Date: Fri, 24 Jul 2015 16:49:57 +0200 > Subject: [PATCH] import: Add 'cran' importer. > > * guix/import/cran.scm: New file. > * guix/scripts/import.scm: Add "cran" to 'importers'. > * guix/scripts/import/cran.scm: New file. > * Makefile.am (MODULES): Add 'guix/import/cran.scm' and > 'guix/scripts/import/cran.scm'. > * doc/guix.texi (Invoking guix import): Document it. > * po/guix/POTFILES.in: Add 'guix/scripts/import/cran.scm'. [...] > +@item cran > +@cindex CRAN > +Import meta-data from @uref{http://cran.r-project.org/, CRAN}. s/\./, the central repository for the @uref{http://r-project.org, GNU@tie{}R statistical and graphical environment}/ > +(define string->license > + (match-lambda > + ("AGPL-3" 'agpl3) > + ("Artistic-2.0" 'artistic2.0) > + ("Apache License 2.0" 'asl2.0) > + ("BSD_2_clause" 'bsd-2) > + ("BSD_3_clause" 'bsd-3) > + ("GPL-2" 'gpl2) > + ("GPL-3" 'GPL3) > + ("LGPL-2" 'lgpl2.0) > + ("LGPL-2.1" 'lgpl2.1) > + ("LGPL-3" 'lgpl3) Does it actually mean “or any later version”, or is it just unspecified? Overall this looks good to me... with a couple of tests, of course. :-) The tests will notably serve as a reference of what HTML form is expected, in case the HTML page changes. Thank you! Ludo’.