unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Adding .xsession to guile-wm
@ 2016-09-12  3:01 Alex ter Weele
  2016-09-12 15:40 ` Thompson, David
                   ` (2 more replies)
  0 siblings, 3 replies; 19+ messages in thread
From: Alex ter Weele @ 2016-09-12  3:01 UTC (permalink / raw)
  To: guix-devel

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

Adding an xsession to guile-wm so that display managers will identify it
as an available wm.

[-- Attachment #2: 0001-Adding-.xsession-to-guile-wm.patch --]
[-- Type: text/x-patch, Size: 2883 bytes --]

From 91f74b1b762596527dfa9412c33e39981932fa70 Mon Sep 17 00:00:00 2001
From: Alex ter Weele <alex.ter.weele@gmail.com>
Date: Sun, 11 Sep 2016 22:18:53 -0400
Subject: [PATCH] Adding .xsession to guile-wm

---
 gnu/packages/guile-wm.scm | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/guile-wm.scm b/gnu/packages/guile-wm.scm
index 98e657f..606a792 100644
--- a/gnu/packages/guile-wm.scm
+++ b/gnu/packages/guile-wm.scm
@@ -64,6 +64,7 @@ dependencies.")
   (package
     (name "guile-wm")
     (version "1.0")
+    (synopsis "Guile window manager")
     (source (origin
               (method url-fetch)
               (uri (string-append "http://www.markwitmer.com/dist/guile-wm-"
@@ -72,7 +73,7 @@ dependencies.")
                (base32
                 "1l9qcz236jxvryndimjy62cf8zxf8i3f8vg3zpqqjhw15j9mdk3r"))))
     (build-system gnu-build-system)
-    (arguments '(;; The '.scm' files go to $(datadir), so set that to the
+    (arguments `(;; The '.scm' files go to $(datadir), so set that to the
                  ;; standard value.
                  #:configure-flags (list (string-append "--datadir="
                                           (assoc-ref %outputs "out")
@@ -103,7 +104,27 @@ dependencies.")
                                  `("GUILE_LOAD_PATH" ":" prefix (,mods ,xcb))
                                  `("GUILE_LOAD_COMPILED_PATH" ":" prefix
                                    (,mods ,xcb)))))
-                            %standard-phases))))
+                            (alist-cons-after
+                             'install 'install-xsession
+                             (lambda* (#:key outputs #:allow-other-keys)
+                               ;; add a .desktop file to xsessions
+                               (let ((xsessions (string-append
+                                                 %output "/share/xsessions")))
+                                 (mkdir-p xsessions)
+                                 (call-with-output-file
+                                     (string-append
+                                      xsessions "/guile-wm.desktop")
+                                   (lambda (port)
+                                     (format
+                                      port
+                                      "~
+                                       [Desktop Entry]~@
+                                       Name=~a~@
+                                       Comment=~a~@
+                                       Exec=~a/bin/guile-wm~@
+                                       Type=Application~%"
+                                      ,name ,synopsis %output)))))
+                             %standard-phases)))))
     (native-inputs `(("pkg-config" ,pkg-config)))
     (inputs `(("guile" ,guile-2.0)
               ("guile-xcb" ,guile-xcb)))
-- 
2.10.0


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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12  3:01 [PATCH] Adding .xsession to guile-wm Alex ter Weele
@ 2016-09-12 15:40 ` Thompson, David
  2016-09-12 15:56   ` Alex ter Weele
  2016-09-12 16:05 ` John Darrington
  2016-09-13 12:04 ` Ludovic Courtès
  2 siblings, 1 reply; 19+ messages in thread
From: Thompson, David @ 2016-09-12 15:40 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

On Sun, Sep 11, 2016 at 11:01 PM, Alex ter Weele
<alex.ter.weele@gmail.com> wrote:
> Adding an xsession to guile-wm so that display managers will identify it
> as an available wm.

I think it would be best if this were submitted as a patch to guile-wm
upstream instead, and we can include the patch in the "patches" field
until a new release is made.

- Dave

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 15:40 ` Thompson, David
@ 2016-09-12 15:56   ` Alex ter Weele
  2016-09-12 15:59     ` Thompson, David
  0 siblings, 1 reply; 19+ messages in thread
From: Alex ter Weele @ 2016-09-12 15:56 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel

Manually making a .desktop is what xmonad and fluxbox do:
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/wm.scm#n244
http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/wm.scm#n359
Hence this approach. I could also work on moving this to a patch.
Which is preferred?

-Alex

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 15:56   ` Alex ter Weele
@ 2016-09-12 15:59     ` Thompson, David
  0 siblings, 0 replies; 19+ messages in thread
From: Thompson, David @ 2016-09-12 15:59 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

On Mon, Sep 12, 2016 at 11:56 AM, Alex ter Weele
<alex.ter.weele@gmail.com> wrote:
> Manually making a .desktop is what xmonad and fluxbox do:
> http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/wm.scm#n244
> http://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/wm.scm#n359
> Hence this approach. I could also work on moving this to a patch.
> Which is preferred?
>
> -Alex

Well... if we already have prior art then I suppose it's OK!  I'll let
someone else weigh in here and apply the patch.

Thanks for your contribution!

- Dave

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12  3:01 [PATCH] Adding .xsession to guile-wm Alex ter Weele
  2016-09-12 15:40 ` Thompson, David
@ 2016-09-12 16:05 ` John Darrington
  2016-09-12 18:07   ` Efraim Flashner
  2016-09-13 11:51   ` [PATCH] Adding .xsession to guile-wm Ludovic Courtès
  2016-09-13 12:04 ` Ludovic Courtès
  2 siblings, 2 replies; 19+ messages in thread
From: John Darrington @ 2016-09-12 16:05 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

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

Most of the .desktop files in my store do not have the /gnu/store/... on their
Exec= line.  Perhaps they should?  What is the policy here?

J'

On Sun, Sep 11, 2016 at 11:01:56PM -0400, Alex ter Weele wrote:
     Adding an xsession to guile-wm so that display managers will identify it
     as an available wm.

     From 91f74b1b762596527dfa9412c33e39981932fa70 Mon Sep 17 00:00:00 2001
     From: Alex ter Weele <alex.ter.weele@gmail.com>
     Date: Sun, 11 Sep 2016 22:18:53 -0400
     Subject: [PATCH] Adding .xsession to guile-wm
     
     ---
      gnu/packages/guile-wm.scm | 25 +++++++++++++++++++++++--
      1 file changed, 23 insertions(+), 2 deletions(-)
     
     diff --git a/gnu/packages/guile-wm.scm b/gnu/packages/guile-wm.scm
     index 98e657f..606a792 100644
     --- a/gnu/packages/guile-wm.scm
     +++ b/gnu/packages/guile-wm.scm
     @@ -64,6 +64,7 @@ dependencies.")
        (package
          (name "guile-wm")
          (version "1.0")
     +    (synopsis "Guile window manager")
          (source (origin
                    (method url-fetch)
                    (uri (string-append "http://www.markwitmer.com/dist/guile-wm-"
     @@ -72,7 +73,7 @@ dependencies.")
                     (base32
                      "1l9qcz236jxvryndimjy62cf8zxf8i3f8vg3zpqqjhw15j9mdk3r"))))
          (build-system gnu-build-system)
     -    (arguments '(;; The '.scm' files go to $(datadir), so set that to the
     +    (arguments `(;; The '.scm' files go to $(datadir), so set that to the
                       ;; standard value.
                       #:configure-flags (list (string-append "--datadir="
                                                (assoc-ref %outputs "out")
     @@ -103,7 +104,27 @@ dependencies.")
                                       `("GUILE_LOAD_PATH" ":" prefix (,mods ,xcb))
                                       `("GUILE_LOAD_COMPILED_PATH" ":" prefix
                                         (,mods ,xcb)))))
     -                            %standard-phases))))
     +                            (alist-cons-after
     +                             'install 'install-xsession
     +                             (lambda* (#:key outputs #:allow-other-keys)
     +                               ;; add a .desktop file to xsessions
     +                               (let ((xsessions (string-append
     +                                                 %output "/share/xsessions")))
     +                                 (mkdir-p xsessions)
     +                                 (call-with-output-file
     +                                     (string-append
     +                                      xsessions "/guile-wm.desktop")
     +                                   (lambda (port)
     +                                     (format
     +                                      port
     +                                      "~
     +                                       [Desktop Entry]~@
     +                                       Name=~a~@
     +                                       Comment=~a~@
     +                                       Exec=~a/bin/guile-wm~@
     +                                       Type=Application~%"
     +                                      ,name ,synopsis %output)))))
     +                             %standard-phases)))))
          (native-inputs `(("pkg-config" ,pkg-config)))
          (inputs `(("guile" ,guile-2.0)
                    ("guile-xcb" ,guile-xcb)))
     -- 
     2.10.0
     


