unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#34576] Calibre: Add icon and desktop file to Calibre
@ 2019-02-19 18:26 pkill9
  2019-02-19 21:26 ` Ricardo Wurmus
  2020-10-01  3:18 ` bug#34576: " Michael Rohleder
  0 siblings, 2 replies; 8+ messages in thread
From: pkill9 @ 2019-02-19 18:26 UTC (permalink / raw)
  To: 34576

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

This patch adds two phases to the package definition for Calibre that install an icon and install a desktop file.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-calibre-Add-icon-and-desktop-file.patch --]
[-- Type: text/x-patch; name="0001-gnu-calibre-Add-icon-and-desktop-file.patch", Size: 2169 bytes --]

From 894a471083105a182d548c2b80effb0eb70c8fa6 Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Tue, 19 Feb 2019 18:23:37 +0000
Subject: [PATCH] gnu: calibre: Add icon and desktop file.

* gnu/packages/ebook.scm (calibre): Add icon and desktop file.
---
 gnu/packages/ebook.scm | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index 99e49bc17..ae899e04b 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -185,7 +185,32 @@
               (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
               (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))
               #t)))
-         (add-after 'install 'install-font-liberation
+         (add-after 'install 'install-icon
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out")))
+               (install-file "imgsrc/calibre.svg"
+                             (string-append out
+                                            "/share/icons/hicolor/scalable/apps")))
+             #t))
+         (add-after 'install-icon 'install-desktop-file
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/share/applications"))
+               (with-output-to-file
+                   (string-append out "/share/applications/calibre.desktop")
+                 (lambda _
+                   (format #t
+                           "[Desktop Entry]~@
+                Name=Calibre~@
+                Comment=E-book organiser and reader~@
+                Exec=~a/bin/calibre~@
+                TryExec=~@*~a/bin/calibre~@
+                Icon=calibre~@
+                Categories=Office~@
+                Type=Application~%"
+                           out)))
+               #t)))
+         (add-after 'install-desktop-file 'install-font-liberation
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (for-each (lambda (file)
                          (install-file file (string-append
-- 
2.20.1


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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-19 18:26 [bug#34576] Calibre: Add icon and desktop file to Calibre pkill9
@ 2019-02-19 21:26 ` Ricardo Wurmus
  2019-02-20  4:30   ` pkill9
  2019-02-20  5:06   ` pkill9
  2020-10-01  3:18 ` bug#34576: " Michael Rohleder
  1 sibling, 2 replies; 8+ messages in thread
From: Ricardo Wurmus @ 2019-02-19 21:26 UTC (permalink / raw)
  To: pkill9; +Cc: 34576


Hi pkill9,

> +         (add-after 'install 'install-icon
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let* ((out (assoc-ref outputs "out")))
> +               (install-file "imgsrc/calibre.svg"
> +                             (string-append out
> +                                            "/share/icons/hicolor/scalable/apps")))
> +             #t))

You can do without “let*” here.

> +         (add-after 'install-icon 'install-desktop-file
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out")))
> +               (mkdir-p (string-append out "/share/applications"))
> +               (with-output-to-file
> +                   (string-append out "/share/applications/calibre.desktop")
> +                 (lambda _
> +                   (format #t
> +                           "[Desktop Entry]~@
> +                Name=Calibre~@
> +                Comment=E-book organiser and reader~@
> +                Exec=~a/bin/calibre~@
> +                TryExec=~@*~a/bin/calibre~@
> +                Icon=calibre~@
> +                Categories=Office~@
> +                Type=Application~%"
> +                           out)))
> +               #t)))

Does upstream not provide a desktop file?  I’d rather see this submitted
to upstream.  Have you contacted the developers about this?

Secondly, the indentation is odd.  I’d write it like this:

     (format #t "\
[Desktop Entry]~@
Name=…
Comment=…
…
Type=Application~%" out)


--
Ricardo

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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-19 21:26 ` Ricardo Wurmus
@ 2019-02-20  4:30   ` pkill9
  2019-02-20  5:00     ` Brett Gilio
  2019-02-20  5:06   ` pkill9
  1 sibling, 1 reply; 8+ messages in thread
From: pkill9 @ 2019-02-20  4:30 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 34576

Hi Ricardo,

> Does upstream not provide a desktop file?  I’d rather see this submitted
> to upstream.  Have you contacted the developers about this?

It looks like it does provide a desktop file looking at this pull request: https://github.com/kovidgoyal/calibre/pull/739, which modifies this file (link to line showing desktop file): https://github.com/kovidgoyal/calibre/blob/master/src/calibre/linux.py#L1031

It's created using a Python script though, perhaps it doesn't get run during building?

I thought the developer wouldn't add it upstream because I remember investigating a long time ago and finding the developer writing somewhere that they wouldn't add a desktop file upstream and that it was the linux packager's job to do that, maybe I am mis-remembering or it was in some other context.

On Tue, 19 Feb 2019 22:26:35 +0100, Ricardo Wurmus <rekado@elephly.net> wrote:

> 
> Hi pkill9,
> 
> > +         (add-after 'install 'install-icon
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let* ((out (assoc-ref outputs "out")))
> > +               (install-file "imgsrc/calibre.svg"
> > +                             (string-append out
> > +                                            "/share/icons/hicolor/scalable/apps")))
> > +             #t))
> 
> You can do without “let*” here.
> 
> > +         (add-after 'install-icon 'install-desktop-file
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let ((out (assoc-ref outputs "out")))
> > +               (mkdir-p (string-append out "/share/applications"))
> > +               (with-output-to-file
> > +                   (string-append out "/share/applications/calibre.desktop")
> > +                 (lambda _
> > +                   (format #t
> > +                           "[Desktop Entry]~@
> > +                Name=Calibre~@
> > +                Comment=E-book organiser and reader~@
> > +                Exec=~a/bin/calibre~@
> > +                TryExec=~@*~a/bin/calibre~@
> > +                Icon=calibre~@
> > +                Categories=Office~@
> > +                Type=Application~%"
> > +                           out)))
> > +               #t)))
> 
> Does upstream not provide a desktop file?  I’d rather see this submitted
> to upstream.  Have you contacted the developers about this?
> 
> Secondly, the indentation is odd.  I’d write it like this:
> 
>      (format #t "\
> [Desktop Entry]~@
> Name=…
> Comment=…
> …
> Type=Application~%" out)
> 
> 
> --
> Ricardo

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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-20  4:30   ` pkill9
@ 2019-02-20  5:00     ` Brett Gilio
  0 siblings, 0 replies; 8+ messages in thread
From: Brett Gilio @ 2019-02-20  5:00 UTC (permalink / raw)
  To: pkill9; +Cc: 34576


pkill9@runbox.com writes:
> I thought the developer wouldn't add it upstream because I remember investigating a long time ago and finding the developer writing somewhere that they wouldn't add a desktop file upstream and that it was the linux packager's job to do that, maybe I am mis-remembering or it was in some other context.


While we are on that topic, the Calibre maintainer can be (said
lovingly) stubborn about some things. On a related topic, Calibre (to my
knowledge) is going to remain on python2 forever at his choice because
of a political disagreement with python3.

Correctness aside, that might have some impact on our upcoming "Great
Python 2 Purge".

Brett Gilio

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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-19 21:26 ` Ricardo Wurmus
  2019-02-20  4:30   ` pkill9
@ 2019-02-20  5:06   ` pkill9
  2019-02-20 14:08     ` Tobias Geerinckx-Rice
  2019-02-20 14:25     ` Tobias Geerinckx-Rice
  1 sibling, 2 replies; 8+ messages in thread
From: pkill9 @ 2019-02-20  5:06 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: 34576

[-- Attachment #1: Type: text/plain, Size: 2492 bytes --]

I've attached a patch with the 'let' removed from the icon install phase, but I haven't changed the indentation of the desktop file because when I did that it added a blank line at the beginning of the desktop file and created a large indentation before '[Desktop Entry]'. I moved 'out' to be next to the last line of the desktop file output.

> Secondly, the indentation is odd.  I’d write it like this:
> 
>      (format #t "\
> [Desktop Entry]~@
> Name=…
> Comment=…
> …
> Type=Application~%" out)
> 
> 
> --

I used the xonotic package definition as a reference for thi part, and emacs' `indent-region` indents it like this. I don't know how it should look. I've attached a patch for now.

On Tue, 19 Feb 2019 22:26:35 +0100, Ricardo Wurmus <rekado@elephly.net> wrote:

> 
> Hi pkill9,
> 
> > +         (add-after 'install 'install-icon
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let* ((out (assoc-ref outputs "out")))
> > +               (install-file "imgsrc/calibre.svg"
> > +                             (string-append out
> > +                                            "/share/icons/hicolor/scalable/apps")))
> > +             #t))
> 
> You can do without “let*” here.
> 
> > +         (add-after 'install-icon 'install-desktop-file
> > +           (lambda* (#:key outputs #:allow-other-keys)
> > +             (let ((out (assoc-ref outputs "out")))
> > +               (mkdir-p (string-append out "/share/applications"))
> > +               (with-output-to-file
> > +                   (string-append out "/share/applications/calibre.desktop")
> > +                 (lambda _
> > +                   (format #t
> > +                           "[Desktop Entry]~@
> > +                Name=Calibre~@
> > +                Comment=E-book organiser and reader~@
> > +                Exec=~a/bin/calibre~@
> > +                TryExec=~@*~a/bin/calibre~@
> > +                Icon=calibre~@
> > +                Categories=Office~@
> > +                Type=Application~%"
> > +                           out)))
> > +               #t)))
> 
> Does upstream not provide a desktop file?  I’d rather see this submitted
> to upstream.  Have you contacted the developers about this?
> 
> Secondly, the indentation is odd.  I’d write it like this:
> 
>      (format #t "\
> [Desktop Entry]~@
> Name=…
> Comment=…
> …
> Type=Application~%" out)
> 
> 
> --
> Ricardo



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-calibre-Add-desktop-file-and-icon.patch --]
[-- Type: text/x-patch; name="0001-gnu-calibre-Add-desktop-file-and-icon.patch", Size: 2102 bytes --]

From 14b7aacec811dd8fbbc7d87846dc4722b13522c9 Mon Sep 17 00:00:00 2001
From: Pkill -9 <pkill9@runbox.com>
Date: Wed, 20 Feb 2019 05:01:13 +0000
Subject: [PATCH] gnu: calibre: Add desktop file and icon.

* gnu/packages/ebook.scm (calibre): Add desktop file and icon.
---
 gnu/packages/ebook.scm | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/ebook.scm b/gnu/packages/ebook.scm
index 99e49bc17..a34664863 100644
--- a/gnu/packages/ebook.scm
+++ b/gnu/packages/ebook.scm
@@ -185,7 +185,30 @@
               (setenv "PODOFO_INC_DIR" (string-append podofo "/include/podofo"))
               (setenv "PODOFO_LIB_DIR" (string-append podofo "/lib"))
               #t)))
-         (add-after 'install 'install-font-liberation
+         (add-after 'install 'install-icon
+           (lambda* (#:key outputs #:allow-other-keys)
+             (install-file "imgsrc/calibre.svg"
+                             (string-append (assoc-ref outputs "out")
+                                            "/share/icons/hicolor/scalable/apps"))
+             #t))
+         (add-after 'install-icon 'install-desktop-file
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p (string-append out "/share/applications"))
+               (with-output-to-file
+                   (string-append out "/share/applications/calibre.desktop")
+                 (lambda _
+                   (format #t
+                           "[Desktop Entry]~@
+                Name=Calibre~@
+                Comment=E-book organiser and reader~@
+                Exec=~a/bin/calibre~@
+                TryExec=~@*~a/bin/calibre~@
+                Icon=calibre~@
+                Categories=Office~@
+                Type=Application~%" out))))
+             #t))
+         (add-after 'install-desktop-file 'install-font-liberation
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (for-each (lambda (file)
                          (install-file file (string-append
-- 
2.20.1


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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-20  5:06   ` pkill9
@ 2019-02-20 14:08     ` Tobias Geerinckx-Rice
  2019-02-20 14:25     ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice @ 2019-02-20 14:08 UTC (permalink / raw)
  To: pkill9; +Cc: 34576

Pkill -9,

pkill9 wrote:
> I've attached a patch with the 'let' removed from the icon 
> install phase, but I haven't changed the indentation of the 
> desktop file because when I did that it added a blank line at 
> the beginning of the desktop file and created a large 
> indentation before '[Desktop Entry]'.

Zut alors!  You had a typo.

Use Ricardo's snippet from the quoted message and make sure that 
there's no trailing whitespace, particularly after "\ (as was 
probably the case above).  Emacs won't touch the indentation 
inside the format string.

Thanks!

T G-R

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

* [bug#34576] Calibre: Add icon and desktop file to Calibre
  2019-02-20  5:06   ` pkill9
  2019-02-20 14:08     ` Tobias Geerinckx-Rice
@ 2019-02-20 14:25     ` Tobias Geerinckx-Rice
  1 sibling, 0 replies; 8+ messages in thread
From: Tobias Geerinckx-Rice @ 2019-02-20 14:25 UTC (permalink / raw)
  To: pkill9; +Cc: 34576

[I sent my previous message to this bug from the wrong address. 
Oops!  And sorry.]

Pkill -9,

pkill9 wrote:
> -         (add-after 'install 'install-font-liberation
> +         (add-after 'install 'install-icon
> +         (add-after 'install-icon 'install-desktop-file
> +         (add-after 'install-desktop-file 
> 'install-font-liberation

This is utterly correct and right and good, but…

In practice, one tends to just (ADD-AFTER 'INSTALL …) everywhere 
instead of building up such nice (but brittle) orderings — unless 
the phases actually depend on each other.  It makes removing them 
later slightly quicker.

(If you're thinking ‘Wait, doesn't that run them in the reverse 
order?’ you're 1. paying attention and b. right.  It hardly ever 
matters.)

Kind regards,

T G-R

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

* bug#34576: Calibre: Add icon and desktop file to Calibre
  2019-02-19 18:26 [bug#34576] Calibre: Add icon and desktop file to Calibre pkill9
  2019-02-19 21:26 ` Ricardo Wurmus
@ 2020-10-01  3:18 ` Michael Rohleder
  1 sibling, 0 replies; 8+ messages in thread
From: Michael Rohleder @ 2020-10-01  3:18 UTC (permalink / raw)
  To: pkill9; +Cc: 34576-done

[-- Attachment #1: Type: text/plain, Size: 270 bytes --]

<pkill9@runbox.com> writes:
> This patch adds two phases to the package definition for Calibre that install an icon and install a desktop file.

I believe, this is done with 6e1ab5fadbc8fbe5d8d71864c68dd52ddbc732c9

-- 
Linux - Better for your uptime than Viagra

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

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

end of thread, other threads:[~2020-10-01  3:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-19 18:26 [bug#34576] Calibre: Add icon and desktop file to Calibre pkill9
2019-02-19 21:26 ` Ricardo Wurmus
2019-02-20  4:30   ` pkill9
2019-02-20  5:00     ` Brett Gilio
2019-02-20  5:06   ` pkill9
2019-02-20 14:08     ` Tobias Geerinckx-Rice
2019-02-20 14:25     ` Tobias Geerinckx-Rice
2020-10-01  3:18 ` bug#34576: " Michael Rohleder

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).