[PATCH] profiles: Add hook to generate "gschemas.compiled".

  • Done
  • quality assurance status badge
Details
3 participants
  • Danny Milosavljevic
  • ???
  • Ludovic Courtès
Owner
unassigned
Submitted by
Danny Milosavljevic
Severity
normal
D
D
Danny Milosavljevic wrote on 15 May 2018 14:49
(address . guix-patches@gnu.org)(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
20180515124917.1751-1-dannym@scratchpost.org
* guix/profiles.scm (glib-schemas): New procedure.
(%default-profile-hooks): Add it.
---
guix/profiles.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

Toggle diff (70 lines)
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
L
L
Ludovic Courtès wrote on 17 May 2018 10:57
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
87bmde4q2m.fsf@gnu.org
Hello!

Danny Milosavljevic <dannym@scratchpost.org> skribis:

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

[...]

Toggle quote (9 lines)
> + (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’.
?
(name . Ludovic Courtès)(address . ludo@gnu.org)
874lj6pkdf.fsf@member.fsf.org
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (23 lines)
> 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...
L
L
Ludovic Courtès wrote on 17 May 2018 17:56
(name . ???)(address . iyzsong@member.fsf.org)
87k1s2xol9.fsf@gnu.org
Hey,

iyzsong@member.fsf.org (???) skribis:

Toggle quote (30 lines)
> 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’.
?
(name . Ludovic Courtès)(address . ludo@gnu.org)
87o9hcxnzy.fsf@member.fsf.org
ludo@gnu.org (Ludovic Courtès) writes:

Toggle quote (39 lines)
> 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.
L
L
Ludovic Courtès wrote on 20 May 2018 22:32
(name . ???)(address . iyzsong@member.fsf.org)
874lj2nk3r.fsf@gnu.org
iyzsong@member.fsf.org (???) skribis:

Toggle quote (45 lines)
> 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’.
D
D
Danny Milosavljevic wrote on 21 May 2018 09:57
(no subject)
(address . control@debbugs.gnu.org)
20180521095718.7ed3a042@scratchpost.org
close 31462
L
L
Ludovic Courtès wrote on 25 May 2018 11:16
Re: [bug#31462] [PATCH] profiles: Add hook to generate "gschemas.compiled".
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
8736yg5c41.fsf@gnu.org
Hi Danny,

Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (3 lines)
> * 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

Thanks,
Ludo’.
?