guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH -v2 2/2] guix: profiles: create fonts.dir/scale for all fonts


From: Huang\, Ying
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
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Hi, Ludo,

Thanks for comments!

address@hidden (Ludovic Courtès) writes:

> Huang Ying <address@hidden> 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’.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]