Patchwork gnu: libreoffice: Add 'libreoffice' symlink.

login
register
mail settings
Submitter Alex Kost
Date Dec. 6, 2016, 8:35 p.m.
Message ID <87wpfcssn8.fsf@gmail.com>
Download mbox | patch
Permalink /patch/18243/
State New
Headers show

Comments

Alex Kost - Dec. 6, 2016, 8:35 p.m.
ng0 (2016-12-06 20:04 +0000) wrote:

> * gnu/packages/libreoffice.scm (libreoffice)[arguments]: Create symlink to
> libreoffice in new phase.
> ---
>  gnu/packages/libreoffice.scm | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
> index e02e4f4cd..5f1435745 100644
> --- a/gnu/packages/libreoffice.scm
> +++ b/gnu/packages/libreoffice.scm
> @@ -2,6 +2,7 @@
>  ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
>  ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
>  ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
> +;;; Copyright © 2016 ng0 <ng0@libertad.pw>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -828,7 +829,15 @@ and to return information on pronunciations, meanings and synonyms.")
>                   (symlink
>                     (string-append out "/lib/libreoffice/program/soffice")
>                     (string-append bin "/soffice")))
> -               #t)))
> +               #t))
> +           (add-after 'bin-install 'symlink-libreoffice
> +             ;; Create a symlink bin/libreoffice to the executable script.
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (let* ((out (assoc-ref outputs "out")))

This 'let*' is not needed (since you don't use 'out' variable), however
I've just noticed that there is 'bin-install' phase right before it, so
I think an additional phase is not needed at all, the required
symlinking can be done in that 'bin-install' phase.

> +                 (with-directory-excursion
> +                     (string-append (assoc-ref outputs "out") "/bin")
> +                   (symlink "soffice" "libreoffice"))
> +                 #t)))
>         #:configure-flags
>          (list
>            "--enable-release-build"

Previously I thought that libreoffice provides "bin/soffice" binary, so
I "voted" for a symlink (as it would simply be "libreoffice ->
soffice").  But now I see that "soffice" is a symlink created by
'bin-install' phase.  So now I would just modify that phase like this:
ng0 - Dec. 6, 2016, 8:42 p.m.
Alex Kost <alezost@gmail.com> writes:

> ng0 (2016-12-06 20:04 +0000) wrote:
>
>> * gnu/packages/libreoffice.scm (libreoffice)[arguments]: Create symlink to
>> libreoffice in new phase.
>> ---
>>  gnu/packages/libreoffice.scm | 11 ++++++++++-
>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>
>> diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
>> index e02e4f4cd..5f1435745 100644
>> --- a/gnu/packages/libreoffice.scm
>> +++ b/gnu/packages/libreoffice.scm
>> @@ -2,6 +2,7 @@
>>  ;;; Copyright © 2014 John Darrington <jmd@gnu.org>
>>  ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
>>  ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
>> +;;; Copyright © 2016 ng0 <ng0@libertad.pw>
>>  ;;;
>>  ;;; This file is part of GNU Guix.
>>  ;;;
>> @@ -828,7 +829,15 @@ and to return information on pronunciations, meanings and synonyms.")
>>                   (symlink
>>                     (string-append out "/lib/libreoffice/program/soffice")
>>                     (string-append bin "/soffice")))
>> -               #t)))
>> +               #t))
>> +           (add-after 'bin-install 'symlink-libreoffice
>> +             ;; Create a symlink bin/libreoffice to the executable script.
>> +             (lambda* (#:key outputs #:allow-other-keys)
>> +               (let* ((out (assoc-ref outputs "out")))
>
> This 'let*' is not needed (since you don't use 'out' variable), however

Oh, thanks for catching it.

> I've just noticed that there is 'bin-install' phase right before it, so
> I think an additional phase is not needed at all, the required
> symlinking can be done in that 'bin-install' phase.

Okay, I did not want to touch that because I did think for some
reason it should be separated, but what you provided as diff
further below looks better than my approach. I'd be okay with
this. My change is so small, you could probably create your own
patch and send it to this thread.

>
>> +                 (with-directory-excursion
>> +                     (string-append (assoc-ref outputs "out") "/bin")
>> +                   (symlink "soffice" "libreoffice"))
>> +                 #t)))
>>         #:configure-flags
>>          (list
>>            "--enable-release-build"
>
> Previously I thought that libreoffice provides "bin/soffice" binary, so
> I "voted" for a symlink (as it would simply be "libreoffice ->
> soffice").  But now I see that "soffice" is a symlink created by
> 'bin-install' phase.  So now I would just modify that phase like this:
>
> diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
> index e02e4f4..6391482 100644
> --- a/gnu/packages/libreoffice.scm
> +++ b/gnu/packages/libreoffice.scm
> @@ -823,11 +823,12 @@ and to return information on pronunciations, meanings and synonyms.")
>               ;; Create a symlink bin/soffice to the executable script.
>               (lambda* (#:key outputs #:allow-other-keys)
>                 (let* ((out (assoc-ref outputs "out"))
> -                      (bin (string-append out "/bin")))
> +                      (bin (string-append out "/bin"))
> +                      (soffice (string-append
> +                                out "/lib/libreoffice/program/soffice")))
>                   (mkdir bin)
> -                 (symlink
> -                   (string-append out "/lib/libreoffice/program/soffice")
> -                   (string-append bin "/soffice")))
> +                 (symlink soffice (string-append bin "/soffice"))
> +                 (symlink soffice (string-append bin "/libreoffice")))
>                 #t)))
>         #:configure-flags
>          (list
>
> -- 
> Alex
Alex Kost - Dec. 8, 2016, 9:37 a.m.
ng0 (2016-12-06 20:42 +0000) wrote:

> Alex Kost <alezost@gmail.com> writes:
[...]
>> I've just noticed that there is 'bin-install' phase right before it, so
>> I think an additional phase is not needed at all, the required
>> symlinking can be done in that 'bin-install' phase.
>
> Okay, I did not want to touch that because I did think for some
> reason it should be separated, but what you provided as diff
> further below looks better than my approach. I'd be okay with
> this. My change is so small, you could probably create your own
> patch and send it to this thread.

Since it's trivial, I committed it¹... but then I realized that
originally it was more like a question about adding 'libreoffice' link
along with the 'soffice' one.  So I hope other people will not object
that there is 'bin/libreoffice' now :-)

¹ http://git.savannah.gnu.org/cgit/guix.git/commit/?id=cb72d34348998501c0dfa9f6ac4eb64bddd99fbf
Ludovic Courtès - Dec. 8, 2016, 10:48 p.m.
Alex Kost <alezost@gmail.com> skribis:

> ng0 (2016-12-06 20:42 +0000) wrote:
>
>> Alex Kost <alezost@gmail.com> writes:
> [...]
>>> I've just noticed that there is 'bin-install' phase right before it, so
>>> I think an additional phase is not needed at all, the required
>>> symlinking can be done in that 'bin-install' phase.
>>
>> Okay, I did not want to touch that because I did think for some
>> reason it should be separated, but what you provided as diff
>> further below looks better than my approach. I'd be okay with
>> this. My change is so small, you could probably create your own
>> patch and send it to this thread.
>
> Since it's trivial, I committed it¹... but then I realized that
> originally it was more like a question about adding 'libreoffice' link
> along with the 'soffice' one.  So I hope other people will not object
> that there is 'bin/libreoffice' now :-)

Sounds good to me, thanks!  :-)

Ludo’.

Patch

diff --git a/gnu/packages/libreoffice.scm b/gnu/packages/libreoffice.scm
index e02e4f4..6391482 100644
--- a/gnu/packages/libreoffice.scm
+++ b/gnu/packages/libreoffice.scm
@@ -823,11 +823,12 @@  and to return information on pronunciations, meanings and synonyms.")
              ;; Create a symlink bin/soffice to the executable script.
              (lambda* (#:key outputs #:allow-other-keys)
                (let* ((out (assoc-ref outputs "out"))
-                      (bin (string-append out "/bin")))
+                      (bin (string-append out "/bin"))
+                      (soffice (string-append
+                                out "/lib/libreoffice/program/soffice")))
                  (mkdir bin)
-                 (symlink
-                   (string-append out "/lib/libreoffice/program/soffice")
-                   (string-append bin "/soffice")))
+                 (symlink soffice (string-append bin "/soffice"))
+                 (symlink soffice (string-append bin "/libreoffice")))
                #t)))
        #:configure-flags
         (list