Adding r-gtk2 and other packages for r-qda (RFC)

OpenSubmitted by Pjotr Prins.
Details
4 participants
  • Pjotr Prins
  • Ricardo Wurmus
  • Ricardo Wurmus
  • zimoun
Owner
Somebody
Severity
normal
P
P
Pjotr Prins wrote on 11 Sep 2018 14:23
(address . guix-patches@gnu.org)
20180911122320.eyg4rms4eh36dnzx@thebird.nl
Attached a bunch of packages I wrote for RQDA. This is a particular
useful package because it depends on GTK2. guix import cran is pretty
awesome - it got most of it right :).

One or two hacks in there to disable X11 tests. Anyone any comments on
how to enable X11 instead of having X-headless? And is this good
enough to submit to Guix otherwise?

Pj.
Toggle diff (193 lines)
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 04979ff..1c913a5 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -5715,3 +5715,188 @@ Java package that provides routines for various statistical distributions.")
     ;; are under the GPLv3, which is a mistake.  The author confirmed in an
     ;; email that this whole project should be under GPLv2+.
     (license license:gpl2+)))
+
+(define-public r-rgtk2
+  (package
+   (name "r-rgtk2")
+   (version "2.20.35")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "RGtk2" version))
+     (sha256
+      (base32
+       "17nxxhkk9jvcwfajbhs5kyrx00lx1irggfbq3l2gp28dvb1cn6z9"))))
+   (properties `((upstream-name . "RGtk2")))
+   (build-system r-build-system)
+   (inputs
+    `(("atk" ,atk)
+      ("cairo" ,cairo)
+      ("glib" ,glib)
+      ("gtk+" ,gtk+-2)
+      ("pango" ,pango)))
+   (native-inputs `(("pkg-config" ,pkg-config)))
+   (home-page "http://www.ggobi.org/rgtk2")
+   (synopsis "R Bindings for Gtk 2.8.0 and Above")
+   (description
+    "Facilities in the R language for programming graphical interfaces
+using Gtk, the Gimp Tool Kit.")
+   (license (list license:gpl2+ license:gpl3+))))
+
+(define-public r-cairodevice
+  (package
+   (name "r-cairodevice")
+   (version "2.25")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "cairoDevice" version))
+     (sha256
+      (base32
+       "0qsg6niz6b67yiqp200mi894s615y2bp0vb2sc093l9x9bc2jvfj"))))
+   (properties `((upstream-name . "cairoDevice")))
+   (build-system r-build-system)
+   (inputs `(("cairo" ,cairo)
+             ("gtk+" ,gtk+-2)
+             ))
+   (native-inputs `(("pkg-config" ,pkg-config)))
+   (arguments
+    `(#:tests? #f ;; requires running X11
+      #:configure-flags (list "--no-build-vignettes" "--no-test-load")
+      ))
+   (home-page
+    "http://cran.r-project.org/web/packages/cairoDevice")
+   (synopsis
+    "Embeddable Cairo Graphics Device Driver")
+   (description
+    "This device uses Cairo and GTK to draw to the screen, file (png,
+svg, pdf, and ps) or memory (arbitrary GdkDrawable or Cairo context).
+The screen device may be embedded into RGtk2 interfaces and supports
+all interactive features of other graphics devices, including
+getGraphicsEvent().")
+   (license (list license:gpl2+ license:gpl3+))))
+
+(define-public r-gwidgets
+  (package
+   (name "r-gwidgets")
+   (version "0.0-54")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "gWidgets" version))
+     (sha256
+      (base32
+       "13lbbbnmkvb559klgsnz0q27qlyv102xakb6yccxsxjw249hm8c2"))))
+   (properties `((upstream-name . "gWidgets")))
+   (build-system r-build-system)
+   (home-page
+    "https://r-forge.r-project.org/R/?group_id=761")
+   (synopsis
+    "gWidgets API for building toolkit-independent, interactive GUIs")
+   (description
+    "gWidgets provides a toolkit-independent API for building
+interactive GUIs.  At least one of the 'gWidgetsXXX packages', such as
+gWidgetstcltk, needs to be installed.  Some icons are on loan from the
+scigraphica project http://scigraphica.sourceforge.net.")
+   (license license:gpl2+)))
+
+(define-public r-gwidgetsrgtk2
+  (package
+   (name "r-gwidgetsrgtk2")
+   (version "0.0-86")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "gWidgetsRGtk2" version))
+     (sha256
+      (base32
+       "0b1xqffbzxlaaaqf1vzfl0a7b6wnnslsp8v5fbxblv7w951rsc4m"))))
+   (properties `((upstream-name . "gWidgetsRGtk2")))
+   (build-system r-build-system)
+   (propagated-inputs
+    `(("r-cairodevice" ,r-cairodevice)
+      ("r-gwidgets" ,r-gwidgets)
+      ("r-rgtk2" ,r-rgtk2)))
+   (arguments
+    `(#:tests? #f ;; requires running X11
+      #:phases
+      (modify-phases %standard-phases
+                     ;; we patch out cairoDevice because it requires X11
+                     (add-before 'install 'patch-out-cairoDevice
+                                 (lambda _
+                                   (substitute* "DESCRIPTION"
+                                                ;; this got ignored by R (("LazyLoad: yes") "LazyLoad: no")
+                                                (("cairoDevice") "methods"))
+                                   (substitute* "NAMESPACE"
+                                                (("cairoDevice") "methods"))#t))
+                     (delete 'check))))
+   (home-page
+    "http://cran.r-project.org/web/packages/gWidgetsRGtk2")
+   (synopsis
+    "Toolkit Implementation of gWidgets for RGtk2")
+   (description
+    "Port of the gWidgets API to the RGtk2 toolkit.")
+   (license license:gpl2+)))
+
+(define-public r-igraph
+  (package
+   (name "r-igraph")
+   (version "1.2.2")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "igraph" version))
+     (sha256
+      (base32
+       "1bggm7b8v3bh7q2589w26qvd7sgs69m4qiij7d0rbm0ykkgxm8lx"))))
+   (build-system r-build-system)
+   (inputs
+    `(("glpk" ,glpk)
+      ("gmp" ,gmp)
+      ("libxml2" ,libxml2)
+      ("zlib" ,zlib)))
+   (propagated-inputs
+    `(("r-magrittr" ,r-magrittr)
+      ("r-matrix" ,r-matrix)
+      ("r-pkgconfig" ,r-pkgconfig)))
+   (native-inputs `(("gfortran" ,gfortran)))
+   (home-page "http://igraph.org")
+   (synopsis "Network Analysis and Visualization")
+   (description
+    "Routines for simple graphs and network analysis.  It can handle large graphs very well and provides functions for generating random and regular graphs, graph visualization, centrality methods and much more.")
+   (license license:gpl2+)))
+
+
+(define-public r-rqda
+  (let ((commit "3cd9abbbde590e1bf9c602b427ebd49e43b6b71a")
+        (revision "0.3-1"))
+    (package
+     (name "r-rqda")
+     (version (string-append "0-" revision "." (string-take commit 9)))
+     (source (origin
+              (method git-fetch) ;; git checkout because there are no recent releases
+              (uri (git-reference
+                    (url "https://github.com/Ronggui/RQDA.git")
+                    (commit commit)))
+              (file-name (string-append name "-" version "-checkout"))
+              (sha256
+               (base32
+                "1s8ibwikmkdhvl5i0simmdh7pqn7ql1vc9d2kxam9f0k56kdpkhb"))))
+     (properties `((upstream-name . "RQDA")))
+     (build-system r-build-system)
+     (propagated-inputs
+      `(("r-dbi" ,r-dbi)
+        ("r-gwidgets" ,r-gwidgets)
+        ("r-gwidgetsrgtk2" ,r-gwidgetsrgtk2)
+        ("r-igraph" ,r-igraph)
+        ("r-rgtk2" ,r-rgtk2)
+        ("r-rsqlite" ,r-rsqlite)))
+     (home-page "http://rqda.r-forge.r-project.org")
+     (synopsis "Qualitative Data Analysis")
+     (description
+      "Software for qualitative text analysis (Kuckartz, 2014,
+<doi:10.4135/9781446288719>).  Current version only supports plain
+text, but it can import PDF highlights if package
+'rjpod' (<https://r-forge.r-project.org/projects/rqda/>) is
+installed.")
+     (license license:bsd-3))))
P
P
Pjotr Prins wrote on 12 Sep 2018 10:50
(address . 32699@debbugs.gnu.org)
20180912085016.m3bfwfyqxusaegyx@thebird.nl
Added another patch for text mining with R tm.

I would appreciate some feedback on the previous patch before I start
submitting.

Pj.
commit b9a90ec3a768b99e112fbfa76e511252fef78fdd
Author: Pjotr Prins <pjotr.public01@thebird.nl>
Date: Tue Sep 11 14:36:38 2018 +0000

added r-tm

Toggle diff (53 lines)
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 1c913a5..4e9244b 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -5900,3 +5900,48 @@ text, but it can import PDF highlights if package
 'rjpod' (<https://r-forge.r-project.org/projects/rqda/>) is
 installed.")
      (license license:bsd-3))))
