all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] gnu: r: Use uname from Guix
@ 2016-10-26 15:11 Roel Janssen
  2016-10-27 13:58 ` Ricardo Wurmus
  0 siblings, 1 reply; 3+ messages in thread
From: Roel Janssen @ 2016-10-26 15:11 UTC (permalink / raw)
  To: guix-devel

Dear Guix,

When running R, it executes a wrapper script that relies on
@code{uname} to be available in PATH:

> R_HOME_DIR=/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R
> if test "${R_HOME_DIR}" = "/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R"; then
>    case "linux-gnu" in
>    linux*)
>      run_arch=`uname -m`
>      case "$run_arch" in
>         x86_64|mips64|ppc64|powerpc64|sparc64|s390x)
>           libnn=lib64

Running R in a pure, ad-hoc environment will therefore signal a warning
that it cannot execute "uname".

With the following patch, it no longer makes this assumption.  Instead
it uses an absolute path to a uname binary from the Guix store.

From e364cb25204edea4d8bfb9cfc52764f811c58e72 Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Wed, 26 Oct 2016 17:09:19 +0200
Subject: [PATCH] gnu: r: Use uname from Guix

* gnu/packages/statistics.scm (r): Use uname from Guix.
---
 gnu/packages/statistics.scm | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
index 1b8d074..5e4cd8c 100644
--- a/gnu/packages/statistics.scm
+++ b/gnu/packages/statistics.scm
@@ -118,6 +118,12 @@ be output in text, PostScript, PDF or HTML.")
                             "/lib/R/lib"))
        #:phases
        (modify-phases %standard-phases
+         (add-before 'configure 'patch-uname
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((uname-bin (string-append (assoc-ref inputs "coreutils")
+                                             "/bin/uname")))
+               (substitute* "src/scripts/R.sh.in"
+                 (("uname") uname-bin)))))
          (add-before
           'configure 'set-default-pager
           ;; Set default pager to "cat", because otherwise it is "false",
@@ -169,6 +175,7 @@ be output in text, PostScript, PDF or HTML.")
      `(;; We need not only cairo here, but pango to ensure that tests for the
        ;; "cairo" bitmapType plotting backend succeed.
        ("pango" ,pango)
+       ("coreutils" ,coreutils)
        ("curl" ,curl)
        ("tzdata" ,tzdata)
        ("gfortran" ,gfortran)
-- 
2.10.0

Kind regards,
Roel Janssen

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: r: Use uname from Guix
  2016-10-26 15:11 [PATCH] gnu: r: Use uname from Guix Roel Janssen
@ 2016-10-27 13:58 ` Ricardo Wurmus
  2016-10-27 14:38   ` Roel Janssen
  0 siblings, 1 reply; 3+ messages in thread
From: Ricardo Wurmus @ 2016-10-27 13:58 UTC (permalink / raw)
  To: Roel Janssen; +Cc: guix-devel


Roel Janssen <roel@gnu.org> writes:

> Dear Guix,
>
> When running R, it executes a wrapper script that relies on
> @code{uname} to be available in PATH:
>
>> R_HOME_DIR=/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R
>> if test "${R_HOME_DIR}" = "/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R"; then
>>    case "linux-gnu" in
>>    linux*)
>>      run_arch=`uname -m`
>>      case "$run_arch" in
>>         x86_64|mips64|ppc64|powerpc64|sparc64|s390x)
>>           libnn=lib64
>
> Running R in a pure, ad-hoc environment will therefore signal a warning
> that it cannot execute "uname".
>
> With the following patch, it no longer makes this assumption.  Instead
> it uses an absolute path to a uname binary from the Guix store.
>
>From e364cb25204edea4d8bfb9cfc52764f811c58e72 Mon Sep 17 00:00:00 2001
> From: Roel Janssen <roel@gnu.org>
> Date: Wed, 26 Oct 2016 17:09:19 +0200
> Subject: [PATCH] gnu: r: Use uname from Guix
>
> * gnu/packages/statistics.scm (r): Use uname from Guix.
> ---
>  gnu/packages/statistics.scm | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
> index 1b8d074..5e4cd8c 100644
> --- a/gnu/packages/statistics.scm
> +++ b/gnu/packages/statistics.scm
> @@ -118,6 +118,12 @@ be output in text, PostScript, PDF or HTML.")
>                              "/lib/R/lib"))
>         #:phases
>         (modify-phases %standard-phases
> +         (add-before 'configure 'patch-uname
> +           (lambda* (#:key inputs #:allow-other-keys)
> +             (let ((uname-bin (string-append (assoc-ref inputs "coreutils")
> +                                             "/bin/uname")))
> +               (substitute* "src/scripts/R.sh.in"
> +                 (("uname") uname-bin)))))

Please add #t to the end, because “substitute*” doesn’t have a return value.

>           (add-before
>            'configure 'set-default-pager
>            ;; Set default pager to "cat", because otherwise it is "false",
> @@ -169,6 +175,7 @@ be output in text, PostScript, PDF or HTML.")
>       `(;; We need not only cairo here, but pango to ensure that tests for the
>         ;; "cairo" bitmapType plotting backend succeed.
>         ("pango" ,pango)
> +       ("coreutils" ,coreutils)
>         ("curl" ,curl)
>         ("tzdata" ,tzdata)
>         ("gfortran" ,gfortran)

This looks good to me.  Thanks!

~~ Ricardo

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: r: Use uname from Guix
  2016-10-27 13:58 ` Ricardo Wurmus
@ 2016-10-27 14:38   ` Roel Janssen
  0 siblings, 0 replies; 3+ messages in thread
From: Roel Janssen @ 2016-10-27 14:38 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel


Ricardo Wurmus writes:

> Roel Janssen <roel@gnu.org> writes:
>
>> Dear Guix,
>>
>> When running R, it executes a wrapper script that relies on
>> @code{uname} to be available in PATH:
>>
>>> R_HOME_DIR=/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R
>>> if test "${R_HOME_DIR}" = "/gnu/store/dz83xhn43qc2dpdrja8mhx78l7qffqvq-r-3.3.0/lib/R"; then
>>>    case "linux-gnu" in
>>>    linux*)
>>>      run_arch=`uname -m`
>>>      case "$run_arch" in
>>>         x86_64|mips64|ppc64|powerpc64|sparc64|s390x)
>>>           libnn=lib64
>>
>> Running R in a pure, ad-hoc environment will therefore signal a warning
>> that it cannot execute "uname".
>>
>> With the following patch, it no longer makes this assumption.  Instead
>> it uses an absolute path to a uname binary from the Guix store.
>>
>>From e364cb25204edea4d8bfb9cfc52764f811c58e72 Mon Sep 17 00:00:00 2001
>> From: Roel Janssen <roel@gnu.org>
>> Date: Wed, 26 Oct 2016 17:09:19 +0200
>> Subject: [PATCH] gnu: r: Use uname from Guix
>>
>> * gnu/packages/statistics.scm (r): Use uname from Guix.
>> ---
>>  gnu/packages/statistics.scm | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/gnu/packages/statistics.scm b/gnu/packages/statistics.scm
>> index 1b8d074..5e4cd8c 100644
>> --- a/gnu/packages/statistics.scm
>> +++ b/gnu/packages/statistics.scm
>> @@ -118,6 +118,12 @@ be output in text, PostScript, PDF or HTML.")
>>                              "/lib/R/lib"))
>>         #:phases
>>         (modify-phases %standard-phases
>> +         (add-before 'configure 'patch-uname
>> +           (lambda* (#:key inputs #:allow-other-keys)
>> +             (let ((uname-bin (string-append (assoc-ref inputs "coreutils")
>> +                                             "/bin/uname")))
>> +               (substitute* "src/scripts/R.sh.in"
>> +                 (("uname") uname-bin)))))
>
> Please add #t to the end, because “substitute*” doesn’t have a return value.

Right.  I will try to remember this better in the future too.

>>           (add-before
>>            'configure 'set-default-pager
>>            ;; Set default pager to "cat", because otherwise it is "false",
>> @@ -169,6 +175,7 @@ be output in text, PostScript, PDF or HTML.")
>>       `(;; We need not only cairo here, but pango to ensure that tests for the
>>         ;; "cairo" bitmapType plotting backend succeed.
>>         ("pango" ,pango)
>> +       ("coreutils" ,coreutils)
>>         ("curl" ,curl)
>>         ("tzdata" ,tzdata)
>>         ("gfortran" ,gfortran)
>
> This looks good to me.  Thanks!

Thanks!  I applied the changes above and pushed it in b5ce25cc0.

Kind regards,
Roel Janssen

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-27 14:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-26 15:11 [PATCH] gnu: r: Use uname from Guix Roel Janssen
2016-10-27 13:58 ` Ricardo Wurmus
2016-10-27 14:38   ` Roel Janssen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.