GNU bug report logs -
#36000
[PATCH 1/4] guix: Add helper for generating desktop entry files.
Previous Next
Reported by: Pierre Neidhardt <mail <at> ambrevar.xyz>
Date: Thu, 30 May 2019 07:46:02 UTC
Severity: normal
Tags: patch
Done: Pierre Neidhardt <mail <at> ambrevar.xyz>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36000 in the body.
You can then email your comments to 36000 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Thu, 30 May 2019 07:46:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Pierre Neidhardt <mail <at> ambrevar.xyz>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Thu, 30 May 2019 07:46:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* guix/build/utils.scm (make-desktop-entry-file): New procedure.
---
guix/build/utils.scm | 99 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 99 insertions(+)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 5fe3286843..21bdc42719 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -1100,6 +1100,105 @@ with definitions for VARS."
(chmod prog-tmp #o755)
(rename-file prog-tmp prog))))
+(define* (make-desktop-entry-file destination #:key
+ (type "Application") ; One of "Application", "Link" or "Directory".
+ (version "1.1")
+ name
+ (generic-name name)
+ (no-display #f)
+ comment
+ icon
+ (hidden #f)
+ only-show-in
+ not-show-in
+ (d-bus-activatable #f)
+ try-exec
+ exec
+ path
+ (terminal #f)
+ actions
+ mime-type
+ (categories "Application")
+ implements
+ keywords
+ (startup-notify #t)
+ startup-w-m-class
+ #:rest all-args)
+ "Create a desktop entry file at DESTINATION.
+You must specify NAME.
+
+Values can be booleans, numbers, strings or list of strings.
+
+Additionally, locales can be specified with an alist where the key is the
+locale. The #f key specifies the default. Example:
+
+ #:name '((#f \"I love Guix\") (\"fr\" \"J'aime Guix\"))
+
+produces
+
+ Name=I love Guix
+ Name[fr]=J'aime Guix
+
+For a complete description of the format, see the specifications at
+https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html."
+ (define (escape-semicolon s)
+ (string-join (string-split s #\;) "\\;"))
+ (define* (parse key value #:optional locale)
+ (set! value (match value
+ (#t "true")
+ (#f "false")
+ ((? number? n) n)
+ ((? string? s) (escape-semicolon s))
+ ((? list? value)
+ (catch 'wrong-type-arg
+ (lambda () (string-join (map escape-semicolon value) ";"))
+ (lambda args (error "List arguments can only contain strings: ~a" args))))
+ (_ (error "Value must be a boolean, number, string or list of strings"))))
+ (format #t "~a=~a~%"
+ (if locale
+ (format #f "~a[~a]" key locale)
+ key)
+ value))
+
+ (define key-error-message "This procedure only takes key arguments beside DESTINATION")
+
+ (unless name
+ (error "Missing NAME key argument"))
+ (unless (member #:type all-args)
+ (set! all-args (append (list #:type type) all-args)))
+ (mkdir-p (dirname destination))
+
+ (with-output-to-file destination
+ (lambda ()
+ (format #t "[Desktop Entry]~%")
+ (let loop ((args all-args))
+ (match args
+ (() #t)
+ ((_) (error key-error-message))
+ ((key value . ...)
+ (unless (keyword? key)
+ (error key-error-message))
+ (set! key
+ (string-join (map string-titlecase
+ (string-split (symbol->string
+ (keyword->symbol key))
+ #\-))
+ ""))
+ (match value
+ (((_ . _) . _)
+ (for-each (lambda (locale-subvalue)
+ (parse key
+ (if (and (list? (cdr locale-subvalue))
+ (= 1 (length (cdr locale-subvalue))))
+ ;; Support both proper and improper lists for convenience.
+ (cadr locale-subvalue)
+ (cdr locale-subvalue))
+ (car locale-subvalue)))
+ value))
+ (_
+ (parse key value)))
+ (loop (cddr args))))))))
+
;;;
;;; Locales.
--
2.21.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Thu, 30 May 2019 08:18:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 36000 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/games.scm (drascula)[arguments]: Do it.
---
gnu/packages/games.scm | 28 ++++++++++++----------------
1 file changed, 12 insertions(+), 16 deletions(-)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index af875435d6..94a44f0fc1 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -7276,22 +7276,18 @@ on items and player adaptability for character progression.")
;; game, so we borrow SCUMMVM's.
(let ((apps (string-append out "/share/applications")))
(mkdir-p apps)
- (with-output-to-file (string-append apps "/drascula.desktop")
- (lambda _
- (format #t
- "[Desktop Entry]~@
- Name=Drascula: The Vampire Strikes Back~@
- GenericName=Drascula~@
- Exec=~a/bin/drascula~@
- Icon=~a/share/icons/hicolor/scalable/apps/scummvm.svg~@
- Categories=AdventureGame;Game;RolePlaying;~@
- Keywords=game;adventure;roleplaying;2D,fantasy;~@
- Comment=Classic 2D point and click adventure game~@
- Comment[de]=klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier~@
- Comment[fr]=Jeux classique d'aventure pointer-et-cliquer en 2D~@
- Comment[it]=Gioco classico di avventura punta e clicca 2D~@
- Type=Application~%"
- out scummvm))))
+ (make-desktop-entry-file
+ (string-append apps "/drascula.desktop")
+ #:name "Drascula: The Vampire Strikes Back"
+ #:generic-name "Drascula"
+ #:exec (string-append out "/bin/drascula")
+ #:icon (string-append scummvm "/share/icons/hicolor/scalable/apps/scummvm.svg")
+ #:categories '("AdventureGame" "Game" "RolePlaying")
+ #:keywords '("game" "adventure" "roleplaying" "2D" "fantasy")
+ #:comment '((#f "Classic 2D point and click adventure game")
+ ("de" "Klassisches 2D-Abenteuerspiel in Zeigen-und-Klicken-Manier")
+ ("fr" "Jeu classique d'aventure pointer-et-cliquer en 2D")
+ ("it" "Gioco classico di avventura punta e clicca 2D"))))
#t))))
(native-inputs
`(("bash" ,bash)
--
2.21.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Thu, 30 May 2019 08:18:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 36000 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/games.scm (tome4)[arguments]: Do it.
---
gnu/packages/games.scm | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 4fdc9b01e6..af875435d6 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -5035,19 +5035,13 @@ Crowther & Woods, its original authors, in 1995. It has been known as
(copy-recursively "game" (string-append data "/game"))
;; launcher
(mkdir-p applications)
- (with-output-to-file (string-append applications "/"
- ,name ".desktop")
- (lambda ()
- (display
- (string-append
- "[Desktop Entry]
-Name=ToME4
-Comment=" ,synopsis "\n"
-"Exec=" ,name "\n"
-"Icon=" icon "\n"
-"Terminal=false
-Type=Application
-Categories=Game;RolePlaying;\n")))))
+ (make-desktop-entry-file
+ (string-append applications "/" ,name ".desktop")
+ #:name "ToME4"
+ #:comment ,synopsis
+ #:exec ,name
+ #:icon icon
+ #:categories '("Game" "RolePlaying")))
#t)))))
(home-page "https://te4.org")
(description "Tales of Maj’Eyal (ToME) RPG, featuring tactical turn-based
--
2.21.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Thu, 30 May 2019 08:18:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 36000 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/emacs-xyz.scm (emacs-exwm)[arguments]: Do it.
---
gnu/packages/emacs-xyz.scm | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 9199b45e40..fed92528c3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -7498,15 +7498,12 @@ It should enable you to implement low-level X11 applications.")
;; Add a .desktop file to xsessions
(mkdir-p xsessions)
(mkdir-p bin)
- (with-output-to-file
- (string-append xsessions "/exwm.desktop")
- (lambda _
- (format #t "[Desktop Entry]~@
- Name=~a~@
- Comment=~a~@
- Exec=~a~@
- TryExec=~:*~a~@
- Type=Application~%" ,name ,synopsis exwm-executable)))
+ (make-desktop-entry-file
+ (string-append xsessions "/exwm.desktop")
+ #:name ,name
+ #:comment ,synopsis
+ #:exec exwm-executable
+ #:try-exec exwm-executable)
;; Add a shell wrapper to bin
(with-output-to-file exwm-executable
(lambda _
--
2.21.0
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Sat, 12 Oct 2019 08:44:04 GMT)
Full text and
rfc822 format available.
Message #17 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Can we merge this in core updates?
Any blocker?
Thanks!
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Sat, 12 Oct 2019 18:45:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, Oct 12, 2019 at 10:43:56AM +0200, Pierre Neidhardt wrote:
> Can we merge this in core updates?
> Any blocker?
>
The wrapping is wrong at the very top, it should be under the 'e' in
define. It looks good. I didn't look too much at the logic (my weak
point) but this should be a very welcome addition.
Why core-updates specifically?
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Sat, 12 Oct 2019 19:06:02 GMT)
Full text and
rfc822 format available.
Message #23 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Cc-ing Nicolas since he was part of the discussion:
https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00404.html
Efraim Flashner <efraim <at> flashner.co.il> writes:
> The wrapping is wrong at the very top, it should be under the 'e' in
> define.
You mean the indentation? I'm not sure what's wrong, could you write a snippet?
> Why core-updates specifically?
Because this rebuilds the world :(
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Sat, 12 Oct 2019 19:13:02 GMT)
Full text and
rfc822 format available.
Message #26 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
On Sat, Oct 12, 2019 at 09:05:38PM +0200, Pierre Neidhardt wrote:
> Cc-ing Nicolas since he was part of the discussion:
> https://lists.gnu.org/archive/html/guix-devel/2019-05/msg00404.html
>
> Efraim Flashner <efraim <at> flashner.co.il> writes:
>
> > The wrapping is wrong at the very top, it should be under the 'e' in
> > define.
>
> You mean the indentation? I'm not sure what's wrong, could you write a snippet?
>
Yeah, I did mean indentation. I meant that it should be
(define* (...
next-line-here
but then I checked guix/build/utils and saw that all the other ones are
indented the way you have it so keep it :).
> > Why core-updates specifically?
>
> Because this rebuilds the world :(
>
Ah, that's unfortunate
--
Efraim Flashner <efraim <at> flashner.co.il> אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 08:45:01 GMT)
Full text and
rfc822 format available.
Message #29 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
So shall I merge it on staging then?
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 14:41:02 GMT)
Full text and
rfc822 format available.
Message #32 received at 36000 <at> debbugs.gnu.org (full text, mbox):
Hi,
Pierre Neidhardt <mail <at> ambrevar.xyz> skribis:
> So shall I merge it on staging then?
I think ‘staging’ is in fact pretty much ready, no? Marius?
https://ci.guix.gnu.org/jobset/staging-staging
Ludo’.
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 15:11:02 GMT)
Full text and
rfc822 format available.
Message #35 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:
> Hi,
>
> Pierre Neidhardt <mail <at> ambrevar.xyz> skribis:
>
>> So shall I merge it on staging then?
>
> I think ‘staging’ is in fact pretty much ready, no? Marius?
>
> https://ci.guix.gnu.org/jobset/staging-staging
Indeed, it will be merged within a day or two and is currently only
taking bugfixes.
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 15:14:02 GMT)
Full text and
rfc822 format available.
Message #38 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Pierre Neidhardt <mail <at> ambrevar.xyz> writes:
> So shall I merge it on staging then?
This is world-rebuilding change, no? In that case it has to go through
'core-updates' as per the branch rebuild policy:
https://guix.gnu.org/manual/en/guix.html#Submitting-Patches
(it would be good to shorten that section a bit...)
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 15:23:02 GMT)
Full text and
rfc822 format available.
Message #41 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Sorry, my email this morning meant "core-updates", as per the other
comments in this thread!
So should I merge on core-updates then?
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Fri, 18 Oct 2019 15:25:02 GMT)
Full text and
rfc822 format available.
Message #44 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Pierre Neidhardt <mail <at> ambrevar.xyz> writes:
> Sorry, my email this morning meant "core-updates", as per the other
> comments in this thread!
>
> So should I merge on core-updates then?
If you think it is ready, go for it! :-)
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#36000
; Package
guix-patches
.
(Sat, 19 Oct 2019 10:47:02 GMT)
Full text and
rfc822 format available.
Message #47 received at 36000 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Done, thanks!
--
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]
bug closed, send any further explanations to
36000 <at> debbugs.gnu.org and Pierre Neidhardt <mail <at> ambrevar.xyz>
Request was from
Pierre Neidhardt <mail <at> ambrevar.xyz>
to
control <at> debbugs.gnu.org
.
(Sat, 19 Oct 2019 10:48:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 16 Nov 2019 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.