+
+(define-public r-nlp
+  (package
+   (name "r-nlp")
+   (version "0.1-11")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "NLP" version))
+     (sha256
+      (base32
+       "15v50gxzmpqx49wzkwxfpb5xjpg9y829a0ifys372kf1cfj521aq"))))
+   (properties `((upstream-name . "NLP")))
+   (build-system r-build-system)
+   (home-page
+    "http://cran.r-project.org/web/packages/NLP")
+   (synopsis
+    "Natural Language Processing Infrastructure")
+   (description
+    "Basic classes and methods for Natural Language Processing.")
+   (license license:gpl3)))
+
+(define-public r-tm
+  (package
+   (name "r-tm")
+   (version "0.7-5")
+   (source
+    (origin
+     (method url-fetch)
+     (uri (cran-uri "tm" version))
+     (sha256
+      (base32
+       "05x3kj6dxffcfyn42q2fw9bby5f4wdmslc3ww1dl0r09pz950cax"))))
+   (build-system r-build-system)
+   (propagated-inputs
+    `(("r-bh" ,r-bh)
+      ("r-nlp" ,r-nlp)
+      ("r-rcpp" ,r-rcpp)
+      ("r-slam" ,r-slam)
+      ("r-xml2" ,r-xml2)))
+   (home-page "http://tm.r-forge.r-project.org/")
+   (synopsis "Text Mining Package")
+   (description
+    "This package provides a framework for text mining applications within R.")
+   (license license:gpl3)))
R
R
Ricardo Wurmus wrote on 13 Sep 2018 14:55
Adding r-gtk2 and other packages for r-qda (RFC)
(address . 32699@debbugs.gnu.org)
idjo9d1eev0.fsf@bimsb-sys02.mdc-berlin.net
Hi Pjotr,

