Browse Source

gn: Add r-minimal-2 and some R packages

Efraim Flashner 1 year ago
  1. 151


@ -12,7 +12,9 @@
#:use-module (gnu packages python)
#:use-module (gnu packages python-science)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages statistics))
#:use-module (gnu packages statistics)
#:use-module (gnu packages texinfo)
#:use-module (srfi srfi-1))
(define-public r-hmisc-3
@ -148,3 +150,150 @@ traits (CTL). The additional correlation information obtained can be
combined with QTL information to perform de novo reconstruction of
interaction networks.")
(license license:gpl3)))
;; r-with-tests is private so we inherit from r-minimal.
(define r-with-tests-2
(inherit r-minimal)
(name "r-with-tests")
(version "2.15.3")
(method url-fetch)
(uri (string-append "mirror://cran/src/base"
"/R-" (version-major version)
"/R-" version ".tar.gz"))
(substitute-keyword-arguments (package-arguments r-minimal)
((#:tests? _ #t) #t)
((#:configure-flags cf)
`(cons* "--with-system-zlib"
(delete "--without-recommended-packages" ,cf)))
((#:phases phases)
`(modify-phases ,phases
;; We can only use some of 'build-reproducibly with this older version.
(replace 'build-reproducibly
(lambda _
;; The documentation contains time stamps to demonstrate
;; documentation generation in different phases.
(substitute* "src/library/tools/man/Rd2HTML.Rd"
(("\\\\%Y-\\\\%m-\\\\%d at \\\\%H:\\\\%M:\\\\%S")
"(removed for reproducibility)"))
;; Remove timestamp from tracing environment. This fixes
;; reproducibility of "methods.rd{b,x}".
(substitute* "src/library/methods/R/trace.R"
(("dateCreated = Sys.time\\(\\)")
"dateCreated = as.POSIXct(\"1970-1-1 00:00:00\", tz = \"UTC\")"))
;; Ensure that gzipped files are reproducible.
(substitute* '("src/library/grDevices/"
(("R_GZIPCMD\\)" line)
(string-append line " -n")))
;; The "srcfile" procedure in "src/library/base/R/srcfile.R"
;; queries the mtime of a given file and records it in an object.
;; This is acceptable at runtime to detect stale source files,
;; but it destroys reproducibility at build time.
;; Similarly, the "srcfilecopy" procedure records the current
;; time. We change both of them to respect SOURCE_DATE_EPOCH.
; (substitute* "src/library/base/R/srcfile.R"
; (("timestamp <- (timestamp.*|file.mtime.*)" _ time)
; (string-append "timestamp <- \
;as.POSIXct(if (\"\" != Sys.getenv(\"SOURCE_DATE_EPOCH\")) {\
; as.numeric(Sys.getenv(\"SOURCE_DATE_EPOCH\"))\
;} else { " time "}, origin=\"1970-01-01\")\n")))
;; This library is installed using "install_package_description",
;; so we need to pass the "builtStamp" argument.
;(substitute* "src/library/tools/"
; (("(install_package_description\\(.*\"')\\)\"" line prefix)
; (string-append prefix ", builtStamp='1970-01-01')\"")))
(substitute* "src/library/Recommended/"
(string-append m " --built-timestamp=1970-01-01" m)))
;; R bundles an older version of help2man, which does not respect
;; SOURCE_DATE_EPOCH. We cannot just use the latest help2man,
;; because that breaks a test.
(with-fluids ((%default-port-encoding "ISO-8859-1"))
(substitute* "tools/"
(("my \\$date = strftime \"%B %Y\", localtime" line)
(string-append line " 1"))))
`(("texinfo" ,texinfo-4)
,@(alist-delete "texinfo" (package-native-inputs r-minimal))))
(properties '((release-date "2013-03-01")))))
(define-public r-minimal-2
(inherit r-with-tests-2)
(name "r-minimal")
(substitute-keyword-arguments (package-arguments r-with-tests-2)
((#:tests? _ #f) #f)
((#:configure-flags flags)
;; Do not build the recommended packages. The build system creates
;; random temporary directories and embeds their names in some
;; package files. We build these packages with the r-build-system
;; instead.
`(cons* "--without-recommended-packages" ,flags))))))
(define-public r-2-lattice
(inherit r-lattice)
(name "r-lattice")
(version "0.20-31")
(method url-fetch)
(uri (cran-uri "lattice" version))
(build-system r-build-system)
`(#:r ,r-minimal-2))))
(define-public r-2-matrix
(inherit r-matrix)
(name "r-matrix")
(version "1.2-0")
(method url-fetch)
(uri (cran-uri "Matrix" version))
`(#:r ,r-minimal-2))
`(("r-lattice" ,r-2-lattice)))))
(define-public r-2-survival
(inherit r-survival)
(name "r-survival")
(version "2.41-3")
(method url-fetch)
(uri (cran-uri "survival" version))
`(#:r ,r-minimal-2))
`(("r-matrix" ,r-2-matrix)))))