Patchwork [2/2] gnu: r-rmarkdown: Ensure temporary files can be deleted.

login
register
mail settings
Submitter Ricardo Wurmus
Date Sept. 8, 2016, 12:51 p.m.
Message ID <20160908125105.8435-2-ricardo.wurmus@mdc-berlin.de>
Download mbox | patch
Permalink /patch/15395/
State New
Headers show

Comments

Ricardo Wurmus - Sept. 8, 2016, 12:51 p.m.
* gnu/packages/statistics.scm (r-rmarkdown)[arguments]: Add phase
"copy-files-without-mode".
---
 gnu/packages/statistics.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
Leo Famulari - Sept. 13, 2016, 5:48 a.m.
On Thu, Sep 08, 2016 at 02:51:05PM +0200, Ricardo Wurmus wrote:
> * gnu/packages/statistics.scm (r-rmarkdown)[arguments]: Add phase
> "copy-files-without-mode".

LGTM

Patch

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index a9aa83b..da64f66 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -2097,6 +2097,20 @@  encoder/decoder, round-off-error-free sum and cumsum, etc.")
             "09ajq5miqzz46q0i9svvbh93dbi7xbjn4702d6z3scdz272gx7l2"))))
     (properties `((upstream-name . "rmarkdown")))
     (build-system r-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         ;; See https://github.com/rstudio/rmarkdown/pull/800
+         ;; The resource files are in the store and have mode 444.  After
+         ;; copying the files R fails to remove them again because it doesn't
+         ;; have write access to them.
+         (add-after 'unpack 'copy-files-without-mode
+           (lambda _
+             (substitute* "R/render.R"
+               (("file.copy\\(from = from," prefix)
+                (string-append prefix
+                               " copy.mode = FALSE, ")))
+             #t)))))
     (propagated-inputs
      `(("r-catools" ,r-catools)
        ("r-htmltools" ,r-htmltools)