all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH -v2] Fix gtk-im-modules for Gtk+3
@ 2017-01-30  3:06 huang_ying_caritas
  2017-02-03 11:21 ` Huang, Ying
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: huang_ying_caritas @ 2017-01-30  3:06 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 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.

Signed-off-by: "Huang, Ying" <huang.ying.caritas@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
-- 
2.11.0

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

* Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3
  2017-01-30  3:06 [PATCH -v2] Fix gtk-im-modules for Gtk+3 huang_ying_caritas
@ 2017-02-03 11:21 ` Huang, Ying
  2017-02-04 17:28 ` Danny Milosavljevic
  2017-02-06  1:08 ` Ricardo Wurmus
  2 siblings, 0 replies; 6+ messages in thread
From: Huang, Ying @ 2017-02-03 11:21 UTC (permalink / raw)
  To: guix-devel

Hi, All,

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

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

* Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3
  2017-01-30  3:06 [PATCH -v2] Fix gtk-im-modules for Gtk+3 huang_ying_caritas
  2017-02-03 11:21 ` Huang, Ying
@ 2017-02-04 17:28 ` Danny Milosavljevic
  2017-02-04 23:42   ` Huang, Ying
  2017-02-06  1:08 ` Ricardo Wurmus
  2 siblings, 1 reply; 6+ messages in thread
From: Danny Milosavljevic @ 2017-02-04 17:28 UTC (permalink / raw)
  To: huang_ying_caritas; +Cc: guix-devel

Hi,

On Mon, 30 Jan 2017 11:06:49 +0800
huang_ying_caritas@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.

> +                     (if output
> +                         (string-suffix? output version*)
>                           #t))))

Should that include the separator between the parts? Otherwise it could maybe have false positives...

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

* Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3
  2017-02-04 17:28 ` Danny Milosavljevic
@ 2017-02-04 23:42   ` Huang, Ying
  0 siblings, 0 replies; 6+ messages in thread
From: Huang, Ying @ 2017-02-04 23:42 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: guix-devel

Hi, Danny,

Thanks for comments!

Danny Milosavljevic <dannym@scratchpost.org> writes:

> Hi,
>
> On Mon, 30 Jan 2017 11:06:49 +0800
> huang_ying_caritas@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

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

* Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3
  2017-01-30  3:06 [PATCH -v2] Fix gtk-im-modules for Gtk+3 huang_ying_caritas
  2017-02-03 11:21 ` Huang, Ying
  2017-02-04 17:28 ` Danny Milosavljevic
@ 2017-02-06  1:08 ` Ricardo Wurmus
  2017-02-06 10:28   ` Huang, Ying
  2 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2017-02-06  1:08 UTC (permalink / raw)
  To: huang_ying_caritas; +Cc: guix-devel


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 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…?

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

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

--
Ricardo

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

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

* Re: [PATCH -v2] Fix gtk-im-modules for Gtk+3
  2017-02-06  1:08 ` Ricardo Wurmus
@ 2017-02-06 10:28   ` Huang, Ying
  0 siblings, 0 replies; 6+ messages in thread
From: Huang, Ying @ 2017-02-06 10:28 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

Hi, Ricardo,

Ricardo Wurmus <rekado@elephly.net> 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 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

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

end of thread, other threads:[~2017-02-06 10:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-30  3:06 [PATCH -v2] Fix gtk-im-modules for Gtk+3 huang_ying_caritas
2017-02-03 11:21 ` Huang, Ying
2017-02-04 17:28 ` Danny Milosavljevic
2017-02-04 23:42   ` Huang, Ying
2017-02-06  1:08 ` Ricardo Wurmus
2017-02-06 10:28   ` 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.