all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH -v3] Fix gtk-im-modules for gtk+3
@ 2017-02-05  5:11 huang_ying_caritas
  2017-02-05  6:39 ` 宋文武
  0 siblings, 1 reply; 7+ messages in thread
From: huang_ying_caritas @ 2017-02-05  5:11 UTC (permalink / raw)
  To: guix-devel

From: "Huang, Ying" <huang.ying.caritas@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.

Signed-off-by: "Huang, Ying" <huang.ying.caritas@gmail.com>
---
 guix/profiles.scm | 22 +++++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index 495a9e2e7..3c32b86ba 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -476,10 +476,10 @@ 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."
+MANIFEST that is named NAME and optionally has the given VERSION prefix and
+OUTPUT, or #f if not found."
   ;; Return as a monadic value the package or store path referenced by the
   ;; manifest ENTRY, or #f if not referenced.
   (define (entry-lookup-package entry)
@@ -489,6 +489,9 @@ if not found."
                    (equal? name (package-name input))
                    (if version
                        (string-prefix? version (package-version input))
+                       #t)
+                   (if output
+                       (member output (package-outputs input))
                        #t)))
             inputs))
     (define (find-among-store-items items)
@@ -499,6 +502,9 @@ if not found."
                 (and (string=? name name*)
                      (if version
                          (string-prefix? version version*)
+                         #t)
+                     (if output
+                         (string-suffix? (string-append "-" output) version*)
                          #t))))
             items))
 
@@ -737,9 +743,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 +763,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 +792,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
-- 
2.11.1

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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-05  5:11 [PATCH -v3] Fix gtk-im-modules for gtk+3 huang_ying_caritas
@ 2017-02-05  6:39 ` 宋文武
  2017-02-05 10:03   ` Huang, Ying
  0 siblings, 1 reply; 7+ messages in thread
From: 宋文武 @ 2017-02-05  6:39 UTC (permalink / raw)
  To: huang_ying_caritas; +Cc: guix-devel

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

huang_ying_caritas@163.com writes:

> From: "Huang, Ying" <huang.ying.caritas@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'.

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

Here is what I mean:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-profiles-gtk-im-modules-Fix-for-gtk3.patch --]
[-- Type: text/x-patch, Size: 3114 bytes --]

From 54a9b4de63f87084984a1632800a039b155592f0 Mon Sep 17 00:00:00 2001
From: "huang_ying_caritas@163.com" <huang_ying_caritas@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"))
+                          #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
-- 
2.11.0


[-- Attachment #3: Type: text/plain, Size: 107 bytes --]


It seems works and doesn't pull in both version of gtk+ when only one is
installed, but I'm not sure :-)


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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-05  6:39 ` 宋文武
@ 2017-02-05 10:03   ` Huang, Ying
  2017-02-06 12:14     ` 宋文武
  0 siblings, 1 reply; 7+ messages in thread
From: Huang, Ying @ 2017-02-05 10:03 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

Hi, Wenwu,

Thanks for comments.

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

> huang_ying_caritas@163.com writes:
>
>> From: "Huang, Ying" <huang.ying.caritas@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_caritas@163.com" <huang_ying_caritas@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

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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-05 10:03   ` Huang, Ying
@ 2017-02-06 12:14     ` 宋文武
  2017-02-06 13:08       ` Huang, Ying
  0 siblings, 1 reply; 7+ messages in thread
From: 宋文武 @ 2017-02-06 12:14 UTC (permalink / raw)
  To: Huang, Ying; +Cc: guix-devel

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

"Huang, Ying" <huang_ying_caritas@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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-profiles-gtk-im-modules-Fix-for-gtk3.patch --]
[-- Type: text/x-patch, Size: 3481 bytes --]

From a0b9a36b4e902fd6f456fa596c6220c708c35f71 Mon Sep 17 00:00:00 2001
From: "huang_ying_caritas@163.com" <huang_ying_caritas@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
-- 
2.11.0


[-- Attachment #3: Type: text/plain, Size: 15 bytes --]


Okay to push?

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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-06 12:14     ` 宋文武
@ 2017-02-06 13:08       ` Huang, Ying
  2017-02-08 12:22         ` 宋文武
  0 siblings, 1 reply; 7+ messages in thread
From: Huang, Ying @ 2017-02-06 13:08 UTC (permalink / raw)
  To: iyzsong; +Cc: guix-devel

Hi, Wenwu,

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

> "Huang, Ying" <huang_ying_caritas@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_caritas@163.com" <huang_ying_caritas@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

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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-06 13:08       ` Huang, Ying
@ 2017-02-08 12:22         ` 宋文武
  2017-02-09  1:20           ` Huang, Ying
  0 siblings, 1 reply; 7+ messages in thread
From: 宋文武 @ 2017-02-08 12:22 UTC (permalink / raw)
  To: Huang, Ying; +Cc: guix-devel

"Huang, Ying" <huang_ying_caritas@163.com> writes:

> Hi, Wenwu,
>
> iyzsong@member.fsf.org (宋文武) writes:
>
>> "Huang, Ying" <huang_ying_caritas@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_caritas@163.com" <huang_ying_caritas@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.

Yes..  but it's acceptable, if we don't require and use gtk+:bin in
profile, then I think the latest gtk+ is the only choice?

Pushed, thank you!

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

* Re: [PATCH -v3] Fix gtk-im-modules for gtk+3
  2017-02-08 12:22         ` 宋文武
@ 2017-02-09  1:20           ` Huang, Ying
  0 siblings, 0 replies; 7+ messages in thread
From: Huang, Ying @ 2017-02-09  1:20 UTC (permalink / raw)
  To: 宋文武; +Cc: guix-devel

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

> "Huang, Ying" <huang_ying_caritas@163.com> writes:
>
>> Hi, Wenwu,
>>
>> iyzsong@member.fsf.org (宋文武) writes:
>>
>>> "Huang, Ying" <huang_ying_caritas@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_caritas@163.com" <huang_ying_caritas@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.
>
> Yes..  but it's acceptable, if we don't require and use gtk+:bin in
> profile, then I think the latest gtk+ is the only choice?

Yes.  I think so.

> Pushed, thank you!

Thanks!

Best Regards,
Huang, Ying

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

end of thread, other threads:[~2017-02-09  1:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-05  5:11 [PATCH -v3] Fix gtk-im-modules for gtk+3 huang_ying_caritas
2017-02-05  6:39 ` 宋文武
2017-02-05 10:03   ` Huang, Ying
2017-02-06 12:14     ` 宋文武
2017-02-06 13:08       ` Huang, Ying
2017-02-08 12:22         ` 宋文武
2017-02-09  1:20           ` Huang, Ying

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.