[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-file
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files |
Date: |
Sat, 24 Sep 2016 14:15:13 +0900 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) |
Hello!
John Darrington <address@hidden> 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’.
- Re: [PATCH] Adding .xsession to guile-wm, (continued)
- Re: [PATCH] Adding .xsession to guile-wm, John Darrington, 2016/09/12
- Re: [PATCH] Adding .xsession to guile-wm, Efraim Flashner, 2016/09/12
- Re: [PATCH] Adding .xsession to guile-wm, John Darrington, 2016/09/12
- Re: [PATCH] Adding .xsession to guile-wm, Alex ter Weele, 2016/09/12
- Re: [PATCH] Adding .xsession to guile-wm, Thompson, David, 2016/09/12
- Re: [PATCH] Adding .xsession to guile-wm, John Darrington, 2016/09/13
- Re: [PATCH] Adding .xsession to guile-wm, Ludovic Courtès, 2016/09/13
- [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files, John Darrington, 2016/09/20
- Re: [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files,
Ludovic Courtès <=
- [PATCH] guix: gnu-build-system: add new phase patch-dot-desktop-files, John Darrington, 2016/09/25
Re: [PATCH] Adding .xsession to guile-wm, Ludovic Courtès, 2016/09/13
Re: [PATCH] Adding .xsession to guile-wm, Ludovic Courtès, 2016/09/13