-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 16:05 ` John Darrington
@ 2016-09-12 18:07   ` Efraim Flashner
  2016-09-12 18:13     ` John Darrington
  2016-09-13 11:51   ` [PATCH] Adding .xsession to guile-wm Ludovic Courtès
  1 sibling, 1 reply; 19+ messages in thread
From: Efraim Flashner @ 2016-09-12 18:07 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, Alex ter Weele

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

On Mon, Sep 12, 2016 at 06:05:27PM +0200, John Darrington wrote:
> Most of the .desktop files in my store do not have the /gnu/store/... on their
> Exec= line.  Perhaps they should?  What is the policy here?
> 
> J'
> 

I can comment that enlightenment does, and slim finds it:
Icon=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/share/enlightenment/data/images/enlightenment.png
TryExec=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/bin/enlightenment_start
Exec=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/bin/enlightenment_start

as does openbox:
Exec=/gnu/store/xyx046dfs7lzps4q7ljj9mvkdv935wcl-openbox-3.6.1/bin/openbox-session
TryExec=/gnu/store/xyx046dfs7lzps4q7ljj9mvkdv935wcl-openbox-3.6.1/bin/openbox-session


-- 
Efraim Flashner   <efraim@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

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

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 18:07   ` Efraim Flashner
@ 2016-09-12 18:13     ` John Darrington
  2016-09-13  1:23       ` Alex ter Weele
  0 siblings, 1 reply; 19+ messages in thread
From: John Darrington @ 2016-09-12 18:13 UTC (permalink / raw)
  To: Efraim Flashner; +Cc: guix-devel, Alex ter Weele

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

On Mon, Sep 12, 2016 at 09:07:10PM +0300, Efraim Flashner wrote:
     On Mon, Sep 12, 2016 at 06:05:27PM +0200, John Darrington wrote:
     > Most of the .desktop files in my store do not have the /gnu/store/... on their
     > Exec= line.  Perhaps they should?  What is the policy here?
     > 
     > J'
     > 
     
     I can comment that enlightenment does, and slim finds it:
     Icon=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/share/enlightenment/data/images/enlightenment.png
     TryExec=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/bin/enlightenment_start
     Exec=/gnu/store/z9zb4dhqdb6dgl44x5b3czj0bdwg48p6-enlightenment-0.21.2/bin/enlightenment_start
     
     as does openbox:
     Exec=/gnu/store/xyx046dfs7lzps4q7ljj9mvkdv935wcl-openbox-3.6.1/bin/openbox-session
     TryExec=/gnu/store/xyx046dfs7lzps4q7ljj9mvkdv935wcl-openbox-3.6.1/bin/openbox-session
     
     
Many others don't.  And slim also finds them.

J'


-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 18:13     ` John Darrington
@ 2016-09-13  1:23       ` Alex ter Weele
  2016-09-13  1:45         ` Thompson, David
  0 siblings, 1 reply; 19+ messages in thread
