From a706b8be4f54530b1cd12c03a1bf3941be43be3c Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Mon, 5 Jul 2021 20:16:22 +0200 Subject: [PATCH 2/2] profiles: Avoid dependency on 'mkfontdir' and friend when unused. Avoid depending on on "mkfontdir" and "mkfontscale" if they won't actually be used, to avoid building the aforementioned packages when they are updated. * guix/profiles.scm (fonts-dir-file)[build]: Note why the '(null? fonts-dir)' check cannot be removed. (fonts-dir-file): When the 'relevant-inputs' list is empty, just build an empty directory. --- guix/profiles.scm | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 0f9df68f42..6cf480ddf2 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1544,6 +1544,8 @@ files for the fonts of the @var{manifest} entries." "/share/fonts") '#$relevant-inputs)))) (mkdir #$output) + ;; has-fonts? can have false positives, + ;; so this check is necessary. (if (null? fonts-dirs) (exit #t) (let* ((share-dir (string-append #$output "/share")) @@ -1585,15 +1587,20 @@ files for the fonts of the @var{manifest} entries." (delete-file fonts-dir-file)))) directories))))))) - (gexp->derivation "fonts-dir" build - #:modules '((guix build utils) - (guix build union) - (srfi srfi-26)) - #:local-build? #t - #:substitutable? #f - #:properties - `((type . profile-hook) - (hook . fonts-dir)))) + (if (null? relevant-inputs) + ;; Avoid depending on on "mkfontdir" and "mkfontscale" if + ;; they won't actually be used, to avoid building the aforementioned + ;; packages when they are updated. + (lower-object (file-union "fonts-dir" '())) + (gexp->derivation "fonts-dir" build + #:modules '((guix build utils) + (guix build union) + (srfi srfi-26)) + #:local-build? #t + #:substitutable? #f + #:properties + `((type . profile-hook) + (hook . fonts-dir))))) (define (manual-database manifest) "Return a derivation that builds the manual page database (\"mandb\") for -- 2.32.0