unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: "Jakub Kądziołka" <kuba@kadziolka.net>
Cc: 42547@debbugs.gnu.org
Subject: [bug#42547] [PATCH] build-system/qt: Don't include useless inputs in wrapped variables.
Date: Sat, 19 Sep 2020 22:36:27 +0200	[thread overview]
Message-ID: <87imc9pkqc.fsf@gnu.org> (raw)
In-Reply-To: <20200726122234.6593-1-kuba@kadziolka.net> ("Jakub Kądziołka"'s message of "Sun, 26 Jul 2020 14:22:34 +0200")

Hi Jakub,

Jakub Kądziołka <kuba@kadziolka.net> skribis:

> * guix/build-system/qt.scm (qt-build)[qt-wrap-excluded-inputs]: New argument.
> * guix/build/qt-build-system.scm (variables-for-wrapping): Take the
>   output directory as an argument for special handling. Check for
>   subdirectories of /share used by Qt before including inputs in
>   XDG_DATA_DIRS.
>   (wrap-all-programs): Pass the output directory to variables-for-wrapping.
>   (wrap-all-programs)[qt-wrap-excluded-inputs]: New argument.

This sounds like a good idea.

Do you know what impact this has on the closure size of packages you
looked at?

There are quite a few packages using ‘qt-build-system’.  Probably a
change for ‘staging’ or ‘core-updates’?

> +(define (variables-for-wrapping base-directories output-directory)
>  
> -  (define (collect-sub-dirs base-directories subdirectory)
> +  (define (collect-sub-dirs base-directories subdir-spec)
>      (filter-map
>       (lambda (dir)
> -       (let ((directory (string-append dir subdirectory)))
> -         (if (directory-exists? directory) directory #f)))
> +       (and
> +         (match subdir-spec
> +           ((subdir) (directory-exists? (string-append dir subdir)))
> +           ((subdir children)
> +            (or
> +              (or-map
> +                (lambda (child)
> +                  (directory-exists? (string-append dir subdir child)))
> +                children)
> +              (and (eq? dir output-directory)
> +                   (directory-exists? (string-append dir subdir))))))
> +         (string-append dir (car subdir-spec))))
>       base-directories))

I’d move ‘match’ around ‘and’ to avoid ‘car’ on the next-to-last line.

(eq? dir output-directory) should probably be (string=? dir
output-directory).  (‘eq?’ is pointer equality.)

I’m also not a fan of ‘or-map’.

>    (filter
>     (lambda (var-to-wrap) (not (null? (last var-to-wrap))))
>     (map
> -    (lambda (var-spec)
> -      `(,(first var-spec) = ,(collect-sub-dirs base-directories (last var-spec))))
> +    (match-lambda
> +      ((var . subdir-spec)
> +       `(,var = ,(collect-sub-dirs base-directories subdir-spec))))
>      (list
>       ;; these shall match the search-path-specification for Qt and KDE
>       ;; libraries
> -     '("XDG_DATA_DIRS" "/share")
> +     '("XDG_DATA_DIRS" "/share" ("/applications" "/fonts" "/icons" "/mime"))

So the goal here is to refine what goes to XDG_DATA_DIRS, is that
correct?

Perhaps this should be separate from the patch that removes qttools from
the PATH of wrapped programs?

>  (define* (wrap-all-programs #:key inputs outputs
> +                            (qt-wrap-excluded-inputs '("qttools"))
>                              (qt-wrap-excluded-outputs '())
>                              #:allow-other-keys)
>    "Implement phase \"qt-wrap\": look for GSettings schemas and
> @@ -90,10 +106,13 @@ add a dependency of that output on Qt."
>             (string-append directory "/lib/libexec"))))
>  
>    (define input-directories
> -    ;; FIXME: Filter out unwanted inputs, e.g. cmake
> -    (match inputs
> -           (((_ . dir) ...)
> -            dir)))
> +    (filter-map
> +      (match-lambda
> +        ((name . dir)
> +         (if (member name qt-wrap-excluded-inputs)
> +           #f
> +           dir)))
> +      inputs))

Rather: (filter-map (match-lambda
                      ((label . directory)
                       (and (member label qt-wrap-excluded-inputs)
                            directory)))
                    inputs)

Could you send an updated patch?

Thanks,
Ludo’.




  reply	other threads:[~2020-09-19 20:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 12:22 [bug#42547] [PATCH] build-system/qt: Don't include useless inputs in wrapped variables Jakub Kądziołka
2020-09-19 20:36 ` Ludovic Courtès [this message]
2021-01-11 16:20   ` Hartmut Goebel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87imc9pkqc.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=42547@debbugs.gnu.org \
    --cc=kuba@kadziolka.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).