diff mbox

[2/5] profiles: gtk-icon-themes: Use 'gtk-update-icon-cache' from 'gtk+:bin'.

Message ID 20160806104616.13089-2-iyzsong@gmail.com
State New
Headers show

Commit Message

宋文武 Aug. 6, 2016, 10:46 a.m. UTC
* guix/profiles.scm (gtk-icon-themes): Use 'gtk-update-icon-cacnhe' from
the "bin" output of gtk+ package.
---
 guix/profiles.scm | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

Comments

Leo Famulari Aug. 14, 2016, 2:17 a.m. UTC | #1
On Sat, Aug 06, 2016 at 06:46:13PM +0800, 宋文武 wrote:
> * guix/profiles.scm (gtk-icon-themes): Use 'gtk-update-icon-cacnhe' from
                                                                 ^
							      cache

I admit I don't understand this patch. I'll let somebody else review it
properly :)
Mark H Weaver Aug. 19, 2016, 7:15 a.m. UTC | #2
宋文武 <iyzsong@gmail.com> writes:

> * guix/profiles.scm (gtk-icon-themes): Use 'gtk-update-icon-cacnhe' from
> the "bin" output of gtk+ package.
> ---
>  guix/profiles.scm | 21 +++++++++++++++------
>  1 file changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/guix/profiles.scm b/guix/profiles.scm
> index db807a8..9c2dbba 100644
> --- a/guix/profiles.scm
> +++ b/guix/profiles.scm
> @@ -642,7 +642,18 @@ MANIFEST.  Single-file bundles are required by programs such as Git and Lynx."
>  (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."
> -  (mlet %store-monad ((gtk+ (manifest-lookup-package manifest "gtk+")))
> +  (define gtk+  ; lazy reference
> +    (module-ref (resolve-interface '(gnu packages gtk)) 'gtk+))
> +
> +  (mlet %store-monad ((%gtk+ (manifest-lookup-package manifest "gtk+"))
> +                      ;; XXX: Can't use gtk-update-icon-cache corresponding
> +                      ;; to the gtk+ referenced by 'manifest'.  Because
> +                      ;; '%gtk+' can be either a package or store path, and
> +                      ;; there's no way to get the "bin" output for the later.
> +                      (gtk-update-icon-cache
> +                       -> #~(string-append #+gtk+:bin
> +                                           "/bin/gtk-update-icon-cache")))

Hmm.  Would this cause 'gtk+' to become a dependency for building any
profile, even if it contains no graphical programs?

      Mark
=?utf-8?B?5a6L5paH5q2m?= Aug. 20, 2016, 2:43 a.m. UTC | #3
Mark H Weaver <mhw@netris.org> writes:

> 宋文武 <iyzsong@gmail.com> writes:
>
>> * guix/profiles.scm (gtk-icon-themes): Use 'gtk-update-icon-cacnhe' from
>> the "bin" output of gtk+ package.
>> ---
>>  guix/profiles.scm | 21 +++++++++++++++------
>>  1 file changed, 15 insertions(+), 6 deletions(-)
>>
>> diff --git a/guix/profiles.scm b/guix/profiles.scm
>> index db807a8..9c2dbba 100644
>> --- a/guix/profiles.scm
>> +++ b/guix/profiles.scm
>> @@ -642,7 +642,18 @@ MANIFEST.  Single-file bundles are required by programs such as Git and Lynx."
>>  (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."
>> -  (mlet %store-monad ((gtk+ (manifest-lookup-package manifest "gtk+")))
>> +  (define gtk+  ; lazy reference
>> +    (module-ref (resolve-interface '(gnu packages gtk)) 'gtk+))
>> +
>> +  (mlet %store-monad ((%gtk+ (manifest-lookup-package manifest "gtk+"))
>> +                      ;; XXX: Can't use gtk-update-icon-cache corresponding
>> +                      ;; to the gtk+ referenced by 'manifest'.  Because
>> +                      ;; '%gtk+' can be either a package or store path, and
>> +                      ;; there's no way to get the "bin" output for the later.
>> +                      (gtk-update-icon-cache
>> +                       -> #~(string-append #+gtk+:bin
>> +                                           "/bin/gtk-update-icon-cache")))
>
> Hmm.  Would this cause 'gtk+' to become a dependency for building any
> profile, even if it contains no graphical programs?

No, it does only run when the profile contains gtk+ (with or without
this patch).  But with this patch, it will use the latest deployed
gtk+:bin instead of the gtk+ referenced by the profile.
Mark H Weaver Aug. 20, 2016, 6:56 p.m. UTC | #4
iyzsong@member.fsf.org (宋文武) writes:

> Mark H Weaver <mhw@netris.org> writes:
>
>> Hmm.  Would this cause 'gtk+' to become a dependency for building any
>> profile, even if it contains no graphical programs?
>
> No, it does only run when the profile contains gtk+ (with or without
> this patch).  But with this patch, it will use the latest deployed
> gtk+:bin instead of the gtk+ referenced by the profile.

Okay, sounds good to me.  Thanks!

       Mark
diff mbox

Patch

diff --git a/guix/profiles.scm b/guix/profiles.scm
index db807a8..9c2dbba 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -642,7 +642,18 @@  MANIFEST.  Single-file bundles are required by programs such as Git and Lynx."
 (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."
-  (mlet %store-monad ((gtk+ (manifest-lookup-package manifest "gtk+")))
+  (define gtk+  ; lazy reference
+    (module-ref (resolve-interface '(gnu packages gtk)) 'gtk+))
+
+  (mlet %store-monad ((%gtk+ (manifest-lookup-package manifest "gtk+"))
+                      ;; XXX: Can't use gtk-update-icon-cache corresponding
+                      ;; to the gtk+ referenced by 'manifest'.  Because
+                      ;; '%gtk+' can be either a package or store path, and
+                      ;; there's no way to get the "bin" output for the later.
+                      (gtk-update-icon-cache
+                       -> #~(string-append #+gtk+:bin
+                                           "/bin/gtk-update-icon-cache")))
+
     (define build
       (with-imported-modules '((guix build utils)
                                (guix build union)
@@ -659,9 +670,7 @@  creates the GTK+ 'icon-theme.cache' file for each theme."
             (let* ((destdir  (string-append #$output "/share/icons"))
                    (icondirs (filter file-exists?
                                      (map (cut string-append <> "/share/icons")
-                                          '#$(manifest-inputs manifest))))
-                   (update-icon-cache (string-append
-                                       #+gtk+ "/bin/gtk-update-icon-cache")))
+                                          '#$(manifest-inputs manifest)))))
 
               ;; Union all the icons.
               (mkdir-p (string-append #$output "/share"))
@@ -676,11 +685,11 @@  creates the GTK+ 'icon-theme.cache' file for each theme."
                    ;; "abiword_48.png".  Ignore these.
                    (when (file-is-directory? dir)
                      (ensure-writable-directory dir)
-                     (system* update-icon-cache "-t" dir "--quiet"))))
+                     (system* #+gtk-update-icon-cache "-t" dir "--quiet"))))
                (scandir destdir (negate (cut member <> '("." "..")))))))))
 
     ;; Don't run the hook when there's nothing to do.
-    (if gtk+
+    (if %gtk+
         (gexp->derivation "gtk-icon-themes" build
                           #:local-build? #t
                           #:substitutable? #f)