thanks for the patches!

I’m glad that you found the recursive importer helpful. Unfortunately,
it doesn’t do a great job with licenses: some of the packages have a
list of GPLv2+ and GPLv3+. Sometimes this is really just a CRAN
expansion for “GPLv2 or later”, other times it means that different
parts of the package are under different licenses.

Could you please check what the license list means for r-rgtk2 and
r-cairodevice? In some cases we can replace the list with a single
license; in other cases we add a comment above the license field to
state what it really means.

Generally, I would recommend putting these packages in (gnu packages
cran) instead of (gnu packages statistics). I’ve been moving packages
from statistics.scm to cran.scm to avoid circular dependencies between
modules.

Here some more comments and questions about the patches:

* the importer unfortunately still defaults to generating HTTP URLs for
the home page instead of HTTPS. It also fails to add a trailing slash
for cran.r-project.org URLs. Could you please add them? (This keeps
the linter happy.)

* the description of many R packages on CRAN don’t use full sentences,
whereas for Guix we’d like to use complete sentences. The easiest way
to fix this is to add “This package provides” to the beginning of the
package description from CRAN. (The importer does this automatically,
when the description begins with “A ”, but it can’t easily guess other
instances where this would be appropriate.)

* the synopses of R packages from CRAN often use … “creative” letter
casing. Instead of, say, “R Bindings for Gtk 2.8.0 and Above” we
would use “R bindings for Gtk 2.8.0 and above”. (I don’t know how to
let the importer do the right thing automatically.)

* for r-cairodevice we might be able to run the tests after setting up
an X server in a pre-check build phase. We would need to add
("xorg-server" ,xorg-server) to the native inputs. Here’s an example
for the phase taken from the caja package:

