unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
@ 2018-05-15 12:49 Danny Milosavljevic
  2018-05-17  8:57 ` Ludovic Courtès
  2018-05-25  9:16 ` Ludovic Courtès
  0 siblings, 2 replies; 7+ messages in thread
From: Danny Milosavljevic @ 2018-05-15 12:49 UTC (permalink / raw)
  To: 31462

* guix/profiles.scm (glib-schemas): New procedure.
(%default-profile-hooks): Add it.
---
 guix/profiles.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index dca247976..300324362 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -843,6 +843,57 @@ MANIFEST.  Single-file bundles are required by programs such as Git and Lynx."
                     #:local-build? #t
                     #:substitutable? #f))
 
+(define (glib-schemas manifest)
+  "Return a derivation that unions all schemas from manifest entries and
+creates the Glib 'gschemas.compiled' file."
+  (define glib  ; lazy reference
+    (module-ref (resolve-interface '(gnu packages glib)) 'glib))
+
+  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
+                      ;; XXX: Can't use glib-compile-schemas corresponding
+                      ;; to the glib referenced by 'manifest'.  Because
+                      ;; '%glib' can be either a package or store path, and
+                      ;; there's no way to get the "bin" output for the later.
+                      (glib-compile-schemas
+                       -> #~(string-append #+glib:bin
+                                           "/bin/glib-compile-schemas")))
+
+    (define build
+      (with-imported-modules '((guix build utils)
+                               (guix build union)
+                               (guix build profiles)
+                               (guix search-paths)
+                               (guix records))
+        #~(begin
+            (use-modules (guix build utils)
+                         (guix build union)
+                         (guix build profiles)
+                         (srfi srfi-26))
+
+            (let* ((destdir  (string-append #$output "/share/glib-2.0/schemas"))
+                   (schemadirs (filter file-exists?
+                                     (map (cut string-append <> "/share/glib-2.0/schemas")
+                                          '#$(manifest-inputs manifest)))))
+
+              ;; Union all the schemas.
+              (mkdir-p (string-append #$output "/share/glib-2.0"))
+              (union-build destdir schemadirs
+                           #:log-port (%make-void-port "w"))
+
+              (let ((dir destdir))
+                 (when (file-is-directory? dir)
+                   (ensure-writable-directory dir)
+                   (invoke #+glib-compile-schemas
+                           (string-append "--targetdir=" dir)
+                           dir)))))))
+
+    ;; Don't run the hook when there's nothing to do.
+    (if %glib
+        (gexp->derivation "glib-schemas" build
+                          #:local-build? #t
+                          #:substitutable? #f)
+        (return #f))))
+
 (define (gtk-icon-themes manifest)
   "Return a derivation that unions all icon themes from manifest entries and
 creates the GTK+ 'icon-theme.cache' file for each theme."
@@ -1198,6 +1249,7 @@ the entries in MANIFEST."
         fonts-dir-file
         ghc-package-cache-file
         ca-certificate-bundle
+        glib-schemas
         gtk-icon-themes
         gtk-im-modules
         xdg-desktop-database

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-15 12:49 [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled" Danny Milosavljevic
@ 2018-05-17  8:57 ` Ludovic Courtès
  2018-05-17 11:55   ` 宋文武
  2018-05-25  9:16 ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2018-05-17  8:57 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 宋文武, 31462

Hello!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * guix/profiles.scm (glib-schemas): New procedure.
> (%default-profile-hooks): Add it.

[...]

> +  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
> +                      ;; XXX: Can't use glib-compile-schemas corresponding
> +                      ;; to the glib referenced by 'manifest'.  Because
> +                      ;; '%glib' can be either a package or store path, and
> +                      ;; there's no way to get the "bin" output for the later.
> +                      (glib-compile-schemas
> +                       -> #~(string-append #+glib:bin
> +                                           "/bin/glib-compile-schemas")))

Oh right, too bad.

宋文武, any comments, since you wrote the existing hooks in that area?

Otherwise LGTM, thank you Danny!

Ludo’.

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-17  8:57 ` Ludovic Courtès
@ 2018-05-17 11:55   ` 宋文武
  2018-05-17 15:56     ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: 宋文武 @ 2018-05-17 11:55 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31462

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

> Hello!
>
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
>> * guix/profiles.scm (glib-schemas): New procedure.
>> (%default-profile-hooks): Add it.
>
> [...]
>
>> +  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
>> +                      ;; XXX: Can't use glib-compile-schemas corresponding
>> +                      ;; to the glib referenced by 'manifest'.  Because
>> +                      ;; '%glib' can be either a package or store path, and
>> +                      ;; there's no way to get the "bin" output for the later.
>> +                      (glib-compile-schemas
>> +                       -> #~(string-append #+glib:bin
>> +                                           "/bin/glib-compile-schemas")))
>
> Oh right, too bad.
>
> 宋文武, any comments, since you wrote the existing hooks in that area?
>

Well, I think this situation is not changed.  Our profile hooks
currently use latest version of zlib, gzip, guile-gdbm-ffi, gtk+, ghc
and etc.  We'd like to use packages from the manifest to avoid
additional downloads, but it's not awlays possible...

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-17 11:55   ` 宋文武
@ 2018-05-17 15:56     ` Ludovic Courtès
  2018-05-19  4:34       ` 宋文武
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2018-05-17 15:56 UTC (permalink / raw)
  To: 宋文武; +Cc: 31462

Hey,

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

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hello!
>>
>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>>
>>> * guix/profiles.scm (glib-schemas): New procedure.
>>> (%default-profile-hooks): Add it.
>>
>> [...]
>>
>>> +  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
>>> +                      ;; XXX: Can't use glib-compile-schemas corresponding
>>> +                      ;; to the glib referenced by 'manifest'.  Because
>>> +                      ;; '%glib' can be either a package or store path, and
>>> +                      ;; there's no way to get the "bin" output for the later.
>>> +                      (glib-compile-schemas
>>> +                       -> #~(string-append #+glib:bin
>>> +                                           "/bin/glib-compile-schemas")))
>>
>> Oh right, too bad.
>>
>> 宋文武, any comments, since you wrote the existing hooks in that area?
>>
>
> Well, I think this situation is not changed.  Our profile hooks
> currently use latest version of zlib, gzip, guile-gdbm-ffi, gtk+, ghc
> and etc.  We'd like to use packages from the manifest to avoid
> additional downloads, but it's not awlays possible...

Right, so that’s not new.

You’re OK with the rest of the patch?

Thanks for your quick reply!

Ludo’.

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-17 15:56     ` Ludovic Courtès
@ 2018-05-19  4:34       ` 宋文武
  2018-05-20 20:32         ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: 宋文武 @ 2018-05-19  4:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 31462

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

> Hey,
>
> iyzsong@member.fsf.org (宋文武) skribis:
>
>> ludo@gnu.org (Ludovic Courtès) writes:
>>
>>> Hello!
>>>
>>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>>>
>>>> * guix/profiles.scm (glib-schemas): New procedure.
>>>> (%default-profile-hooks): Add it.
>>>
>>> [...]
>>>
>>>> +  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
>>>> +                      ;; XXX: Can't use glib-compile-schemas corresponding
>>>> +                      ;; to the glib referenced by 'manifest'.  Because
>>>> +                      ;; '%glib' can be either a package or store path, and
>>>> +                      ;; there's no way to get the "bin" output for the later.
>>>> +                      (glib-compile-schemas
>>>> +                       -> #~(string-append #+glib:bin
>>>> +                                           "/bin/glib-compile-schemas")))
>>>
>>> Oh right, too bad.
>>>
>>> 宋文武, any comments, since you wrote the existing hooks in that area?
>>>
>>
>> Well, I think this situation is not changed.  Our profile hooks
>> currently use latest version of zlib, gzip, guile-gdbm-ffi, gtk+, ghc
>> and etc.  We'd like to use packages from the manifest to avoid
>> additional downloads, but it's not awlays possible...
>
> Right, so that’s not new.
>
> You’re OK with the rest of the patch?
>

Yes, it looks good to me, and it's useful for the 'dconf-editor'
package, which can edit the dconf database with the support from
available gsetting schemas.

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-19  4:34       ` 宋文武
@ 2018-05-20 20:32         ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2018-05-20 20:32 UTC (permalink / raw)
  To: 宋文武; +Cc: 31462

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

> ludo@gnu.org (Ludovic Courtès) writes:
>
>> Hey,
>>
>> iyzsong@member.fsf.org (宋文武) skribis:
>>
>>> ludo@gnu.org (Ludovic Courtès) writes:
>>>
>>>> Hello!
>>>>
>>>> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>>>>
>>>>> * guix/profiles.scm (glib-schemas): New procedure.
>>>>> (%default-profile-hooks): Add it.
>>>>
>>>> [...]
>>>>
>>>>> +  (mlet %store-monad ((%glib (manifest-lookup-package manifest "glib"))
>>>>> +                      ;; XXX: Can't use glib-compile-schemas corresponding
>>>>> +                      ;; to the glib referenced by 'manifest'.  Because
>>>>> +                      ;; '%glib' can be either a package or store path, and
>>>>> +                      ;; there's no way to get the "bin" output for the later.
>>>>> +                      (glib-compile-schemas
>>>>> +                       -> #~(string-append #+glib:bin
>>>>> +                                           "/bin/glib-compile-schemas")))
>>>>
>>>> Oh right, too bad.
>>>>
>>>> 宋文武, any comments, since you wrote the existing hooks in that area?
>>>>
>>>
>>> Well, I think this situation is not changed.  Our profile hooks
>>> currently use latest version of zlib, gzip, guile-gdbm-ffi, gtk+, ghc
>>> and etc.  We'd like to use packages from the manifest to avoid
>>> additional downloads, but it's not awlays possible...
>>
>> Right, so that’s not new.
>>
>> You’re OK with the rest of the patch?
>>
>
> Yes, it looks good to me, and it's useful for the 'dconf-editor'
> package, which can edit the dconf database with the support from
> available gsetting schemas.

Alright, good to know.  So Danny, go ahead!  :-)

Thanks,
Ludo’.

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

* [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
  2018-05-15 12:49 [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled" Danny Milosavljevic
  2018-05-17  8:57 ` Ludovic Courtès
@ 2018-05-25  9:16 ` Ludovic Courtès
  1 sibling, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2018-05-25  9:16 UTC (permalink / raw)
  To: Danny Milosavljevic; +Cc: 31462, 30642

Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

> * guix/profiles.scm (glib-schemas): New procedure.
> (%default-profile-hooks): Add it.

I just tried:

  guix environment --ad-hoc libreoffice -- libreoffice

which at some point shows:

  No schema files found: doing nothing.

and it doesn’t fix the file open dialog crash reported at
<https://bugs.gnu.org/30642>.  Any idea?

Thanks,
Ludo’.

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

end of thread, other threads:[~2018-05-25  9:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-15 12:49 [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled" Danny Milosavljevic
2018-05-17  8:57 ` Ludovic Courtès
2018-05-17 11:55   ` 宋文武
2018-05-17 15:56     ` Ludovic Courtès
2018-05-19  4:34       ` 宋文武
2018-05-20 20:32         ` Ludovic Courtès
2018-05-25  9:16 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).