Re: gnu/services/shepherd.scm:90:2: In procedure allocate-struct: Wrong type argument in position 2: 5

2017-09-29 Thread Huang, Ying
Efraim Flashner <efr...@flashner.co.il> writes:

> On Fri, Sep 29, 2017 at 07:21:27PM +0800, Huang, Ying wrote:
>> Hi, All,
>> 
>> I use the guix git.  After not upgrade the code for quite some time
>> (several months?), today after `git pull`, `guix environment guix`
>> report the following error.  How to deal with it?
>> 
>> Backtrace:
>> In ice-9/boot-9.scm:
>>230:29 19 (map1 _)
>>230:29 18 (map1 _)
>>230:29 17 (map1 _)
>>230:29 16 (map1 _)
>>230:29 15 (map1 _)
>>230:29 14 (map1 _)
>>230:29 13 (map1 _)
>>230:29 12 (map1 _)
>>230:29 11 (map1 _)
>>230:29 10 (map1 _)
>>230:29  9 (map1 (((gnu packages firmware)) ((gnu services)) ((gnu 
>> services shepherd)) …))
>>230:29  8 (map1 (((gnu services)) ((gnu services shepherd)) ((gnu 
>> services base)) (#) …))
>>230:17  7 (map1 (((gnu services shepherd)) ((gnu services base)) ((gnu 
>> bootloader)) # …))
>>   2792:17  6 (resolve-interface (gnu services shepherd) #:select _ #:hide _ 
>> #:prefix _ # _ …)
>>   2718:10  5 (_ (gnu services shepherd) _ _ #:ensure _)
>>   2986:16  4 (try-module-autoload _ _)
>>2316:4  3 (save-module-excursion #> ice-9/boot-9.scm:2987:17 ()>)
>>   3006:22  2 (_)
>> In unknown file:
>>1 (primitive-load-path "gnu/services/shepherd" #> 6b514a0 at ice-9/boo…>)
>> In gnu/services/shepherd.scm:
>>  90:2  0 (_)
>> 
>> gnu/services/shepherd.scm:90:2: gnu/services/shepherd.scm:90:2: In procedure 
>> allocate-struct: Wrong type argument in position 2: 5
>> 
>> Best Regards,
>> Huang, Ying
>> 
>
> you're in need of a 'make clean'.  If you don't want to have to rebuild
> everything, then 'rm -- gnu/*go gnu/s*/*go gnu/tests/*go' should take
> care of all of the affected modules.

Thanks a lot for your help!

Best Regards,
Huang, Ying




Re: gnu/services/shepherd.scm:90:2: In procedure allocate-struct: Wrong type argument in position 2: 5

2017-09-29 Thread Huang, Ying
Andy Wingo <wi...@igalia.com> writes:

> On Fri 29 Sep 2017 13:21, "Huang, Ying" <huang_ying_cari...@163.com> writes:
>
>> I use the guix git.  After not upgrade the code for quite some time
>> (several months?), today after `git pull`, `guix environment guix`
>> report the following error.  How to deal with it?
>
> Remove .go files from your git checkout.  A change in Scheme files
> caused a change in layout of objects, but some bits were baked into .go
> files, and we are missing the ability to know when .go files need to be
> rebuilt.  To work around this, remove .go files from your checkout.

It works!  Thanks a lot for your help!

Best Regards,
Huang, Ying

> Andy




gnu/services/shepherd.scm:90:2: In procedure allocate-struct: Wrong type argument in position 2: 5

2017-09-29 Thread Huang, Ying
Hi, All,

I use the guix git.  After not upgrade the code for quite some time
(several months?), today after `git pull`, `guix environment guix`
report the following error.  How to deal with it?

Backtrace:
In ice-9/boot-9.scm:
   230:29 19 (map1 _)
   230:29 18 (map1 _)
   230:29 17 (map1 _)
   230:29 16 (map1 _)
   230:29 15 (map1 _)
   230:29 14 (map1 _)
   230:29 13 (map1 _)
   230:29 12 (map1 _)
   230:29 11 (map1 _)
   230:29 10 (map1 _)
   230:29  9 (map1 (((gnu packages firmware)) ((gnu services)) ((gnu services 
shepherd)) …))
   230:29  8 (map1 (((gnu services)) ((gnu services shepherd)) ((gnu services 
base)) (#) …))
   230:17  7 (map1 (((gnu services shepherd)) ((gnu services base)) ((gnu 
bootloader)) # …))
  2792:17  6 (resolve-interface (gnu services shepherd) #:select _ #:hide _ 
#:prefix _ # _ …)
  2718:10  5 (_ (gnu services shepherd) _ _ #:ensure _)
  2986:16  4 (try-module-autoload _ _)
   2316:4  3 (save-module-excursion #)
  3006:22  2 (_)
In unknown file:
   1 (primitive-load-path "gnu/services/shepherd" #)
In gnu/services/shepherd.scm:
 90:2  0 (_)

gnu/services/shepherd.scm:90:2: gnu/services/shepherd.scm:90:2: In procedure 
allocate-struct: Wrong type argument in position 2: 5

Best Regards,
Huang, Ying




Re: bug#26308: [PATCH -v2] services: dict.scm: Support more dicod configuration

2017-04-02 Thread huang ying
On Sun, Apr 2, 2017 at 6:12 AM, Ludovic Courtès <l...@gnu.org> wrote:
> Hello,
>
> "Huang, Ying" <huang_ying_cari...@163.com> skribis:
>
>> l...@gnu.org (Ludovic Courtès) writes:
>
> [...]
>
>>> While I was at it, I wrote a simple test for the dicod service:
>>>
>>>   
>>> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=985a8599ed742053b52ac85f753c4feb54af93cb
>>>
>>> It uses the example handler that you gave in the doc, but I think this
>>> handler actually does nothing because WordNet does not provide data in
>>> the dict.org format AIUI (and its data is under “/dict” anyway.)  Is
>>> that correct?
>>>
>>> Do you have another example in mind that could use a dict.org-formatted
>>> database?
>>
>> There are dict.org dict for wordnet and foldoc in Debian.  Some
>> conversion tool is needed to convert the dict database file.
>
> OK.  Any idea of a DICT database file that we could use as an example
> and as a test?

I found there is freedict database file, for example,

https://downloads.sourceforge.net/project/freedict/English%20-%20French/0.1.4/freedict-eng-fra-0.1.4.tar.bz2?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Ffreedict%2Ffiles%2FEnglish%2520-%2520French%2F0.1.4%2Ffreedict-eng-fra-0.1.4.tar.bz2%2Fdownload=1491090445_mirror=excellmedia

The home page is http://freedict.org/en/, the github page is
http://freedict.org/en/, according to
https://github.com/freedict/fd-dictionaries/blob/master/eng-fra/COPYING,
the database file is released with GPL.

Best Regards,
Huang, Ying

> Thanks,
> Ludo’.



Re: bug#26308: [PATCH -v2] services: dict.scm: Support more dicod configuration

2017-04-01 Thread Huang, Ying
l...@gnu.org (Ludovic Courtès) writes:

> Hello,
>
> Huang Ying <huang.ying.cari...@gmail.com> skribis:
>
>> * gnu/services/dict.scm (): Add handlers to configure
>>   handlers (module instances).
>>   (): Add new record type to describe handler (module 
>> instance).
>>   (): Add more fields.
>>   (dicod-configuration-file): Support convert handlers and enhanced databases
>>   configuration to config file.
>>
>> * doc/guix.text: Add description of newly added dicod configuration.
>
> I’ve committed with a few adjustments to the commit log and cosmetic
> changes:
>
>   
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=9af7ecd9591b4eff41389291bbc586dcf09e2665
>
>> +@example
>> +(dicod-service #:config
>> + (dicod-configuration
>> +  (handlers
>> +   (list
>> +(dicod-handler
>> + (name "wordnet")
>> + (module "dictorg")
>> + (options
>> +  '("dbdir=/gnu/store/-wordnet")
>
> I’ve changed this to use a real example instead of “xxx”.
>
>>  (define-record-type* 
>>dicod-database make-dicod-database
>>dicod-database?
>>(namedicod-database-name)
>> -  (module  dicod-database-module)
>> +  (handler dicod-database-handler)
>> +  (complex dicod-database-complex(default #f))
>
> I changed that to ‘complex?’, to make it clear that it’s a Boolean.
>
> While I was at it, I wrote a simple test for the dicod service:
>
>   
> https://git.savannah.gnu.org/cgit/guix.git/commit/?id=985a8599ed742053b52ac85f753c4feb54af93cb
>
> It uses the example handler that you gave in the doc, but I think this
> handler actually does nothing because WordNet does not provide data in
> the dict.org format AIUI (and its data is under “/dict” anyway.)  Is
> that correct?
>
> Do you have another example in mind that could use a dict.org-formatted
> database?

There are dict.org dict for wordnet and foldoc in Debian.  Some
conversion tool is needed to convert the dict database file.

Best Regards,
Huang, Ying

> Thank you!
>
> Ludo’.




[PATCH -v2] services: dict.scm: Support more dicod configuration

2017-03-30 Thread Huang Ying
* gnu/services/dict.scm (): Add handlers to configure
  handlers (module instances).
  (): Add new record type to describe handler (module instance).
  (): Add more fields.
  (dicod-configuration-file): Support convert handlers and enhanced databases
  configuration to config file.

* doc/guix.text: Add description of newly added dicod configuration.
---
 doc/guix.texi | 57 ++-
 gnu/services/dict.scm | 52 ++
 2 files changed, 96 insertions(+), 13 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 57595b95e..f1a063581 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -14370,25 +14370,49 @@ This is the list of IP addresses and ports and 
possibly socket file
 names to listen to (@pxref{Server Settings, @code{listen} directive,,
 dico, GNU Dico Manual}).
 
+@item @code{handlers} (default: @var{'()})
+List of @code{} objects denoting handlers (module instances).
+
 @item @code{databases} (default: @var{(list %dicod-database:gcide)})
 List of @code{} objects denoting dictionaries to be served.
 @end table
 @end deftp
 
-@deftp {Data Type} dicod-database
-Data type representing a dictionary database.
+@deftp {Data Type} dicod-handler
+Data type representing a dictionary handler (module instance).
 
 @table @asis
 @item @code{name}
-Name of the database, will be used in DICT commands.
+Name of the handler (module instance).
 
-@item @code{module}
-Name of the dicod module used by this database
+@item @code{module} (default: @var{#f})
+Name of the dicod module of the handler (instance).  If it is @code{#f},
+the module has the same name as the handler.
 (@pxref{Modules,,, dico, GNU Dico Manual}).
 
 @item @code{options}
 List of strings or gexps representing the arguments for the module handler
+@end table
+@end deftp
+
+@deftp {Data Type} dicod-database
+Data type representing a dictionary database.
+
+@table @asis
+@item @code{name}
+Name of the database, will be used in DICT commands.
+
+@item @code{handler}
+Name of the dicod handler (module instance) used by this database
 (@pxref{Handlers,,, dico, GNU Dico Manual}).
+
+@item @code{complex} (default: @var{#f})
+Whether the database configuration complex.  The complex configuration
+will need a corresponding @code{} object, otherwise not.
+
+@item @code{options}
+List of strings or gexps representing the arguments for the database
+(@pxref{Databases,,, dico, GNU Dico Manual}).
 @end table
 @end deftp
 
@@ -14397,6 +14421,29 @@ A @code{} object serving the GNU 
Collaborative International
 Dictonary of English using the @code{gcide} package.
 @end defvr
 
+The following is an example @code{dicod-service} configuration.
+
+@example
+(dicod-service #:config
+ (dicod-configuration
+  (handlers
+   (list
+(dicod-handler
+ (name "wordnet")
+ (module "dictorg")
+ (options
+  '("dbdir=/gnu/store/-wordnet")
+  (databases
+   (list
+(dicod-database
+ (name "wordnet")
+ (complex #t)
+ (handler "wordnet")
+ (options
+  '("database=wn")))
+%dicod-database:gcide
+@end example
+
 @subsubsection Version Control
 
 The @code{(gnu services version-control)} module provides the following 
services:
diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 303067037..596f901f3 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 Sou Bunnbu <iyzs...@gmail.com>
 ;;; Copyright © 2016 Ludovic Courtès <l...@gnu.org>
+;;; Copyright © 2017 Huang Ying <huang.ying.cari...@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -32,6 +33,7 @@
   #:export (dicod-service
 dicod-service-type
 dicod-configuration
+dicod-handler
 dicod-database
 %dicod-database:gcide))
 
@@ -46,21 +48,30 @@
   (dicodicod-configuration-dico   (default dico))
   (interfaces  dicod-configuration-interfaces ;list of strings
(default '("localhost")))
-  (databases   dicod-configuration-databases
-   ;; list of 
+  (handlersdicod-configuration-handlers   ;list of 
+   (default '()))
+  (databases   dicod-configuration-databases  ;list of 
(default (list %dicod-database:gcide
 
+(define-record-type* 
+  dicod-handler make-dicod-handler
+  dicod-handler?
+  (namedicod-handler-name)
+  (module  dicod-handler-module  (default #f))
+  (options dicod-handler-options (default '(
+
 (define-record-type* 
   dicod-database make-dicod-database
   dicod-database?
   (namedicod-database-name)
-  (module  dicod-database-module)
+  (handler dicod-database-handler)
+  (complex dicod-database-complex(default #f))
   (options dicod-database-options

Re: bug#26075: [PATCH -v3 1/2] build: union: Add create-all-directories? parameter to union-build

2017-03-24 Thread Huang, Ying
Hi, Ludo,

Any comment?

Best Regards,
Huang, Ying

Danny Milosavljevic <dan...@scratchpost.org> writes:

> Both LGTM!




[PATCH -v3 1/2] build: union: Add create-all-directories? parameter to union-build

2017-03-12 Thread Huang Ying
* guix/build/union.scm (union-build): Add create-all-directories? keyword
  parameter.
---
 guix/build/union.scm | 16 +++-
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/guix/build/union.scm b/guix/build/union.scm
index 6640b5652..b852bc66e 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -73,9 +73,12 @@ identical, #f otherwise."
   (loop)
 
 (define* (union-build output inputs
-  #:key (log-port (current-error-port)))
-  "Build in the OUTPUT directory a symlink tree that is the union of all
-the INPUTS."
+  #:key (log-port (current-error-port))
+  (create-all-directories? #f))
+  "Build in the OUTPUT directory a symlink tree that is the union of all the
+INPUTS.  As a special case, if CREATE-ALL-DIRECTORIES?, creates the
+subdirectories in the output directory to make sure the caller can modify them
+later."
 
   (define (symlink* input output)
 (format log-port "`~a' ~~> `~a'~%" input output)
@@ -104,8 +107,11 @@ the INPUTS."
   (define (union output inputs)
 (match inputs
   ((input)
-   ;; There's only one input, so just make a link.
-   (symlink* input output))
+   ;; There's only one input, so just make a link unless
+   ;; create-all-directories?.
+   (if (and create-all-directories? (file-is-directory? input))
+   (union-of-directories output inputs)
+   (symlink* input output)))
   (_
(call-with-values (lambda () (partition file-is-directory? inputs))
  (match-lambda*
-- 
2.12.0





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

2017-03-12 Thread Huang Ying
* guix/profiles.scm (fonts-dir-file): Create fonts.dir/scale files for all
  fonts directories.
---
 guix/profiles.scm | 60 ---
 1 file changed, 44 insertions(+), 16 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index de82eae34..6fb101154 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -877,9 +877,12 @@ entries.  It's used to query the MIME type of a given 
file."
   #:substitutable? #f)
 (return #f
 
+;; Several font packages may install font files into same directory, so
+;; fonts.dir and fonts.scale file should be generated here, instead of in
+;; packages.
 (define (fonts-dir-file manifest)
   "Return a derivation that builds the @file{fonts.dir} and @file{fonts.scale}
-files for the truetype fonts of the @var{manifest} entries."
+files for the fonts of the @var{manifest} entries."
   (define mkfontscale
 (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontscale))
 
@@ -891,29 +894,54 @@ files for the truetype fonts of the @var{manifest} 
entries."
 (use-modules (srfi srfi-26)
  (guix build utils)
  (guix build union))
-(let ((ttf-dirs (filter file-exists?
-(map (cut string-append <>
-  "/share/fonts/truetype")
- '#$(manifest-inputs manifest)
+(let ((fonts-dirs (filter file-exists?
+  (map (cut string-append <>
+"/share/fonts")
+   '#$(manifest-inputs manifest)
   (mkdir #$output)
-  (if (null? ttf-dirs)
+  (if (null? fonts-dirs)
   (exit #t)
-  (let* ((fonts-dir   (string-append #$output "/share/fonts"))
- (ttf-dir (string-append fonts-dir "/truetype"))
+  (let* ((share-dir   (string-append #$output "/share"))
+ (fonts-dir   (string-append share-dir "/fonts"))
  (mkfontscale (string-append #+mkfontscale
  "/bin/mkfontscale"))
  (mkfontdir   (string-append #+mkfontdir
- "/bin/mkfontdir")))
-(mkdir-p fonts-dir)
-(union-build ttf-dir ttf-dirs
- #:log-port (%make-void-port "w"))
-(with-directory-excursion ttf-dir
-  (exit (and (zero? (system* mkfontscale))
- (zero? (system* mkfontdir))
+ "/bin/mkfontdir"))
+ (empty-file? (lambda (filename)
+(call-with-ascii-input-file filename
+  (lambda (p)
+(eqv? #\0 (read-char p))
+ (fonts-dir-file "fonts.dir")
+ (fonts-scale-file "fonts.scale"))
+(mkdir-p share-dir)
+;; Create all sub-directories, because we may create fonts.dir
+;; and fonts.scale files in the sub-directories.
+(union-build fonts-dir fonts-dirs
+ #:log-port (%make-void-port "w")
+ #:create-all-directories? #t)
+(let ((directories (find-files fonts-dir
+   (lambda (file stat)
+ (eq? 'directory (stat:type 
stat)))
+   #:directories? #t)))
+  (for-each (lambda (dir)
+  (with-directory-excursion dir
+(when (file-exists? fonts-scale-file)
+  (delete-file fonts-scale-file))
+(when (file-exists? fonts-dir-file)
+  (delete-file fonts-dir-file))
+(unless (and (zero? (system* mkfontscale))
+ (zero? (system* mkfontdir)))
+  (exit #f))
+(when (empty-file? fonts-scale-file)
+  (delete-file fonts-scale-file))
+(when (empty-file? fonts-dir-file)
+  (delete-file fonts-dir-file
+directories)))
 
   (gexp->derivation "fonts-dir" build
 #:modules '((guix build utils)
-(guix build union))
+(guix build union)
+(srfi srfi-26))
 #:local-build? #t
 #:substitutable? #f))
 
-- 

Re: Could anyone help me to pack the shellcheck (haskell)

2017-03-12 Thread Huang, Ying
Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> On Thu, 09 Mar 2017 19:39:19 +0800
> "Huang\, Ying" <huang_ying_cari...@163.com> wrote:
>
>> Danny Milosavljevic <dan...@scratchpost.org> writes:
>> 
>> > Hi,
>> >
>> > On Wed, 08 Mar 2017 20:08:41 +0800
>> > "Huang\, Ying" <huang_ying_cari...@163.com> wrote:
>> >  
>> >> I know very little about Haskell, but I use shellcheck
>> >> (https://github.com/koalaman/shellcheck) to check my shell scripts.  I
>> >> tried myself, but found it is hard for me.  Could anyone help me on
>> >> that?  
>> 
>> Great!  It works! 
>
> Nice. Good to know that it works for you as-is.
>
>>Thanks a lot!  Now I can use shellcheck.  Could you
>> make it merged by Guix?
>
> Eventually, but it has to go through the normal review process in any case.
>
> Could you give some details for the description? I'm not a user of shellcheck 
> so I have no idea what else to put there.

Copied from the README of the shellcheck, I think this is a more
detailed description.

ShellCheck is a GPLv3 tool that gives warnings and suggestions for
bash/sh shell scripts.  The goals of ShellCheck are,

- To point out and clarify typical beginner's syntax issues that cause
a shell to give cryptic error messages.

- To point out and clarify typical intermediate level semantic problems
that cause a shell to behave strangely and counter-intuitively.

- To point out subtle caveats, corner cases and pitfalls that may cause an
advanced user's otherwise working script to fail under future circumstances.

> Also, could you do a license review (check the shellcheck source files for 
> header comments which say what license to use) and make sure it's actually 
> gpl3 or later ?

Check all *.hs files in the shellcheck.  All files except
ShellCheck/Data.hs has header comments which say gpl3 or later is used.
The ShellCheck/Data.hs has no header comments about copyright and there
are only several variable definitions in the file.

Best Regards,
Huang, Ying

> Then I'll post an updated patch to guix-patches (to be merged eventually 
> after review) if you want.




Re: Could anyone help me to pack the shellcheck (haskell)

2017-03-10 Thread Huang, Ying
Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> On Thu, 09 Mar 2017 19:39:19 +0800
> "Huang\, Ying" <huang_ying_cari...@163.com> wrote:
>
>> Danny Milosavljevic <dan...@scratchpost.org> writes:
>> 
>> > Hi,
>> >
>> > On Wed, 08 Mar 2017 20:08:41 +0800
>> > "Huang\, Ying" <huang_ying_cari...@163.com> wrote:
>> >  
>> >> I know very little about Haskell, but I use shellcheck
>> >> (https://github.com/koalaman/shellcheck) to check my shell scripts.  I
>> >> tried myself, but found it is hard for me.  Could anyone help me on
>> >> that?  
>> 
>> Great!  It works! 
>
> Nice. Good to know that it works for you as-is.
>
>>Thanks a lot!  Now I can use shellcheck.  Could you
>> make it merged by Guix?
>
> Eventually, but it has to go through the normal review process in any case.

Sure.

> Could you give some details for the description? I'm not a user of
> shellcheck so I have no idea what else to put there.

Sure.

> Also, could you do a license review (check the shellcheck source files
> for header comments which say what license to use) and make sure it's
> actually gpl3 or later ?

Sure.

> Then I'll post an updated patch to guix-patches (to be merged
> eventually after review) if you want.

Great! Thanks a lot!

Best Regards,
Huang, Ying




Re: [PATCH Resend] services: dict.scm: Support more dicod configuration

2017-03-09 Thread Huang, Ying
l...@gnu.org (Ludovic Courtès) writes:

> Hello!
>
> Sorry for the long delay.
>
> Huang Ying <huang.ying.cari...@gmail.com> skribis:
>
>> * gnu/services/dict.scm (): Rename databases
>>   to items to reflect more general configuration.
>>   (): Add new record type to describe handler (module).
>>   (): Add more fields.
>>   (dicod-configuration-file): Support convert more configuration items
>>   to config file.
>
> Looks like a nice addition!
>
>>(dicodicod-configuration-dico   (default dico))
>>(interfaces  dicod-configuration-interfaces ;list of strings
>> (default '("localhost")))
>> -  (databases   dicod-configuration-databases
>> -   ;; list of 
>> +  (items   dicod-configuration-items
>> +   ;; list of  or 
>> (default (list %dicod-database:gcide
>
> “Items” sounds very generic.  Would it make sense to instead keep
> separate ‘databases’ and ‘handlers’ fields?

OK.

>> +(define-record-type* 
>> +  dicod-handler make-dicod-handler
>> +  dicod-handler?
>> +  (namedicod-handler-name)
>> +  (module  dicod-handler-module  (default #f))
>> +  (options dicod-handler-options (default '(
>
> In fact I would suggest “module” instead of “handler”, to stick to the
> name that Dico uses already, IIUC.  WDYT?

>From dico documentation

http://puszcza.gnu.org.ua/software/dico/manual/html_node/dictorg.html

There may be multiple instances for one module.  And the "instance" is
called as "handler" in "database" configuration.  So I changed the name.
If we call "instance" as "module", we will need another name for the
"module" in "instance" configuration.

> One last thing: could you update guix.texi to mention this?  Adding an
> example of how to use it would be ideal.

Sure.  I just want to collect some comments before change the
documentation.

> Thank you!
>
> Ludo’.
>
> PS: In the future you can send to guix-patc...@gnu.org, which goes to
> <https://bugs.gnu.org/guix-patches> where it’s hopefully less likely
> to fall through the cracks.  ;-)

Sure.  Thanks for pointing this out!

Best Regards,
Huang, Ying




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

2017-03-09 Thread Huang, Ying
l...@gnu.org (Ludovic Courtès) writes:

> huang ying <huang.ying.cari...@gmail.com> skribis:
>
>> On Wed, Mar 8, 2017 at 4:24 AM, Danny Milosavljevic
>> <dan...@scratchpost.org> wrote:
>>> Hi,
>>>
>>>> +(with-directory-excursion dir
>>>> +  (and (file-exists? fonts-scale-file)
>>>> +   (delete-file fonts-scale-file))
>>>> +  (and (file-exists? fonts-dir-file)
>>>> +   (delete-file fonts-dir-file))
>>>> +  (system* mkfontscale)
>>>> +  (system* mkfontdir)
>>>
>>> Please do not throw away the status code here (result of system*). You can 
>>> check for okayness by (zero? (system* ...)).
>>
>> Then what is the intended behavior?  abort the build process with
>> message and non-zero exit code?  Usually we will raise a exception or
>> just display some message and exit?
>
> See for instance ‘info-dir-file’, which does this:
>
>   (exit (every install-info
>(append-map info-files
>        '#$(manifest-inputs manifest
>
> The effect is to exit with 0 upon success and some other code upon
> failure, leading to a proper derivation build failure.

Sure.

Best Regards,
Huang, Ying

> HTH!
>
> Ludo’.




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

2017-03-09 Thread Huang, Ying
Hi, Ludo,

Thanks for comments!

l...@gnu.org (Ludovic Courtès) writes:

> Huang Ying <huang.ying.cari...@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’.




Re: [PATCH -v2 1/2] build: union: Add create-all-directories? parameter to union-build

2017-03-09 Thread Huang, Ying
l...@gnu.org (Ludovic Courtès) writes:

> Huang Ying <huang.ying.cari...@gmail.com> skribis:
>
>> * guix/build/union.scm (union-build): Add create-all-directories? keyword
>>   parameter.  To add/remove some files from the directory.
>
> I guess this is needed for fonts.dir, but could you explain why it is?
> (The explanation could go as a comment above the ‘union-build’ call in
> the second patch.)

Sure.

Best Regards,
Huang, Ying

> Other than that LGTM.
>
> Thanks,
> Ludo’.




Re: Could anyone help me to pack the shellcheck (haskell)

2017-03-09 Thread Huang, Ying
Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> On Wed, 08 Mar 2017 20:08:41 +0800
> "Huang\, Ying" <huang_ying_cari...@163.com> wrote:
>
>> I know very little about Haskell, but I use shellcheck
>> (https://github.com/koalaman/shellcheck) to check my shell scripts.  I
>> tried myself, but found it is hard for me.  Could anyone help me on
>> that?
n>
> If it's distributed by Haskell people then you can generate the package spec 
> form by:
>
> $ guix import stackage shellcheck
>
> Or
>
> $ guix import hackage shellcheck
>
> It will be printed to the standard output device. You can then copy it from 
> there.
>
> The difference is that the first one, stackage, has long-term-support (i.e. 
> well-tested and stable) package combinations. The latter has newer packages.
>
> But it seems that shellcheck is not distributed that way. Then you have to 
> write it by hand. It works really similar to any other package.
>
> So put the following into gnu/packages/haskell.scm :
>
> (define-public ghc-json
>   (package < this block was generated by: guix import hackage json
> (name "ghc-json")
> (version "0.9.1")
> (source
>   (origin
> (method url-fetch)
> (uri (string-append "https://hackage.haskell.org/package/json/;
> "json-" version ".tar.gz"))
> (sha256
>   (base32
> "18l5027vc68hnnxrxlnyl59vkkg95a92m1zzms0dqiby2r6pxdcn"
> (build-system haskell-build-system)
> (inputs
>  `(("ghc-syb" ,ghc-syb)
>("ghc-mtl" ,ghc-mtl)
>("ghc-text" ,ghc-text)
>("ghc-parsec" ,ghc-parsec)))
> (home-page "http://hackage.haskell.org/package/json;)
> (synopsis "Support for serialising Haskell to and from JSON")
> (description "JSON (JavaScript Object Notation) is a lightweight 
> data-interchange format. It is easy for humans to read and write. It is easy 
> for machines to parse and generate.  It is based on a subset of the 
> JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 
> 1999. . This library provides a parser and pretty printer for converting 
> between Haskell values and JSON.")
> (license license:bsd-3)))
>
> (define-public shellcheck
>   (package
> (name "shellcheck")
> (version "0.4.5")
> (source
>  (origin
>(method url-fetch)
>(uri (string-append "https://github.com/koalaman/shellcheck/archive/;
>"v" version ".tar.gz"))
>(sha256 (base32
> "14r84fcn28rin339avlvca5g0kz832f01x8dpmwb5ql8mbc4rlxr"))
>(file-name (string-append name "-" version ".tar.gz"
> (build-system haskell-build-system)
> (inputs
>  `(("ghc-quickcheck" ,ghc-quickcheck)
>("ghc-json" ,ghc-json)
>("ghc-mtl" ,ghc-mtl)
>("ghc-parsec" ,ghc-parsec)
>("ghc-regex-tdfa" ,ghc-regex-tdfa)))
> (home-page "https://github.com/koalaman/shellcheck;)
> (synopsis "Static analysis for shell scripts")
> (description "@code{ghc-shellcheck} provides static analysis for shell 
> scripts.")
> (license license:gpl3+)))
>
> The "ghc-" prefix is only used for libraries. I think from your description 
> that shellcheck is not a library. Is that correct?

Great!  It works!  Thanks a lot!  Now I can use shellcheck.  Could you
make it merged by Guix?

Best Regards,
Huang, Ying




Could anyone help me to pack the shellcheck (haskell)

2017-03-08 Thread Huang, Ying
Hi, All,

I know very little about Haskell, but I use shellcheck
(https://github.com/koalaman/shellcheck) to check my shell scripts.  I
tried myself, but found it is hard for me.  Could anyone help me on
that?

Thanks in advance!

Best Regards,
Huang, Ying




Re: [PATCH Resend] services: dict.scm: Support more dicod configuration

2017-03-08 Thread Huang, Ying
Hi,

Can anyone help me to review this patch?

Best Regards,
Huang, Ying

Huang Ying <huang.ying.cari...@gmail.com> writes:

> * gnu/services/dict.scm (): Rename databases
>   to items to reflect more general configuration.
>   (): Add new record type to describe handler (module).
>   (): Add more fields.
>   (dicod-configuration-file): Support convert more configuration items
>   to config file.
> ---
>  gnu/services/dict.scm | 50 --
>  1 file changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
> index 303067037..628ec9757 100644
> --- a/gnu/services/dict.scm
> +++ b/gnu/services/dict.scm
> @@ -32,6 +32,7 @@
>#:export (dicod-service
>  dicod-service-type
>  dicod-configuration
> +dicod-handler
>  dicod-database
>  %dicod-database:gcide))
>  
> @@ -46,21 +47,29 @@
>(dicodicod-configuration-dico   (default dico))
>(interfaces  dicod-configuration-interfaces ;list of strings
> (default '("localhost")))
> -  (databases   dicod-configuration-databases
> -   ;; list of 
> +  (items   dicod-configuration-items
> +   ;; list of  or 
> (default (list %dicod-database:gcide
>  
> +(define-record-type* 
> +  dicod-handler make-dicod-handler
> +  dicod-handler?
> +  (namedicod-handler-name)
> +  (module  dicod-handler-module  (default #f))
> +  (options dicod-handler-options (default '(
> +
>  (define-record-type* 
>dicod-database make-dicod-database
>dicod-database?
>(namedicod-database-name)
> -  (module  dicod-database-module)
> +  (handler dicod-database-handler)
> +  (complex dicod-database-complex(default #f))
>(options dicod-database-options(default '(
>  
>  (define %dicod-database:gcide
>(dicod-database
> (name "gcide")
> -   (module "gcide")
> +   (handler "gcide")
> (options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
>"idxdir=/var/run/dicod"
>  
> @@ -76,23 +85,44 @@
>   (shell (file-append shadow "/sbin/nologin")
>  
>  (define (dicod-configuration-file config)
> -  (define database->text
> +  (define item->text
>  (match-lambda
> -  (($  name module options)
> +  (($  name #f '())
> +   `("
> +load-module " ,name ";"))
> +  (($  name #f options)
> +   (item->text (dicod-handler
> +(name name)
> +(module name)
> +(options options
> +  (($  name module options)
> +   `("
> +load-module " ,name " {
> +   command \"" ,module (string-join (list ,@options) " " 'prefix) "\";
> +}\n"))
> +  (($  name handler #f options)
> +   (append
> +(item->text (dicod-handler
> + (name handler)))
> +(item->text (dicod-database
> + (name name)
> + (handler handler)
> + (complex #t)
> + (options options)
> +  (($  name handler complex options)
> `("
> -load-module " ,module ";
>  database {
> name \"" ,name "\";
> -   handler \"" ,module
> +   handler \"" ,handler
> (string-join (list ,@options) " " 'prefix) "\";
>  }\n"
>  
>(define configuration->text
>  (match-lambda
> -  (($  dico (interfaces ...) databases)
> +  (($  dico (interfaces ...) items)
> (append `("listen ("
>   ,(string-join interfaces ", ") ");\n")
> -   (append-map database->text databases)
> +   (append-map item->text items)
>  
>(apply mixed-text-file "dicod.conf" (configuration->text config)))




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

2017-03-07 Thread huang ying
On Wed, Mar 8, 2017 at 4:24 AM, Danny Milosavljevic
<dan...@scratchpost.org> wrote:
> Hi,
>
>> +(with-directory-excursion dir
>> +  (and (file-exists? fonts-scale-file)
>> +   (delete-file fonts-scale-file))
>> +  (and (file-exists? fonts-dir-file)
>> +   (delete-file fonts-dir-file))
>> +  (system* mkfontscale)
>> +  (system* mkfontdir)
>
> Please do not throw away the status code here (result of system*). You can 
> check for okayness by (zero? (system* ...)).

Then what is the intended behavior?  abort the build process with
message and non-zero exit code?  Usually we will raise a exception or
just display some message and exit?

Best Regards,
Huang, Ying



Re: [PATCH -v2 1/2] build: union: Add create-all-directories? parameter to union-build

2017-03-07 Thread huang ying
On Wed, Mar 8, 2017 at 4:35 AM, Danny Milosavljevic
<dan...@scratchpost.org> wrote:
> Hi,
>
> On Tue,  7 Mar 2017 19:07:48 +0800
> Huang Ying <huang.ying.cari...@gmail.com> wrote:
>
>> * guix/build/union.scm (union-build): Add create-all-directories? keyword
>>   parameter.  To add/remove some files from the directory.
>
> Maybe without "To add/remove some files from the directory." ?
>
> If you'd like to document your new functionality, please update the docstring 
> in the source code - it's not like we read the git log for API documentation.

Sure.

> The source code currently says:
>
>  "Build in the OUTPUT directory a symlink tree that is the union of all
>  the INPUTS."
>
> and it could be updated to say:
>
>  "Build in the OUTPUT directory a symlink tree that is the union of all
>   the INPUTS.  As a special case, if CREATE-ALL-DIRECTORIES?, creates
>   the direct subdirectories in the output directory to make sure the
>   user can add to them later."

Will change the docstring as this.  Maybe change "user" to "caller" to
emphasize the end user will not change the directories.

> Otherwise LGTM!

Thanks!

Best Regards,
Huang, Ying



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

2017-03-07 Thread Huang Ying
* guix/profiles.scm (fonts-dir-file): Create fonts.dir/scale files for all
  fonts directories.
---
 guix/profiles.scm | 56 ++-
 1 file changed, 39 insertions(+), 17 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index de82eae34..2f10147f2 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -879,7 +879,7 @@ entries.  It's used to query the MIME type of a given file."
 
 (define (fonts-dir-file manifest)
   "Return a derivation that builds the @file{fonts.dir} and @file{fonts.scale}
-files for the truetype fonts of the @var{manifest} entries."
+files for the fonts of the @var{manifest} entries."
   (define mkfontscale
 (module-ref (resolve-interface '(gnu packages xorg)) 'mkfontscale))
 
@@ -890,30 +890,52 @@ files for the truetype fonts of the @var{manifest} 
entries."
 #~(begin
 (use-modules (srfi srfi-26)
  (guix build utils)
- (guix build union))
-(let ((ttf-dirs (filter file-exists?
-(map (cut string-append <>
-  "/share/fonts/truetype")
- '#$(manifest-inputs manifest)
+ (guix build union)
+ (ice-9 ftw))
+(let ((fonts-dirs (filter file-exists?
+  (map (cut string-append <>
+"/share/fonts")
+   '#$(manifest-inputs manifest)
   (mkdir #$output)
-  (if (null? ttf-dirs)
+  (if (null? fonts-dirs)
   (exit #t)
-  (let* ((fonts-dir   (string-append #$output "/share/fonts"))
- (ttf-dir (string-append fonts-dir "/truetype"))
+  (let* ((share-dir   (string-append #$output "/share"))
+ (fonts-dir   (string-append share-dir "/fonts"))
  (mkfontscale (string-append #+mkfontscale
  "/bin/mkfontscale"))
  (mkfontdir   (string-append #+mkfontdir
- "/bin/mkfontdir")))
-(mkdir-p fonts-dir)
-(union-build ttf-dir ttf-dirs
- #:log-port (%make-void-port "w"))
-(with-directory-excursion ttf-dir
-  (exit (and (zero? (system* mkfontscale))
- (zero? (system* mkfontdir))
+ "/bin/mkfontdir"))
+ (empty-file? (lambda (filename)
+(call-with-ascii-input-file filename
+  (lambda (p)
+(eqv? #\0 (read-char p))
+ (fonts-dir-file "fonts.dir")
+ (fonts-scale-file "fonts.scale"))
+(mkdir-p share-dir)
+(union-build fonts-dir fonts-dirs
+ #:log-port (%make-void-port "w")
+ #:create-all-directories? #t)
+(ftw fonts-dir
+ (lambda (dir statinfo flag)
+   (and (eq? flag 'directory)
+(with-directory-excursion dir
+  (and (file-exists? fonts-scale-file)
+   (delete-file fonts-scale-file))
+  (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
+   #t)))
 
   (gexp->derivation "fonts-dir" build
 #:modules '((guix build utils)
-(guix build union))
+(guix build union)
+(srfi srfi-26)
+(ice-9 ftw))
 #:local-build? #t
 #:substitutable? #f))
 
-- 
2.12.0





[PATCH -v2 1/2] build: union: Add create-all-directories? parameter to union-build

2017-03-07 Thread Huang Ying
* guix/build/union.scm (union-build): Add create-all-directories? keyword
  parameter.  To add/remove some files from the directory.
---
 guix/build/union.scm | 10 +++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/guix/build/union.scm b/guix/build/union.scm
index 6640b5652..6a2a0f546 100644
--- a/guix/build/union.scm
+++ b/guix/build/union.scm
@@ -73,7 +73,8 @@ identical, #f otherwise."
   (loop)
 
 (define* (union-build output inputs
-  #:key (log-port (current-error-port)))
+  #:key (log-port (current-error-port))
+  (create-all-directories? #f))
   "Build in the OUTPUT directory a symlink tree that is the union of all
 the INPUTS."
 
@@ -104,8 +105,11 @@ the INPUTS."
   (define (union output inputs)
 (match inputs
   ((input)
-   ;; There's only one input, so just make a link.
-   (symlink* input output))
+   ;; There's only one input, so just make a link unless
+   ;; create-all-directories?.
+   (if (and create-all-directories? (file-is-directory? input))
+   (union-of-directories output inputs)
+   (symlink* input output)))
   (_
(call-with-values (lambda () (partition file-is-directory? inputs))
  (match-lambda*
-- 
2.12.0





[PATCH Resend] services: dict.scm: Support more dicod configuration

2017-03-07 Thread Huang Ying
* gnu/services/dict.scm (): Rename databases
  to items to reflect more general configuration.
  (): Add new record type to describe handler (module).
  (): Add more fields.
  (dicod-configuration-file): Support convert more configuration items
  to config file.
---
 gnu/services/dict.scm | 50 --
 1 file changed, 40 insertions(+), 10 deletions(-)

diff --git a/gnu/services/dict.scm b/gnu/services/dict.scm
index 303067037..628ec9757 100644
--- a/gnu/services/dict.scm
+++ b/gnu/services/dict.scm
@@ -32,6 +32,7 @@
   #:export (dicod-service
 dicod-service-type
 dicod-configuration
+dicod-handler
 dicod-database
 %dicod-database:gcide))
 
@@ -46,21 +47,29 @@
   (dicodicod-configuration-dico   (default dico))
   (interfaces  dicod-configuration-interfaces ;list of strings
(default '("localhost")))
-  (databases   dicod-configuration-databases
-   ;; list of 
+  (items   dicod-configuration-items
+   ;; list of  or 
(default (list %dicod-database:gcide
 
+(define-record-type* 
+  dicod-handler make-dicod-handler
+  dicod-handler?
+  (namedicod-handler-name)
+  (module  dicod-handler-module  (default #f))
+  (options dicod-handler-options (default '(
+
 (define-record-type* 
   dicod-database make-dicod-database
   dicod-database?
   (namedicod-database-name)
-  (module  dicod-database-module)
+  (handler dicod-database-handler)
+  (complex dicod-database-complex(default #f))
   (options dicod-database-options(default '(
 
 (define %dicod-database:gcide
   (dicod-database
(name "gcide")
-   (module "gcide")
+   (handler "gcide")
(options (list #~(string-append "dbdir=" #$gcide "/share/gcide")
   "idxdir=/var/run/dicod"
 
@@ -76,23 +85,44 @@
  (shell (file-append shadow "/sbin/nologin")
 
 (define (dicod-configuration-file config)
-  (define database->text
+  (define item->text
 (match-lambda
-  (($  name module options)
+  (($  name #f '())
+   `("
+load-module " ,name ";"))
+  (($  name #f options)
+   (item->text (dicod-handler
+(name name)
+(module name)
+(options options
+  (($  name module options)
+   `("
+load-module " ,name " {
+   command \"" ,module (string-join (list ,@options) " " 'prefix) "\";
+}\n"))
+  (($  name handler #f options)
+   (append
+(item->text (dicod-handler
+ (name handler)))
+(item->text (dicod-database
+ (name name)
+ (handler handler)
+ (complex #t)
+ (options options)
+  (($  name handler complex options)
`("
-load-module " ,module ";
 database {
name \"" ,name "\";
-   handler \"" ,module
+   handler \"" ,handler
(string-join (list ,@options) " " 'prefix) "\";
 }\n"
 
   (define configuration->text
 (match-lambda
-  (($  dico (interfaces ...) databases)
+  (($  dico (interfaces ...) items)
(append `("listen ("
  ,(string-join interfaces ", ") ");\n")
-   (append-map database->text databases)
+   (append-map item->text items)
 
   (apply mixed-text-file "dicod.conf" (configuration->text config)))
 
-- 
2.12.0





Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-27 Thread Huang, Ying
iyzs...@member.fsf.org (宋文武) writes:

> "Huang, Ying" <huang_ying_cari...@163.com> writes:
>
> Hi, sorry for my late reply.
>
>> Danny Milosavljevic <dan...@scratchpost.org> writes:
>>
>>> Hi,
>>>
>>> yeah, I've looked at it and I see what you are trying to do.
>>>
>>> You modified 'union to replicate the directory tree and symlink
>>> only the non-directory files - in order to be able to add
>>> "fonts.dir" in those directories.
>>>
>>> The previous version symlinked entire directories, too, and you
>>> wouldn't have been able to add those "fonts.dir" files inside them
>>> later.
>>>
>>> Your fix seems kinda hacky - but I don't really see a downside.
>>>
>>> Thinking about it some more I think it looks good enough to me. I'd
>>> like a second opinion, though.
>>>
>>> Other than that, the name of the new flag "create-all-directory?"
>>> is weird. I'd like it to be something like
>>> "create-all-directories?".
>
>>>
>>> (The non-hacky solution would be to make 'union aware that there are
>>> "fonts.dir" files to go in there, too. One could do that by adding
>>> these as an input, too. I'm not sure whether that would be worth the
>>> added complexity, though - especially since the fonts.dir generator
>>> needs to have the finished union as input and not just single
>>> directories one by one. Thoughts?)
>>
>> union will only be called with create-all-directory? != nil for packages
>> have share/fonts directories.  And for these packages, we plan to remove
>> the fonts.dir and fonts.scale files, so that we need to create all
>> directories for them after all.  Is this good enough?
>>
>
> Yes, I thought so and it will work, but maybe it's better (non-hacky
> way?) to make every font package install fonts.scale and fonts.dir files
> into its own directory...
>
> IIUC, to make them useful, we have to make the fonts directories
> available to the running X server through xserver.conf (FontPath) or
> adding them using 'xset +fp'.  And since either method is limited to a
> single directory, so if we avoid the collision by putting each font
> package under an unique path ($out/share/fonts/TYPE/FONT-NAME), then the
> font-dir profile hook is not needed at all.

In the other hand, we can add these paths into xorg.conf or `xset +fp`
via font-dir profile hook too.

> We can do this in the wanted (upcoming?) 'font-build-system'.

One question, how to deal with font packages which aren't built with
font-build-system?  For example, font-terminus uses gnu-build-system.

Best Regards,
Huang, Ying




Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-25 Thread Huang, Ying
Mark H Weaver <m...@netris.org> writes:

> Danny Milosavljevic <dan...@scratchpost.org> writes:
>
>> yeah, I've looked at it and I see what you are trying to do.
>>
>> You modified 'union to replicate the directory tree and symlink only
>> the non-directory files - in order to be able to add "fonts.dir" in
>> those directories.
>
> If the purpose here is to facilitate mutating anything in the store,
> then we cannot accept this.  The entire design is Guix is based on store
> items being immutable, and we assume this throughout the code, most
> notably by assuming that store items and parts of store items can be
> aliased instead of copied.
>
> If you want to add something to your profile, e.g. fonts.dir, then use
> profile hooks for that.  See %default-profile-hooks in
> guix/profiles.scm.  However, we already have a hook to build fonts.dir,
> so I'm not sure what's missing here.

This is to be used by fonts-dir-file profile hook.  The 2/2 of the
patchset will enhance the fonts-dir-file profile hook based on mechanism
provided here.  The problem we want to resolve in this patchset is that
in addition to $GUIX_PROFILE/share/fonts/truetype, we need to create
fonts.dir/scale for other directories in $GUIX_PROFILE/share/fonts too.
So we need to create all directories under $GUIX_PROFILE/share/fonts.
We do that in 2/2 of the patchset.

Best Regards,
Huang, Ying

> If we've misunderstood the rationale for this patch, can you help us
> understand what you're trying to do?
>
>  Thanks,
>Mark




Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-25 Thread Huang, Ying
Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> yeah, I've looked at it and I see what you are trying to do.
>
> You modified 'union to replicate the directory tree and symlink only the 
> non-directory files - in order to be able to add "fonts.dir" in those 
> directories.
>
> The previous version symlinked entire directories, too, and you wouldn't have 
> been able to add those "fonts.dir" files inside them later.
>
> Your fix seems kinda hacky - but I don't really see a downside.
>
> Thinking about it some more I think it looks good enough to me. I'd like a 
> second opinion, though.
>
> Other than that, the name of the new flag "create-all-directory?" is weird. 
> I'd like it to be something like "create-all-directories?".
>
> (The non-hacky solution would be to make 'union aware that there are
> "fonts.dir" files to go in there, too. One could do that by adding
> these as an input, too. I'm not sure whether that would be worth the
> added complexity, though - especially since the fonts.dir generator
> needs to have the finished union as input and not just single
> directories one by one. Thoughts?)

union will only be called with create-all-directory? != nil for packages
have share/fonts directories.  And for these packages, we plan to remove
the fonts.dir and fonts.scale files, so that we need to create all
directories for them after all.  Is this good enough?

Best Regards,
Huang, Ying





Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-24 Thread Huang, Ying
Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> yeah, I've looked at it and I see what you are trying to do.
>
> You modified 'union to replicate the directory tree and symlink only the 
> non-directory files - in order to be able to add "fonts.dir" in those 
> directories.
>
> The previous version symlinked entire directories, too, and you wouldn't have 
> been able to add those "fonts.dir" files inside them later.
>
> Your fix seems kinda hacky - but I don't really see a downside.
>
> Thinking about it some more I think it looks good enough to me. I'd like a 
> second opinion, though.
>
> Other than that, the name of the new flag "create-all-directory?" is weird. 
> I'd like it to be something like "create-all-directories?".

OK.  Will change it.

Best Regards,
Huang, Ying

> (The non-hacky solution would be to make 'union aware that there are
> "fonts.dir" files to go in there, too. One could do that by adding
> these as an input, too. I'm not sure whether that would be worth the
> added complexity, though - especially since the fonts.dir generator
> needs to have the finished union as input and not just single
> directories one by one. Thoughts?)




Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-24 Thread Huang, Ying
Hi, Andy,

Andy Wingo <wi...@igalia.com> writes:

> Hi :)
>
> On Fri 24 Feb 2017 13:40, "Huang, Ying" <huang_ying_cari...@163.com> writes:
>
>>>(define (union output inputs)
>>>  (match inputs
>>>((input)
>>> -   ;; There's only one input, so just make a link.
>>> -   (symlink* input output))
>>> +   ;; There's only one input, so just make a link unless 
>>> create-all-directory?
>
> This comment should be a full sentence ending with a period, with line
> wrapped at 72 columns.

Sure.

>>> +   (if (and create-all-directory? (file-is-directory? input))
>>> +   (union-of-directories output inputs)
>>> +   (symlink* input output)))
>
> What's the use case?  Something that can handle some symlinks in the
> tree but not all symlinks in the tree?  I think this patch is a bad idea
> for union-build because it has a strange effect that's hard to describe
> up and down the union (both at the root and at branch directories).  I
> think it's probably a better idea to go for something more fit to your
> purpose and only pull it into union-build once you see yourself needing
> it more than once.  IMO anyway :)

The use case is the 2/2 of the patchset,

[PATCH 2/2] guix: profiles: create fonts.dir/scale for all fonts directories

I want to create fonts.dir and fonts.scale for font packages, because
multiple font packages could install fonts into same directory.  This is
done for $GUIX_PROFILE/share/fonts/truetype only before, but now we want
to do that for all font directories in $GUIX_PROFILE/share/fonts.  Do
you have some idea for some better solution?

Best Regards,
Huang, Ying

>
> Andy




Re: [PATCH 1/2] build: union: Add create-all-directory? parameter to union-build

2017-02-24 Thread Huang, Ying
Hi, All,

Can anyone help me to review this patch?

Best Regards,
Huang, Ying

huang_ying_cari...@163.com writes:

> From: Huang Ying <huang.ying.cari...@gmail.com>
>
> * guix/build/union.scm (union-build): Add create-all-directory? keyword
>   parameter.  To add/remove some files from the directory.
> ---
>  guix/build/union.scm | 9 ++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/guix/build/union.scm b/guix/build/union.scm
> index 6640b5652..4783066be 100644
> --- a/guix/build/union.scm
> +++ b/guix/build/union.scm
> @@ -73,7 +73,8 @@ identical, #f otherwise."
>(loop)
>  
>  (define* (union-build output inputs
> -  #:key (log-port (current-error-port)))
> +  #:key (log-port (current-error-port))
> +  (create-all-directory? #f))
>"Build in the OUTPUT directory a symlink tree that is the union of all
>  the INPUTS."
>  
> @@ -104,8 +105,10 @@ the INPUTS."
>(define (union output inputs)
>  (match inputs
>((input)
> -   ;; There's only one input, so just make a link.
> -   (symlink* input output))
> +   ;; There's only one input, so just make a link unless 
> create-all-directory?
> +   (if (and create-all-directory? (file-is-directory? input))
> +   (union-of-directories output inputs)
> +   (symlink* input output)))
>(_
> (call-with-values (lambda () (partition file-is-directory? inputs))
>   (match-lambda*




Re: Stumpwm and config.scm

2017-02-19 Thread Huang, Ying
"Daniel Pimentel (d4n1)" <d...@d4n1.org> writes:

> Guixs,
>
> I add lisp and sbcl-stumpwm in my config.scm but stump binary not exist. So 
> it works if I installed sbcl-stumpwm:bin with normal user.
>
> I tried put sbcl-stumpwm: bin in my config but there's an error. I didn't put 
> sbcl-stumpwm in my config.scm but I installed sbcl-stumpwm: bin and it works.

I have ever used

(specification->package+output "sbcl-stumpwm:bin")

in my config.scm.

Best Regards,
Huang, Ying




Re: [PATCH] gnu: font-gnu-unifont: Call mkfontdir for pcf output

2017-02-15 Thread Huang, Ying
Hi, All,

Alex Kost <alez...@gmail.com> writes:

> Danny Milosavljevic (2017-02-14 18:56 +0100) wrote:
>
>> Hi,
>>
>>> One problem of this solution is that some font packages (for example,
>>> fonts-misc-misc) already have fonts.dir, to avoid conflict, it is better
>>> to remove fonts.dir in all font packages and generate fonts.dir in
>>> fonts-dir-file,  I think that is good.  But I don't know whether others
>>> think that is a good idea.
>>
>> If it can happen that multiple packages install to share/fonts/
>> (certainly true for share/fonts/truetype and probably true for other
>> -directories) and fonts.dir then is conflicting (and doesn't
>> ever contain all the entries of the directory), I think that your idea
>> is very good (and how it was done before is dead wrong).
>
> I completely agree; removing all "fonts.dir" and "fonts.alias" files
> from packages and regenerating them at profile time looks like a good
> idea to me.

Good to know this.  I will implement it as this.

Best Regards,
Huang, Ying




Re: [PATCH -v3] Fix gtk-im-modules for gtk+3

2017-02-09 Thread Huang, Ying
iyzs...@member.fsf.org (宋文武) writes:

> "Huang, Ying" <huang_ying_cari...@163.com> writes:
>
>> Hi, Wenwu,
>>
>> iyzs...@member.fsf.org (宋文武) writes:
>>
>>> "Huang, Ying" <huang_ying_cari...@163.com> writes:
>>>
>>>> [...]
>>>>> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
>>>>> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
>>>>> +#$(if gtk+
>>>>> +  (build
>>>>> +   gtk+ "3.0.0"
>>>>> +   #~(string-append
>>>>> +  #$gtk+:bin "/bin/gtk-query-immodules-3.0"))
>>>>
>>>> If "gtk+" is store path instead of package, this doesn't work.  In a
>>>> previous version, "gtk+" will be store path, it is package now.  If it
>>>> will always be package in the future.  We can pass the store path of
>>>> target output too.
>>>
>>> Oh, you're right!
>>>
>>> We can use the gtk+ package object here:
>>>
>>> [attachment]
>>>
>>> 0001-profiles-gtk-im-modules-Fix-for-gtk3.patch
>>>
>>> From a0b9a36b4e902fd6f456fa596c6220c708c35f71 Mon Sep 17 00:00:00 2001
>>> From: "huang_ying_cari...@163.com" <huang_ying_cari...@163.com>
>>> Date: Sun, 5 Feb 2017 13:41:47 +0800
>>> Subject: [PATCH] profiles: gtk-im-modules: Fix for gtk3.
>>>
>>> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be 
>>> find
>>> in output "bin" instead of "out".
>>>
>>> * guix/profiles.scm (gtk-im-modules): Pass the path of 
>>> gtk-query-immodules-x.x
>>> as 'query' argument to the 'build' procedure.
>>> ---
>>>  guix/profiles.scm | 26 +++---
>>>  1 file changed, 19 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/guix/profiles.scm b/guix/profiles.scm
>>> index 495a9e2e7..de82eae34 100644
>>> --- a/guix/profiles.scm
>>> +++ b/guix/profiles.scm
>>> @@ -739,7 +739,7 @@ for both major versions of GTK+."
>>>(mlet %store-monad ((gtk+   (manifest-lookup-package manifest "gtk+" 
>>> "3"))
>>>(gtk+-2 (manifest-lookup-package manifest "gtk+" 
>>> "2")))
>>>  
>>> -(define (build gtk gtk-version)
>>> +(define (build gtk gtk-version query)
>>>(let ((major (string-take gtk-version 1)))
>>>  (with-imported-modules '((guix build utils)
>>>   (guix build union)
>>> @@ -756,8 +756,6 @@ for both major versions of GTK+."
>>>  
>>>(let* ((prefix  (string-append "/lib/gtk-" #$major ".0/"
>>>   #$gtk-version))
>>> - (query   (string-append #$gtk 
>>> "/bin/gtk-query-immodules-"
>>> - #$major ".0"))
>>>   (destdir (string-append #$output prefix))
>>>   (moddirs (cons (string-append #$gtk prefix 
>>> "/immodules")
>>>  (filter file-exists?
>>> @@ -768,7 +766,7 @@ for both major versions of GTK+."
>>>  
>>>  ;; Generate a new immodules cache file.
>>>  (mkdir-p (string-append #$output prefix))
>>> -(let ((pipe(apply open-pipe* OPEN_READ query modules))
>>> +(let ((pipe(apply open-pipe* OPEN_READ #$query 
>>> modules))
>>>(outfile (string-append #$output prefix
>>>"/immodules-gtk" #$major 
>>> ".cache")))
>>>(dynamic-wind
>>> @@ -783,9 +781,23 @@ for both major versions of GTK+."
>>>(close-pipe pipe)
>>>  
>>>  ;; Don't run the hook when there's nothing to do.
>>> -(let ((gexp #~(begin
>>> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
>>> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
>>> +(let* ((pkg-gtk+ (module-ref; lazy reference
>>> + 

Re: Add /usr/bin/env by default in guixsd?

2017-02-09 Thread Huang, Ying
l...@gnu.org (Ludovic Courtès) writes:

> Hello,
>
> huang_ying_cari...@163.com skribis:
>
>> l...@gnu.org (Ludovic Courtès) writes:
>
> [...]
>
>>> First we need a simple ‘special-files’ service or something (for /bin/sh
>>> and /usr/bin/env).
>>>
>>> Then the whole battle will be about what the default should be.  I used
>>> to be affiliated with the “no way!” party on this topic, but I
>>> considering changing my mind.  :-)  Especially that it does not matter
>>> that much, after all.
>>
>> That sounds great for me!  Thanks!
>
> Commit 387e175492f960d7d86f34f3b2e43938fa72dbf3 adds
> ‘special-files-service-type’.
>
> The default is unchanged (only /bin/sh is created) but the documentation
> provides a one-liner for /usr/bin/env (see below).
>
> Thanks,
> Ludo’.
>
>  -- Scheme Variable: special-files-service-type
>  This is the service that sets up “special files” such as ‘/bin/sh’;
>  an instance of it is part of ‘%base-services’.
>
>  The value associated with ‘special-files-service-type’ services
>  must be a list of tuples where the first element is the “special
>  file” and the second element is its target.  By default it is:
>
>   `(("/bin/sh" ,(file-append BASH "/bin/sh")))
>
>  If you want to add, say, ‘/usr/bin/env’ to your system, you can
>  change it to:
>
>   `(("/bin/sh" ,(file-append BASH "/bin/sh"))
> ("/usr/bin/env" ,(file-append COREUTILS "/bin/env")))
>
>  Since this is part of ‘%base-services’, you can use
>  ‘modify-services’ to customize the set of special files (*note
>  ‘modify-services’: Service Reference.).  But the simple way to add
>  a special file is via the ‘extra-special-file’ procedure (see
>  below.)
>
>  -- Scheme Procedure: extra-special-file FILE TARGET
>  Use TARGET as the “special file” FILE.
>
>  For example, adding the following lines to the ‘services’ field of
>  your operating system declaration leads to a ‘/usr/bin/env’
>  symlink:
>
>   (extra-special-file "/usr/bin/env"
>   (file-append coreutils "/bin/env"))

Great!  Thanks a lot!

Best Regards,
Huang, Ying



Re: [PATCH -v3] Fix gtk-im-modules for gtk+3

2017-02-06 Thread Huang, Ying
Hi, Wenwu,

iyzs...@member.fsf.org (宋文武) writes:

> "Huang, Ying" <huang_ying_cari...@163.com> writes:
>
>> [...]
>>> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
>>> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
>>> +#$(if gtk+
>>> +  (build
>>> +   gtk+ "3.0.0"
>>> +   #~(string-append
>>> +  #$gtk+:bin "/bin/gtk-query-immodules-3.0"))
>>
>> If "gtk+" is store path instead of package, this doesn't work.  In a
>> previous version, "gtk+" will be store path, it is package now.  If it
>> will always be package in the future.  We can pass the store path of
>> target output too.
>
> Oh, you're right!
>
> We can use the gtk+ package object here:
>
> [attachment]
>
> 0001-profiles-gtk-im-modules-Fix-for-gtk3.patch
>
> From a0b9a36b4e902fd6f456fa596c6220c708c35f71 Mon Sep 17 00:00:00 2001
> From: "huang_ying_cari...@163.com" <huang_ying_cari...@163.com>
> Date: Sun, 5 Feb 2017 13:41:47 +0800
> Subject: [PATCH] profiles: gtk-im-modules: Fix for gtk3.
>
> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be find
> in output "bin" instead of "out".
>
> * guix/profiles.scm (gtk-im-modules): Pass the path of gtk-query-immodules-x.x
> as 'query' argument to the 'build' procedure.
> ---
>  guix/profiles.scm | 26 +++---
>  1 file changed, 19 insertions(+), 7 deletions(-)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index 495a9e2e7..de82eae34 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -739,7 +739,7 @@ for both major versions of GTK+."
>(mlet %store-monad ((gtk+   (manifest-lookup-package manifest "gtk+" "3"))
>(gtk+-2 (manifest-lookup-package manifest "gtk+" "2")))
>  
> -(define (build gtk gtk-version)
> +(define (build gtk gtk-version query)
>(let ((major (string-take gtk-version 1)))
>  (with-imported-modules '((guix build utils)
>   (guix build union)
> @@ -756,8 +756,6 @@ for both major versions of GTK+."
>  
>(let* ((prefix  (string-append "/lib/gtk-" #$major ".0/"
>   #$gtk-version))
> - (query   (string-append #$gtk 
> "/bin/gtk-query-immodules-"
> - #$major ".0"))
>   (destdir (string-append #$output prefix))
>   (moddirs (cons (string-append #$gtk prefix "/immodules")
>  (filter file-exists?
> @@ -768,7 +766,7 @@ for both major versions of GTK+."
>  
>  ;; Generate a new immodules cache file.
>  (mkdir-p (string-append #$output prefix))
> -(let ((pipe(apply open-pipe* OPEN_READ query modules))
> +(let ((pipe(apply open-pipe* OPEN_READ #$query modules))
>(outfile (string-append #$output prefix
>"/immodules-gtk" #$major 
> ".cache")))
>(dynamic-wind
> @@ -783,9 +781,23 @@ for both major versions of GTK+."
>(close-pipe pipe)
>  
>  ;; Don't run the hook when there's nothing to do.
> -(let ((gexp #~(begin
> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
> +(let* ((pkg-gtk+ (module-ref; lazy reference
> +  (resolve-interface '(gnu packages gtk)) 'gtk+))
> +   (gexp #~(begin
> + #$(if gtk+
> +   (build
> +gtk+ "3.0.0"
> +;; Use 'gtk-query-immodules-3.0' from the 'bin'
> +;; output of latest gtk+ package.
> +#~(string-append
> +   #$pkg-gtk+:bin 
> "/bin/gtk-query-immodules-3.0"))
> +   #t)
> + #$(if gtk+-2
> +   (build
> +gtk+-2 "2.10.0"
> +#~(string-append
> +   #$gtk+-2 "/bin/gtk-query-immodules-2.0"))
> +   #t
>(if (or gtk+ gtk+-2)
>(gexp->derivation "gtk-im-modules" gexp
>  #:local-build? #t

This should work.  But I don't think it is perfect.  It may refer to the
gtk-query-immodules-3.0 not with the exact same version.

Best Regards,
Huang, Ying




Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3

2017-02-06 Thread Huang, Ying
Hi, Ricardo,

Ricardo Wurmus <rek...@elephly.net> writes:

> huang_ying_cari...@163.com writes:
>
>> From: Huang Ying <huang.ying.cari...@gmail.com>
>>
>> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be 
>> find
>> in bin output.
>
> Ah, I was wondering why this broke!  Thanks for investigating it.
>
>> The fix works, but appears hacky, because I haven't read much guix source
>> code, so I don't know the best solution.
>
> It’s only hacky because I tried to reuse the code for both versions of
> Gtk.  Maybe “gtk+-2” should also get a “bin” output…?

That sounds reasonable for me.

> This is acceptable with the changes Danny suggested.  Maybe we can find
> a way to make this prettier in the future.

I have sent out -v3 which addressed Danny's comments with the following
subject,

[PATCH -v3] Fix gtk-im-modules for gtk+3

> Thanks again for taking the time to investigate and fix it, and to
> submit a patch!  I’m very grateful for this contribution.

You are welcome!

Best Regards,
Huang, Ying

> --
> Ricardo
>
> GPG: BCA6 89B6 3655 3801 C3C6  2150 197A 5888 235F ACAC
> https://elephly.net




Re: [PATCH] gnu: font-gnu-unifont: Call mkfontdir for pcf output

2017-02-05 Thread Huang, Ying
"Huang, Ying" <huang_ying_cari...@163.com> writes:

> Hi, Wenwu,
>
> Thanks for comments!
>
> iyzs...@member.fsf.org (宋文武) writes:
>
>> huang_ying_cari...@163.com writes:
>>
>>> * gnu/packages/fonts.scm (font-gnu-unifont): call mkfontdir for pcf output.
>>>
>>> Signed-off-by: "Huang, Ying" <huang.ying.cari...@gmail.com>
>>> ---
>>>  gnu/packages/fonts.scm | 4 +++-
>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
>>> index 1f6d1d0c3..088a6bec9 100644
>>> --- a/gnu/packages/fonts.scm
>>> +++ b/gnu/packages/fonts.scm
>>> @@ -671,13 +671,15 @@ languages, plus Greek and Cyrillic.")
>>> (string-append "PCFDEST=" pcf)
>>> (string-append "CONSOLEDEST=" psf)
>>> "install")
>>> +  (system* "mkfontdir" pcf)
>>
>> This will create 'share/fonts/misc/fonts.dir' in the 'pcf' output of
>> font-gnu-unifont package.  When multiple packages have this file,
>> collisions occour and then I guess it won't work as expected.
>
> I think so too.
>
>> The right
>> place to create this file is the 'fonts-dir-file' hook in profiles.scm,
>> currently it does 'mkfontscale' and 'mkfontdir' only for truetype fonts
>> under 'share/fonts/truetype', which can be extended for each directory
>> under 'share/fonts'.  What do you think?
>
> I think that is better.  I have thought about that before.  But I didn't
> know whether that is necessary in general at that time.

One problem of this solution is that some font packages (for example,
fonts-misc-misc) already have fonts.dir, to avoid conflict, it is better
to remove fonts.dir in all font packages and generate fonts.dir in
fonts-dir-file,  I think that is good.  But I don't know whether others
think that is a good idea.

Best Regards,
Huang, Ying





Re: [PATCH] gnu: font-gnu-unifont: Call mkfontdir for pcf output

2017-02-05 Thread Huang, Ying
Hi, Wenwu,

Thanks for comments!

iyzs...@member.fsf.org (宋文武) writes:

> huang_ying_cari...@163.com writes:
>
>> * gnu/packages/fonts.scm (font-gnu-unifont): call mkfontdir for pcf output.
>>
>> Signed-off-by: "Huang, Ying" <huang.ying.cari...@gmail.com>
>> ---
>>  gnu/packages/fonts.scm | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/gnu/packages/fonts.scm b/gnu/packages/fonts.scm
>> index 1f6d1d0c3..088a6bec9 100644
>> --- a/gnu/packages/fonts.scm
>> +++ b/gnu/packages/fonts.scm
>> @@ -671,13 +671,15 @@ languages, plus Greek and Cyrillic.")
>> (string-append "PCFDEST=" pcf)
>> (string-append "CONSOLEDEST=" psf)
>> "install")
>> +  (system* "mkfontdir" pcf)
>
> This will create 'share/fonts/misc/fonts.dir' in the 'pcf' output of
> font-gnu-unifont package.  When multiple packages have this file,
> collisions occour and then I guess it won't work as expected.

I think so too.

> The right
> place to create this file is the 'fonts-dir-file' hook in profiles.scm,
> currently it does 'mkfontscale' and 'mkfontdir' only for truetype fonts
> under 'share/fonts/truetype', which can be extended for each directory
> under 'share/fonts'.  What do you think?

I think that is better.  I have thought about that before.  But I didn't
know whether that is necessary in general at that time.

Best Regards,
Huang, Ying




Re: [PATCH -v3] Fix gtk-im-modules for gtk+3

2017-02-05 Thread Huang, Ying
Hi, Wenwu,

Thanks for comments.

iyzs...@member.fsf.org (宋文武) writes:

> huang_ying_cari...@163.com writes:
>
>> From: "Huang, Ying" <huang.ying.cari...@gmail.com>
>>
>> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be 
>> find
>> in output "bin" instead of "out".
>>
>> * guix/profiles.scm (manifest-lookup-package): New argument output to select
>>   package or store path.
>>   (gtk-im-modules): Use "bin" output to find gtk-query-immodules-3.0
>>
>> The fix works, but appears hacky, because I haven't read much guix source
>> code, so I don't know the best solution.
>>
>
> Thank you!  The patch looks good to me, but:
>
> I think we can split this into 2 patches, one for adding output
> selecting to 'manifest-lookup-package' and another for fixing
> 'gtk-im-modules'.

OK for me.  If no others have objection, I will split the patch.

> And to fix 'gtk-im-modules', we can pass the path of current
> 'gtk-query-modules-x.x' instead of the one in profile to the build
> procedure, so users don't need to install gtk+:bin explicitly (but it
> always pull in the dependency of latest gtk+:bin).  This may or may not
> be the desired behavior...

Yes.  It is better not to force gtk+:bin to be installed into profile.

> Here is what I mean:
>
> [attachment]
>
> 0001-profiles-gtk-im-modules-Fix-for-gtk3.patch
>
> From 54a9b4de63f87084984a1632800a039b155592f0 Mon Sep 17 00:00:00 2001
> From: "huang_ying_cari...@163.com" <huang_ying_cari...@163.com>
> Date: Sun, 5 Feb 2017 13:41:47 +0800
> Subject: [PATCH] profiles: gtk-im-modules: Fix for gtk3.
>
> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be find
> in output "bin" instead of "out".
>
> * guix/profiles.scm (gtk-im-modules): Pass the path of gtk-query-immodules-x.x
> as 'query' argument to the 'build' procedure.
> ---
>  guix/profiles.scm | 20 ++--
>  1 file changed, 14 insertions(+), 6 deletions(-)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index 495a9e2e7..cb93b8b67 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -739,7 +739,7 @@ for both major versions of GTK+."
>(mlet %store-monad ((gtk+   (manifest-lookup-package manifest "gtk+" "3"))
>(gtk+-2 (manifest-lookup-package manifest "gtk+" "2")))
>  
> -(define (build gtk gtk-version)
> +(define (build gtk gtk-version query)
>(let ((major (string-take gtk-version 1)))
>  (with-imported-modules '((guix build utils)
>   (guix build union)
> @@ -756,8 +756,6 @@ for both major versions of GTK+."
>  
>(let* ((prefix  (string-append "/lib/gtk-" #$major ".0/"
>   #$gtk-version))
> - (query   (string-append #$gtk 
> "/bin/gtk-query-immodules-"
> - #$major ".0"))
>   (destdir (string-append #$output prefix))
>   (moddirs (cons (string-append #$gtk prefix "/immodules")
>  (filter file-exists?
> @@ -768,7 +766,7 @@ for both major versions of GTK+."
>  
>  ;; Generate a new immodules cache file.
>  (mkdir-p (string-append #$output prefix))
> -(let ((pipe(apply open-pipe* OPEN_READ query modules))
> +(let ((pipe(apply open-pipe* OPEN_READ #$query modules))
>(outfile (string-append #$output prefix
>"/immodules-gtk" #$major 
> ".cache")))
>(dynamic-wind
> @@ -784,8 +782,18 @@ for both major versions of GTK+."
>  
>  ;; Don't run the hook when there's nothing to do.
>  (let ((gexp #~(begin
> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
> +#$(if gtk+
> +  (build
> +   gtk+ "3.0.0"
> +   #~(string-append
> +  #$gtk+:bin "/bin/gtk-query-immodules-3.0"))

If "gtk+" is store path instead of package, this doesn't work.  In a
previous version, "gtk+" will be store path, it is package now.  If it
will always be package in the future.  We can pass the store path of
target output too.

Best Regards,
Huang, Ying

> +  #t)
> +#$(if gtk+-2
> +  (build
> +   gtk+-2 "2.10.0"
> +   #~(string-append
> +  #$gtk+-2 "/bin/gtk-query-immodules-2.0"))
> +  #t
>(if (or gtk+ gtk+-2)
>(gexp->derivation "gtk-im-modules" gexp
>  #:local-build? #t




Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3

2017-02-04 Thread Huang, Ying
Hi, Danny,

Thanks for comments!

Danny Milosavljevic <dan...@scratchpost.org> writes:

> Hi,
>
> On Mon, 30 Jan 2017 11:06:49 +0800
> huang_ying_cari...@163.com wrote:
>
>> -(define* (manifest-lookup-package manifest name #:optional version)
>> +(define* (manifest-lookup-package manifest name #:optional version output)
>>"Return as a monadic value the first package or store path referenced by
>>  MANIFEST that is named NAME and optionally has the given VERSION prefix, or 
>> #f
>>  if not found."
>
> Please update the docstring too.

Sure.

>> + (if output
>> + (string-suffix? output version*)
>>   #t
>
> Should that include the separator between the parts? Otherwise it
> could maybe have false positives...

OK.

Best Regards,
Huang, Ying




Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3

2017-02-03 Thread Huang, Ying
Hi, All,

huang_ying_cari...@163.com writes:

> From: Huang Ying <huang.ying.cari...@gmail.com>
>
> Gtk+3 now have multiple outputs, so the gtk-query-immodules-3.0 should be find
> in bin output.
>
> The fix works, but appears hacky, because I haven't read much guix source
> code, so I don't know the best solution.

I know this fix isn't good, but the problem exists.  Could anyone help
me to fix it properly?  Without the fix, I could not use fcitx input
method.  Because XIM immodule will hang some applications like gedit.

Best Regards,
Huang, Ying

> Signed-off-by: "Huang, Ying" <huang.ying.cari...@gmail.com>
> ---
>  guix/profiles.scm | 15 ++-
>  1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index 495a9e2e7..9ae6dbf09 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -476,7 +476,7 @@ replace it."
>  (cons (gexp-input thing output) deps)))
>(manifest-entries manifest)))
>  
> -(define* (manifest-lookup-package manifest name #:optional version)
> +(define* (manifest-lookup-package manifest name #:optional version output)
>"Return as a monadic value the first package or store path referenced by
>  MANIFEST that is named NAME and optionally has the given VERSION prefix, or 
> #f
>  if not found."
> @@ -499,6 +499,9 @@ if not found."
>  (and (string=? name name*)
>   (if version
>   (string-prefix? version version*)
> + #t)
> + (if output
> + (string-suffix? output version*)
>   #t
>  items))
>  
> @@ -737,9 +740,10 @@ creates the GTK+ 'icon-theme.cache' file for each theme."
>  for both major versions of GTK+."
>  
>(mlet %store-monad ((gtk+   (manifest-lookup-package manifest "gtk+" "3"))
> +  (gtk+-bin (manifest-lookup-package manifest "gtk+" "3" 
> "bin"))
>(gtk+-2 (manifest-lookup-package manifest "gtk+" "2")))
>  
> -(define (build gtk gtk-version)
> +(define (build gtk gtk-version gtk-bin out)
>(let ((major (string-take gtk-version 1)))
>  (with-imported-modules '((guix build utils)
>   (guix build union)
> @@ -756,7 +760,8 @@ for both major versions of GTK+."
>  
>(let* ((prefix  (string-append "/lib/gtk-" #$major ".0/"
>   #$gtk-version))
> - (query   (string-append #$gtk 
> "/bin/gtk-query-immodules-"
> + (query   (string-append (ungexp gtk-bin out)
> + "/bin/gtk-query-immodules-"
>   #$major ".0"))
>   (destdir (string-append #$output prefix))
>   (moddirs (cons (string-append #$gtk prefix "/immodules")
> @@ -784,8 +789,8 @@ for both major versions of GTK+."
>  
>  ;; Don't run the hook when there's nothing to do.
>  (let ((gexp #~(begin
> -#$(if gtk+   (build gtk+   "3.0.0")  #t)
> -#$(if gtk+-2 (build gtk+-2 "2.10.0") #t
> +#$(if gtk+   (build gtk+   "3.0.0"  gtk+-bin "bin")  #t)
> +#$(if gtk+-2 (build gtk+-2 "2.10.0" gtk+-2 "out") #t
>(if (or gtk+ gtk+-2)
>(gexp->derivation "gtk-im-modules" gexp
>  #:local-build? #t