summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2018-03-09 22:25:40 +0100
committerRicardo Wurmus <rekado@elephly.net>2018-03-10 14:25:09 +0100
commit0fa4702c041a5746ec3a58b39e4276c39d18e7da (patch)
tree1a84645121986775b7a6abb93163c48faa39a1f2
parent8e3b852ad0c53612828bc1c10bf7f2014eaa5ba4 (diff)
downloadgnu-guix-0fa4702c041a5746ec3a58b39e4276c39d18e7da.tar
gnu-guix-0fa4702c041a5746ec3a58b39e4276c39d18e7da.tar.gz
gnu: r-minimal: Respect SOURCE_DATE_EPOCH in srcfile.
Fixes <https://bugs.gnu.org/30729>. * gnu/packages/statistics.scm (r-minimal)[arguments]: Replace timestamp hack with patch to "srcfile" and "srcfilecopy".
-rw-r--r--gnu/packages/statistics.scm24
1 files changed, 9 insertions, 15 deletions
diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 1324abd1f5..af69703d90 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -172,21 +172,15 @@ be output in text, PostScript, PDF or HTML.")
;; 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.
- ;;
- ;; Instead of disabling this feature, which may have unexpected
- ;; consequences, we reset the mtime of generated files before
- ;; passing them to the "srcfile" procedure.
- (substitute* "src/library/Makefile.in"
- (("@\\(cd base && \\$\\(MAKE\\) mkdesc\\)" line)
- (string-append line "\n find $(top_builddir)/library/tools | xargs touch -d '1970-01-01'; \n"))
- (("@\\$\\(MAKE\\) Rdobjects" line)
- (string-append "@find $(srcdir)/tools | xargs touch -d '1970-01-01'; \n "
- line)))
- (substitute* "src/library/tools/Makefile.in"
- (("@\\$\\(INSTALL_DATA\\) all.R \\$\\(top_builddir\\)/library/\\$\\(pkg\\)/R/\\$\\(pkg\\)" line)
- (string-append
- line
- "\n find $(srcdir)/$(pkg) $(top_builddir)/library/$(pkg) | xargs touch -d \"1970-01-01\"; \n")))
+
+ ;; 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.