unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Hartmut Goebel <h.goebel@crazy-compilers.com>
To: 45193@debbugs.gnu.org, 45787@debbugs.gnu.org
Cc: "Jakub Kądziołka" <kuba@kadziolka.net>
Subject: [bug#45787] [PATCH 4/4] guix: qt-utils: Don't include useless inputs in wrapped variables.
Date: Mon, 11 Jan 2021 15:41:44 +0100	[thread overview]
Message-ID: <fc7d711941f76564bed67e76979196abd75836d9.1610376081.git.h.goebel@crazy-compilers.com> (raw)
In-Reply-To: <e8cfff4ab1dd7f0c39875d22057e4ef45a10cc7b.1610376081.git.h.goebel@crazy-compilers.com>

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

Include only those inputs into XDG_DATA_DIRS having
some subdirectory of /share which is typically used by Qt.

* guix/build/qt-utils.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-qt-program*): Pass the output directory to variables-for-wrapping.

Co-authored-by: Hartmut Goebel <h.goebel@crazy-compilers.com>
---
 guix/build/qt-utils.scm | 36 +++++++++++++++++++++++++++---------
 1 file changed, 27 insertions(+), 9 deletions(-)

diff --git a/guix/build/qt-utils.scm b/guix/build/qt-utils.scm
index a03b09f05e..8e6db10ca1 100644
--- a/guix/build/qt-utils.scm
+++ b/guix/build/qt-utils.scm
@@ -30,25 +30,42 @@
 (define %qt-wrap-excluded-inputs
   '(list "cmake" "extra-cmake-modules" "qttools"))
 
-(define (variables-for-wrapping base-directories)
+;; NOTE: Apart from standard subdirectories of /share, Qt also provides
+;; facilities for per-application data directories, such as
+;; /share/quassel. Thus, we include the output directory even if it doesn't
+;; contain any of the standard subdirectories.
+(define (variables-for-wrapping base-directories output-directory)
 
-  (define (collect-sub-dirs base-directories subdirectory)
+  (define (collect-sub-dirs base-directories subdirectory-spec)
     (filter-map
      (lambda (dir)
-       (let ((directory (string-append dir subdirectory)))
-         (if (directory-exists? directory) directory #f)))
+       (match
+        subdirectory-spec
+        ((subdir)
+         (and (directory-exists? (string-append dir subdir))
+              (string-append dir (car subdirectory-spec))))
+        ((subdir children)
+         (and
+          (or
+           (and (string=? dir output-directory)
+                (directory-exists? (string-append dir subdir)))
+           (or-map
+            (lambda (kid) (directory-exists? (string-append dir subdir kid)))
+            children))
+          (string-append dir subdir)))))
      base-directories))
 
   (filter
    (lambda (var-to-wrap) (not (null? (last var-to-wrap))))
    (map
-    (lambda (var-spec)
-      (list (first var-spec) (second var-spec)
-            (collect-sub-dirs base-directories (third var-spec))))
+    (match-lambda
+     ((var kind . subdir-spec)
+      `(,var ,kind ,(collect-sub-dirs base-directories subdir-spec))))
     (list
      ;; these shall match the search-path-specification for Qt and KDE
      ;; libraries
-     '("XDG_DATA_DIRS" suffix "/share")
+     '("XDG_DATA_DIRS" suffix "/share" ("/applications" "/fonts"
+                                        "/icons" "/mime"))
      '("XDG_CONFIG_DIRS" suffix "/etc/xdg")
      '("QT_PLUGIN_PATH" prefix "/lib/qt5/plugins")
      '("QML2_IMPORT_PATH" prefix "/lib/qt5/qml")))))
@@ -66,7 +83,8 @@
      inputs))
 
   (let ((vars-to-wrap (variables-for-wrapping
-                       (cons output-dir input-directories))))
+                       (cons output-dir input-directories)
+                       output-dir)))
     (when (not (null? vars-to-wrap))
       (apply wrap-program program vars-to-wrap))))
 
-- 
2.21.3





  parent reply	other threads:[~2021-01-11 14:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 14:41 [bug#45784] [PATCH 1/4] guix: qt-build-system, qt-utils: Unify wrapping of qt-programs Hartmut Goebel
2021-01-11 14:41 ` bug#45193: [PATCH 2/4] guix: qt-utils: Wrapped executables honor user's envvars Hartmut Goebel
2021-01-11 14:41 ` bug#45193: [PATCH 3/4] build-system: qt: Exclude useless inputs from wrapped variables Hartmut Goebel
2021-01-11 14:41 ` Hartmut Goebel [this message]
     [not found] ` <handler.45784.B.161037615114250.ack@debbugs.gnu.org>
2021-01-29 22:07   ` bug#45784: Acknowledgement ([PATCH 1/4] guix: qt-build-system, qt-utils: Unify wrapping of qt-programs.) 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=fc7d711941f76564bed67e76979196abd75836d9.1610376081.git.h.goebel@crazy-compilers.com \
    --to=h.goebel@crazy-compilers.com \
    --cc=45193@debbugs.gnu.org \
    --cc=45787@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).