Subject: bug#77251: closed (Re: [bug#77251] [PATCH] guix: gtk-icon-themes: produce only cache in output)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 27 Apr 2025 02:36:02 +0000

Your bug report

#77251: [PATCH] guix: gtk-icon-themes: produce only cache in output

which was filed against the guix-patches package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
77251: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77251
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: [bug#77251] [PATCH] guix: gtk-icon-themes: produce only cache in output
From: 宋文武 <[email-masked]>
To: Rutherther <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Sun, 27 Apr 2025 10:40:22 +0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Rutherther <[email-masked]> writes:

> This patch changes the behavior of gtk-icon-themes to produce only the
> icon-theme.cache cache files, instead of producing the whole union.
> The reason for this is that by producing the whole union, the icons are put to
> the profile twice. This throws off the union build of the profile and symlinks
> all the individual files instead of symlinking folders. This means
> unnecessarily high numbers of symlinks are produced.
>
> * guix/profiles.scm (gtk-icon-themes): Produce only caches

Pushed to master as commit 32575294, with simplified commit message.

Thank you!

Subject: [PATCH] guix: gtk-icon-themes: produce only cache in output
From: Rutherther <[email-masked]>
To: [email-masked]
Cc: Rutherther <[email-masked]>
Date: Tue, 25 Mar 2025 15:36:53 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch changes the behavior of gtk-icon-themes to produce only the
icon-theme.cache cache files, instead of producing the whole union.
The reason for this is that by producing the whole union, the icons are put to
the profile twice. This throws off the union build of the profile and symlinks
all the individual files instead of symlinking folders. This means
unnecessarily high numbers of symlinks are produced.

* guix/profiles.scm (gtk-icon-themes): Produce only caches

Change-Id: Ia452565768753b8a60baf4fc075f6fe5ebb4fa39
---
 guix/profiles.scm | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/guix/profiles.scm b/guix/profiles.scm
index fb4dbc5bd0..2dda574e03 100644
--- a/guix/profiles.scm
+++ b/guix/profiles.scm
@@ -1382,23 +1382,32 @@ (define* (gtk-icon-themes manifest #:optional system)
             (let* ((destdir  (string-append #$output "/share/icons"))
                    (icondirs (filter file-exists?
                                      (map (cut string-append <> "/share/icons")
-                                          '#$(manifest-inputs manifest)))))
+                                          '#$(manifest-inputs manifest))))
+                   (cache-file-name "icon-theme.cache")
+                   (scratchdir (string-append (getcwd) "/icons")))
+
+              (mkdir-p destdir)
 
               ;; Union all the icons.
-              (mkdir-p (string-append #$output "/share"))
-              (union-build destdir icondirs
+              (union-build scratchdir icondirs
                            #:log-port (%make-void-port "w"))
 
               ;; Update the 'icon-theme.cache' file for each icon theme.
               (for-each
                (lambda (theme)
-                 (let ((dir (string-append destdir "/" theme)))
-                   ;; Occasionally DESTDIR contains plain files, such as
+                 (let* ((dir (string-append scratchdir "/" theme))
+                        (cache-file (string-append dir "/" cache-file-name)))
+                   ;; Occasionally SCRATCHDIR contains plain files, such as
                    ;; "abiword_48.png".  Ignore these.
                    (when (file-is-directory? dir)
                      (ensure-writable-directory dir)
-                     (system* #+gtk-update-icon-cache "-t" dir "--quiet"))))
-               (scandir destdir (negate (cut member <> '("." "..")))))))))
+                     (system* #+gtk-update-icon-cache "-t" dir "--quiet")
+                     (when (file-exists? cache-file)
+                       (mkdir-p (string-append destdir "/" theme))
+                       (copy-file
+                        cache-file
+                        (string-append destdir "/" theme "/" cache-file-name))))))
+               (scandir scratchdir (negate (cut member <> '("." "..")))))))))
 
     ;; Don't run the hook when there's nothing to do.
     (if %gtk+

base-commit: fbfd2b93831978aadbb96f32cafdab997b04c6c6
--
2.49.0