From: Alex ter Weele @ 2016-09-13  1:23 UTC (permalink / raw)
  To: John Darrington, Efraim Flashner; +Cc: guix-devel

I don't believe there is a standard, but different packages do it
different ways. Under my patch, guile-wm will regenerate its .desktop as
part of the build process, so its Exec= should be kept up-to-date.

-Alex

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-13  1:23       ` Alex ter Weele
@ 2016-09-13  1:45         ` Thompson, David
  2016-09-13  4:27           ` John Darrington
  0 siblings, 1 reply; 19+ messages in thread
From: Thompson, David @ 2016-09-13  1:45 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

On Mon, Sep 12, 2016 at 9:23 PM, Alex ter Weele
<alex.ter.weele@gmail.com> wrote:
> I don't believe there is a standard, but different packages do it
> different ways. Under my patch, guile-wm will regenerate its .desktop as
> part of the build process, so its Exec= should be kept up-to-date.

We should always refer to the absolute path to binaries so that we
don't rely on $PATH, which would be nondeterministic.

- Dave

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-13  1:45         ` Thompson, David
@ 2016-09-13  4:27           ` John Darrington
  2016-09-13 11:52             ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: John Darrington @ 2016-09-13  4:27 UTC (permalink / raw)
  To: Thompson, David; +Cc: guix-devel, Alex ter Weele

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

On Mon, Sep 12, 2016 at 09:45:22PM -0400, Thompson, David wrote:
     On Mon, Sep 12, 2016 at 9:23 PM, Alex ter Weele
     <alex.ter.weele@gmail.com> wrote:
     > I don't believe there is a standard, but different packages do it
     > different ways. Under my patch, guile-wm will regenerate its .desktop as
     > part of the build process, so its Exec= should be kept up-to-date.
     
     We should always refer to the absolute path to binaries so that we
     don't rely on $PATH, which would be nondeterministic.
     

In that case, below is a (non-exhaustive) list of .desktop files from
various packages which do it "wrong".    Is there not some way we can
automatically flag such cases at build time?

J'

bluetooth-sendto.desktop
emacs.desktop
eog.desktop
epiphany.desktop
evince.desktop
evince-previewer.desktop
evolution-calendar.desktop
exo-file-manager.desktop
exo-mail-reader.desktop
exo-preferred-applications.desktop
exo-terminal-emulator.desktop
exo-web-browser.desktop
gimp.desktop
gnome-background-panel.desktop
gnome-bluetooth-panel.desktop
gnome-color-panel.desktop
gnome-control-center.desktop
gnome-datetime-panel.desktop
gnome.desktop
gnome-display-panel.desktop
gnome-info-panel.desktop
gnome-keyboard-panel.desktop
gnome-mouse-panel.desktop
gnome-network-panel.desktop
gnome-notifications-panel.desktop
gnome-online-accounts-panel.desktop
gnome-power-panel.desktop
gnome-printers-panel.desktop
gnome-privacy-panel.desktop
gnome-region-panel.desktop
gnome-search-panel.desktop
gnome-sharing-panel.desktop
gnome-sound-panel.desktop
gnome-universal-access-panel.desktop
gnome-user-accounts-panel.desktop
gnome-wacom-panel.desktop
gnome-wayland.desktop
gnubik.desktop
gsettings-data-convert.desktop
gtk3-demo.desktop
gtk3-icon-browser.desktop
gtk3-widget-factory.desktop
ibus-setup.desktop
inkscape.desktop
irexec.desktop
mime-dummy-handler.desktop
mutter.desktop
nautilus-autorun-software.desktop
nautilus-autostart.desktop
nautilus-classic.desktop
nm-applet.desktop
nm-connection-editor.desktop
orca-autostart.desktop
org.gnome.baobab.desktop
org.gnome.Devhelp.desktop
org.gnome.FileRoller.desktop
org.gnome.gedit.desktop
org.gnome.Nautilus.desktop
org.gnome.Shell.PortalHelper.desktop
org.gnome.Terminal.desktop
org.gnome.Totem.desktop
panel-desktop-handler.desktop
panel-preferences.desktop
pspp.desktop
ratpoison.desktop
ristretto.desktop
sniff.desktop
Thunar.desktop
Thunar-folder-handler.desktop
thunar-settings.desktop
thunar-volman-settings.desktop
wicd.desktop
wicd-tray.desktop
xfce4-about.desktop
xfce4-accessibility-settings.desktop
xfce4-appfinder.desktop
xfce4-clipman.desktop
xfce4-clipman-plugin-autostart.desktop
xfce4-mime-settings.desktop
xfce4-power-manager.desktop
xfce4-power-manager-settings.desktop
xfce4-run.desktop
xfce4-session-logout.desktop
xfce4-settings-editor.desktop
xfce4-terminal.desktop
xfce-backdrop-settings.desktop
xfce.desktop
xfce-display-settings.desktop
xfce-keyboard-settings.desktop
xfce-mouse-settings.desktop
xfce-session-settings.desktop
xfce-settings-manager.desktop
xfce-ui-settings.desktop
xfce-wm-settings.desktop
xfce-wmtweaks-settings.desktop
xfce-workspaces-settings.desktop
xfsettingsd.desktop
xscreensaver.desktop
yelp.desktop

-- 
Avoid eavesdropping.  Send strong encrypted email.
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://sks-keyservers.net or any PGP keyserver for public key.


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12 16:05 ` John Darrington
  2016-09-12 18:07   ` Efraim Flashner
@ 2016-09-13 11:51   ` Ludovic Courtès
  1 sibling, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2016-09-13 11:51 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, Alex ter Weele