Toggle snippet (12 lines)
#:phases
(modify-phases %standard-phases
(add-before 'check 'pre-check
(lambda _
;; Tests require a running X server.
(system "Xvfb :1 &")
(setenv "DISPLAY" ":1")
;; For the missing /etc/machine-id.
(setenv "DBUS_FATAL_WARNINGS" "0")
#t)))

* the description in r-cairodevice includes references to code: we
would, for example, replace “arbitrary GdkDrawable or Cairo context”
with “arbitrary @code{GdkDrawable} or @code{Cairo} context”. Same
with “RGtk2” and “getGraphicsEvent()”.

* I would replace the description of “r-gwidgets” with this text:

"gWidgets provides a toolkit-independent API for building
interactive GUIs. At least one of the toolkit implementations for
a specific GUI backend (such as @code{gWidgetsRGtk2}) should be
installed."

* In r-gwidgetsrgtk2 we might be able to do without patching the
DESCRIPTION and NAMESPACE files by adding a pre-check phase as shown
above. Is there another reason for patching this file?

* I would change the r-gwidgetsrgtk2 description to this (taken from the
package documentation):

“This package allows the gWidgets API to use the RGtk2 package
allowing the use of the GTK libraries within R.”

* r-igraph already exists in (gnu packages graph).

* r-rqda uses sources from a git checkout, which means that you could
use git-specific helpers:

(version (git-version "0.3-1" revision commit))
(file-name (git-file-name name version))

Note that the revision is just a Guix-internal number (as a string)
starting at "1".

* r-nlp: the same applies as for other packages: please add it to
cran.scm, use HTTPS and a trailing slash for the home-page field, use
lower case for the synopsis, and expand the description to a complete
sentence.

* r-tm looks fine to me.

To generate patches more easily you can create one local commit per
package and then use git format-patch -5 to create 5 patch files for the
last 5 commits. We usually apply one patch per package.

--
Ricardo
R
R
Ricardo Wurmus wrote on 13 Sep 2018 19:02
control message for bug #32699
(address . control@debbugs.gnu.org)
165d3e20dcd.67971f78-1101793078.8721709708423021113@zoho.com
owner 32699 !
Z
Z
zimoun wrote on 23 Mar 16:45 +0100
Re: bug#32699: Adding r-gtk2 and other packages for r-qda (RFC)
(name . Ricardo Wurmus)(address . ricardo.wurmus@mdc-berlin.de)(address . 32699@debbugs.gnu.org)
86cziczn95.fsf_-_@gmail.com
Hi Ricardo,

Digging this old patch [1], well considering that running now “guix
import cran -r” for the second submission:

+ (name "r-nlp“)
+ (version "0.1-11")

+ (name "r-tm")
+ (version "0.7-5")

the result is:

(name "r-nlp")
(version "0.2-1")

(name "r-tm")
(version "0.7-8")


For the others:

+(define-public r-rgtk2
+ (package
+ (name "r-rgtk2")
+ (version "2.20.35")

Not in CRAN anymore.


+(define-public r-cairodevice
+ (package
+ (name "r-cairodevice")
+ (version "2.25")

Not in CRAN anymore.


+(define-public r-gwidgets
+ (package
+ (name "r-gwidgets")
+ (version "0.0-54")

Not in CRAN anymore.


+(define-public r-gwidgetsrgtk2
+ (package
+ (name "r-gwidgetsrgtk2")
+ (version "0.0-86")

Not in CRAN anymore.


+(define-public r-igraph
+ (package
+ (name "r-igraph")
+ (version "1.2.2")

Current Guix:

name: r-igraph
version: 1.2.11


+(define-public r-rqda
+ (let ((commit "3cd9abbbde590e1bf9c602b427ebd49e43b6b71a")
+ (revision "0.3-1"))
+ (package

Not in CRAN anymore.


On Thu, 13 Sep 2018 at 14:55, Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de> wrote:

Toggle quote (2 lines)
> Here some more comments and questions about the patches:

[...]

Toggle quote (4 lines)
> To generate patches more easily you can create one local commit per
> package and then use git format-patch -5 to create 5 patch files for the
> last 5 commits. We usually apply one patch per package.

Reading your comments, I propose therefore to drop this patch in favor
of another recent submission one (I or you if you beat me :-)) could do
later after this email.


WDYT?



Cheers,
simon
R
R
Ricardo Wurmus wrote on 6 May 13:26 +0200
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 32699@debbugs.gnu.org)
87mtfuuck1.fsf@mdc-berlin.de
zimoun <zimon.toutoune@gmail.com> writes:

Toggle quote (7 lines)
> Reading your comments, I propose therefore to drop this patch in favor
> of another recent submission one (I or you if you beat me :-)) could do
> later after this email.
>
>
> WDYT?

Sounds good.

--
Ricardo
?