From: "Huang\, Ying" <huang_ying_caritas@163.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH -v2 2/2] guix: profiles: create fonts.dir/scale for all fonts directories
Date: Thu, 09 Mar 2017 19:41:57 +0800 [thread overview]
Message-ID: <87innin0ca.fsf@163.com> (raw)
In-Reply-To: <878toflm0i.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Wed, 08 Mar 2017 18:24:29 +0100")
Hi, Ludo,
Thanks for comments!
ludo@gnu.org (Ludovic Courtès) writes:
> Huang Ying <huang.ying.caritas@gmail.com> skribis:
>
>> * guix/profiles.scm (fonts-dir-file): Create fonts.dir/scale files for all
>> fonts directories.
>
> Looks cool, modulo Danny’s suggestions and minor issues below.
>
> BTW, could you explain (probably as a comment in the code) why we need
> to do all this? What is it fixing? :-)
Sure.
>> + (union-build fonts-dir fonts-dirs
>> + #:log-port (%make-void-port "w")
>> + #:create-all-directories? #t)
>> + (ftw fonts-dir
>> + (lambda (dir statinfo flag)
>
> ‘ftw’ is not great IMO and not used in Guix.
>
> I would suggest using ‘find-files’ from (guix build utils). You could
> write something like:
>
> (let ((directories (find-files fonts-dir
> (lambda (file stat)
> (eq? 'directory (stat:type stat)))
> #:directories? #t)))
> (for-each do-something directories))
>
> This also has the advantage of separating the generation of the
> directory list from the actual action.
Sure.
>> + (and (eq? flag 'directory)
>> + (with-directory-excursion dir
>> + (and (file-exists? fonts-scale-file)
>> + (delete-file fonts-scale-file))
>
> Here, since ‘delete-file’ has a side-effect and a meaningless return
> value, we conventionally avoid ‘and’ and instead write:
>
> (when (file-exists? fonts-scale-file)
> (delete-file fonts-scale-file))
>
> for clarity.
Sure
>> + (and (file-exists? fonts-dir-file)
>> + (delete-file fonts-dir-file))
>> + (system* mkfontscale)
>> + (system* mkfontdir)
>> + (and (empty-file? fonts-scale-file)
>> + (delete-file fonts-scale-file))
>> + (and (empty-file? fonts-dir-file)
>> + (delete-file fonts-dir-file))))
>
> Same as above.
Sure.
Best Regards,
Huang, Ying
> Thank you!
>
> Ludo’.
next prev parent reply other threads:[~2017-03-09 11:42 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-07 11:07 [PATCH -v2 1/2] build: union: Add create-all-directories? parameter to union-build Huang Ying
2017-03-07 11:07 ` [PATCH -v2 2/2] guix: profiles: create fonts.dir/scale for all fonts directories Huang Ying
2017-03-07 20:24 ` Danny Milosavljevic
2017-03-08 7:44 ` huang ying
2017-03-08 17:18 ` Ludovic Courtès
2017-03-09 11:42 ` Huang, Ying
2017-03-08 17:24 ` Ludovic Courtès
2017-03-09 11:41 ` Huang, Ying [this message]
2017-03-07 20:35 ` [PATCH -v2 1/2] build: union: Add create-all-directories? parameter to union-build Danny Milosavljevic
2017-03-07 20:54 ` Danny Milosavljevic
2017-03-08 7:43 ` huang ying
2017-03-08 17:16 ` Ludovic Courtès
2017-03-09 11:43 ` Huang, Ying
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87innin0ca.fsf@163.com \
--to=huang_ying_caritas@163.com \
--cc=guix-devel@gnu.org \
--cc=ludo@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).