John Darrington <john@darrington.wattle.id.au> skribis:

> Most of the .desktop files in my store do not have the /gnu/store/... on their
> Exec= line.  Perhaps they should?  What is the policy here?

I think it’s best to use absolute file names.

Ludo’.

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-13  4:27           ` John Darrington
@ 2016-09-13 11:52             ` Ludovic Courtès
  2016-09-20 16:33               ` [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files John Darrington
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2016-09-13 11:52 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, Alex ter Weele

John Darrington <john@darrington.wattle.id.au> skribis:

> On Mon, Sep 12, 2016 at 09:45:22PM -0400, Thompson, David wrote:
>      On Mon, Sep 12, 2016 at 9:23 PM, Alex ter Weele
>      <alex.ter.weele@gmail.com> wrote:
>      > I don't believe there is a standard, but different packages do it
>      > different ways. Under my patch, guile-wm will regenerate its .desktop as
>      > part of the build process, so its Exec= should be kept up-to-date.
>      
>      We should always refer to the absolute path to binaries so that we
>      don't rely on $PATH, which would be nondeterministic.
>      
>
> In that case, below is a (non-exhaustive) list of .desktop files from
> various packages which do it "wrong".    Is there not some way we can
> automatically flag such cases at build time?

Maybe we could have a ‘patch-desktop-files’ phase that automatically
expands relative file names in .desktop files?

Ludo’.

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-12  3:01 [PATCH] Adding .xsession to guile-wm Alex ter Weele
  2016-09-12 15:40 ` Thompson, David
  2016-09-12 16:05 ` John Darrington
@ 2016-09-13 12:04 ` Ludovic Courtès
  2016-09-14  1:40   ` Alex ter Weele
  2 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2016-09-13 12:04 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

Alex ter Weele <alex.ter.weele@gmail.com> skribis:

> From 91f74b1b762596527dfa9412c33e39981932fa70 Mon Sep 17 00:00:00 2001
> From: Alex ter Weele <alex.ter.weele@gmail.com>
> Date: Sun, 11 Sep 2016 22:18:53 -0400
> Subject: [PATCH] Adding .xsession to guile-wm
>
> ---
>  gnu/packages/guile-wm.scm | 25 +++++++++++++++++++++++--
>  1 file changed, 23 insertions(+), 2 deletions(-)

I agree with David that it would be good to talk to the upstream
developer so that the .desktop file is distributed by upstream
eventually.  Could you try to reach them?

In the meantime, it’s fine to add such a file in Guix.

I pushed the patch as 23de5cbd1487747a2d690ee3ac7630142a7eaeb8.  I added
a copyright line for you, added a ChangeLog-style commit log, and
reindented ‘arguments’ for clarity.

Thanks to your patch, I discovered this:

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> ,use(ice-9 format)
scheme@(guile-user)> (format #f "foo~@\nbar")
$2 = "foo\nbar"
scheme@(guile-user)> (format #f "foo~@\n      bar")
$3 = "foo\nbar"
--8<---------------cut here---------------end--------------->8---

:-)

Thanks!

Ludo’.

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-13 12:04 ` Ludovic Courtès
@ 2016-09-14  1:40   ` Alex ter Weele
  2016-09-14 14:45     ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: Alex ter Weele @ 2016-09-14  1:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

Ludovic Courtès <ludo@gnu.org> writes:

> I agree with David that it would be good to talk to the upstream
> developer so that the .desktop file is distributed by upstream
> eventually.  Could you try to reach them?

There are improvements I want to make to guile-wm itself, so I plan on
talking to upstream about this and other things.

> In the meantime, it’s fine to add such a file in Guix.
>
> I pushed the patch as 23de5cbd1487747a2d690ee3ac7630142a7eaeb8.  I added
> a copyright line for you, added a ChangeLog-style commit log, and
> reindented ‘arguments’ for clarity.

Thank you, I will note your changes and try to do likewise in my next
patch.

> Thanks to your patch, I discovered this:
>
> --8<---------------cut here---------------start------------->8---
> scheme@(guile-user)> ,use(ice-9 format)
> scheme@(guile-user)> (format #f "foo~@\nbar")
> $2 = "foo\nbar"
> scheme@(guile-user)> (format #f "foo~@\n      bar")
> $3 = "foo\nbar"
> --8<---------------cut here---------------end--------------->8---
>
> :-)

I discovered this from wm.scm, which is where I adapted the patch from ☺.

-Alex

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

* Re: [PATCH] Adding .xsession to guile-wm
  2016-09-14  1:40   ` Alex ter Weele
@ 2016-09-14 14:45     ` Ludovic Courtès
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2016-09-14 14:45 UTC (permalink / raw)
  To: Alex ter Weele; +Cc: guix-devel

Alex ter Weele <alex.ter.weele@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> I agree with David that it would be good to talk to the upstream
>> developer so that the .desktop file is distributed by upstream
>> eventually.  Could you try to reach them?
>
> There are improvements I want to make to guile-wm itself, so I plan on
> talking to upstream about this and other things.

Good to hear!  There were a few glitches that I didn’t take the time to
fix, but otherwise I’d have happily switched to Guile-WM.

Ludo’.

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

* [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files
  2016-09-13 11:52             ` Ludovic Courtès
@ 2016-09-20 16:33               ` John Darrington
  2016-09-24  5:15                 ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: John Darrington @ 2016-09-20 16:33 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington


Ludo wanted something like this, I think.  To be pushed to core-updates of course...




* guix/build/gnu-build-system.scm (patch-dot-desktop-files): New procedure.
---
 guix/build/gnu-build-system.scm | 45 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 34edff7..ebd0f7b 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -552,6 +552,50 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
             outputs)
   #t)
 
+
+(define* (patch-dot-desktop-files #:key outputs inputs #:allow-other-keys)
+  "Replace any references to executables in .desktop files with their absolute
+path names."
+    (define (find-binary binary output-dir inputs)
+      "Search for BINARY first in OUTPUT-DIR, then in the directories
+of INPUTS.  INPUTS is an alist where the directories are the cdrs.  If no
+suitable BINARY cannot be found return BINARY unchanged."
+
+      ;; Search for BINARY in the output directory,
+      ;; then all the input directories.
+      (let lp ((dir-list (cons output-dir (map (lambda (i) (cdr i)) inputs))))
+        (if (null? dir-list)
+            ;; Leave unchanged if we cannot find the binary.
+            binary
+            (let ((resolv (find-files
+                           (car dir-list)
+                           (lambda (file stat)
+                             ;; The candidate file must be a regular file,
+                             ;; have execute permission and the correct name.
+                             (and stat
+                                  (eq? 'regular (stat:type stat))
+                                  (not (zero? (logand #o001 (stat:perms stat))))
+                                  ((file-name-predicate
+                                    (string-append "^" binary "$")) file stat))))))
+
+              (if (null? resolv)
+                  (lp (cdr dir-list))
+                  (car resolv))))))
+
+    (for-each (match-lambda
+                (( _ . output-dir)
+                 (for-each (lambda (f)
+                             (substitute* f
+                               (("^Exec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                                (string-append
+                                 "Exec=" (find-binary binary output-dir inputs) rest))
+
+                               (("^TryExec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                                (string-append
+                                 "TryExec=" (find-binary binary output-dir inputs) rest))))
+                           (find-files output-dir ".desktop$"))))
+              outputs) #t)
+
 (define %standard-phases
   ;; Standard build phases, as a list of symbol/procedure pairs.
   (let-syntax ((phases (syntax-rules ()
@@ -564,6 +608,7 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
             validate-runpath
             validate-documentation-location
             delete-info-dir-file
+            patch-dot-desktop-files
             compress-documentation)))
 
 \f
-- 
2.10.0

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

* Re: [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files
  2016-09-20 16:33               ` [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files John Darrington
@ 2016-09-24  5:15                 ` Ludovic Courtès
  2016-09-25  5:43                   ` John Darrington
  0 siblings, 1 reply; 19+ messages in thread
From: Ludovic Courtès @ 2016-09-24  5:15 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel

Hello!

John Darrington <jmd@gnu.org> skribis:

> Ludo wanted something like this, I think.  To be pushed to core-updates of course...

This Ludo is a very demanding person…  ;-)

> * guix/build/gnu-build-system.scm (patch-dot-desktop-files): New procedure.

The approach looks good to me, so I’m just commenting on the style:

> +      ;; Search for BINARY in the output directory,
> +      ;; then all the input directories.
> +      (let lp ((dir-list (cons output-dir (map (lambda (i) (cdr i)) inputs))))
> +        (if (null? dir-list)
> +            ;; Leave unchanged if we cannot find the binary.
> +            binary
> +            (let ((resolv (find-files
> +                           (car dir-list)
> +                           (lambda (file stat)
> +                             ;; The candidate file must be a regular file,
> +                             ;; have execute permission and the correct name.
> +                             (and stat
> +                                  (eq? 'regular (stat:type stat))
> +                                  (not (zero? (logand #o001 (stat:perms stat))))
> +                                  ((file-name-predicate
> +                                    (string-append "^" binary "$")) file stat))))))
> +
> +              (if (null? resolv)
> +                  (lp (cdr dir-list))
> +                  (car resolv))))))

Please use ‘match’ instead of car, cdr, etc. (see ‘patch-shebangs’ in
the same file for an example), and use full words such as “directories”
instead of “dir-list” (info "(guix) Coding Style").

I think you can write:

  (string=? binary file)

instead of using ‘file-name-predicate’.

> +    (for-each (match-lambda
> +                (( _ . output-dir)
> +                 (for-each (lambda (f)
> +                             (substitute* f
> +                               (("^Exec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
> +                                (string-append
> +                                 "Exec=" (find-binary binary output-dir inputs) rest))
> +
> +                               (("^TryExec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
> +                                (string-append
> +                                 "TryExec=" (find-binary binary output-dir inputs) rest))))
> +                           (find-files output-dir ".desktop$"))))

The ‘find-files’ regexp should be "\\.desktop$", or a predicate:

  (lambda (file stat)
    (string-suffix? ".desktop" file))

Could you send an updated patch?

Thanks for working on it!

Ludo’.

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

* [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files
  2016-09-24  5:15                 ` Ludovic Courtès
@ 2016-09-25  5:43                   ` John Darrington
  2016-10-01 10:18                     ` Ludovic Courtès
  0 siblings, 1 reply; 19+ messages in thread
From: John Darrington @ 2016-09-25  5:43 UTC (permalink / raw)
  To: guix-devel; +Cc: John Darrington

From: John Darrington <jmd@gnu.org>


New patch as requested.




* guix/build/gnu-build-system.scm (patch-dot-desktop-files): New procedure.
---
 guix/build/gnu-build-system.scm | 46 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm
index 93ddc9a..e5d2abf 100644
--- a/guix/build/gnu-build-system.scm
+++ b/guix/build/gnu-build-system.scm
@@ -544,6 +544,51 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
             outputs)
   #t)
 
+
+(define* (patch-dot-desktop-files #:key outputs inputs #:allow-other-keys)
+  "Replace any references to executables in .desktop files with their absolute
+path names."
+    (define (find-binary binary output-dir inputs)
+      "Search for BINARY first in OUTPUT-DIR, then in the directories
+of INPUTS.  INPUTS is an alist where the directories are the cdrs.  If no
+suitable BINARY cannot be found return BINARY unchanged."
+
+      ;; Search for BINARY in the output directory,
+      ;; then all the input directories.
+      (let lp ((directories (cons output-dir
+                                  (map (lambda (input)
+                                         (match input ((_ . y) y))) inputs))))
+        (if (null? directories)
+            ;; Leave unchanged if we cannot find the binary.
+            binary
+            (let ((resolv (find-files
+                           (match directories ((x . _) x))
+                           (lambda (file stat)
+                             ;; The candidate file must be a regular file,
+                             ;; have execute permission and the correct name.
+                             (and stat
+                                  (eq? 'regular (stat:type stat))
+                                  (not (zero? (logand #o001 (stat:perms stat))))
+                                  (string=? (basename file) binary))))))
+
+              (if (null? resolv)
+                  (lp (match directories ((_ . y) y)))
+                  (match resolv ((x . _) x)))))))
+
+    (for-each (match-lambda
+                (( _ . output-dir)
+                 (for-each (lambda (f)
+                             (substitute* f
+                               (("^Exec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                                (string-append
+                                 "Exec=" (find-binary binary output-dir inputs) rest))
+
+                               (("^TryExec=([^/[:blank:]\r\n]*)(.*)$" _ binary rest)
+                                (string-append
+                                 "TryExec=" (find-binary binary output-dir inputs) rest))))
+                           (find-files output-dir "\\.desktop$"))))
+              outputs) #t)
+
 (define %standard-phases
   ;; Standard build phases, as a list of symbol/procedure pairs.
   (let-syntax ((phases (syntax-rules ()
@@ -556,6 +601,7 @@ DOCUMENTATION-COMPRESSOR-FLAGS."
             validate-runpath
             validate-documentation-location
             delete-info-dir-file
+            patch-dot-desktop-files
             compress-documentation)))
 
 \f
-- 
2.10.0

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

* Re: [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files
  2016-09-25  5:43                   ` John Darrington
@ 2016-10-01 10:18                     ` Ludovic Courtès
  0 siblings, 0 replies; 19+ messages in thread
From: Ludovic Courtès @ 2016-10-01 10:18 UTC (permalink / raw)
  To: John Darrington; +Cc: guix-devel, John Darrington

John Darrington <john@darrington.wattle.id.au> skribis:

> From: John Darrington <jmd@gnu.org>
>
>
> New patch as requested.
>
>
>
>
> * guix/build/gnu-build-system.scm (patch-dot-desktop-files): New procedure.

I pushed a modified version of this patch as
d31860b9de07810e114490db5cc160a8b078c58d, essentially making it more
concise and adding ‘format’ statements so people have some information
in their build log.

Thanks!

Ludo’.

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

end of thread, other threads:[~2016-10-01 10:18 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12  3:01 [PATCH] Adding .xsession to guile-wm Alex ter Weele
2016-09-12 15:40 ` Thompson, David
2016-09-12 15:56   ` Alex ter Weele
2016-09-12 15:59     ` Thompson, David
2016-09-12 16:05 ` John Darrington
2016-09-12 18:07   ` Efraim Flashner
2016-09-12 18:13     ` John Darrington
2016-09-13  1:23       ` Alex ter Weele
2016-09-13  1:45         ` Thompson, David
2016-09-13  4:27           ` John Darrington
2016-09-13 11:52             ` Ludovic Courtès
2016-09-20 16:33               ` [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files John Darrington
2016-09-24  5:15                 ` Ludovic Courtès
2016-09-25  5:43                   ` John Darrington
2016-10-01 10:18                     ` Ludovic Courtès
2016-09-13 11:51   ` [PATCH] Adding .xsession to guile-wm Ludovic Courtès
2016-09-13 12:04 ` Ludovic Courtès
2016-09-14  1:40   ` Alex ter Weele
2016-09-14 14:45     ` Ludovic Courtès

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).