From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id E4+nELV1HV/bTgAA0tVLHw (envelope-from ) for ; Sun, 26 Jul 2020 12:23:17 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6DksDLV1HV+APgAA1q6Kng (envelope-from ) for ; Sun, 26 Jul 2020 12:23:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 44B839404C7 for ; Sun, 26 Jul 2020 12:23:16 +0000 (UTC) Received: from localhost ([::1]:39608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzfgQ-0002RY-Iv for larch@yhetil.org; Sun, 26 Jul 2020 08:23:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33266) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzfgE-0002RI-MQ for guix-patches@gnu.org; Sun, 26 Jul 2020 08:23:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40336) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jzfgE-00067U-CR for guix-patches@gnu.org; Sun, 26 Jul 2020 08:23:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1jzfgE-0004pX-9P for guix-patches@gnu.org; Sun, 26 Jul 2020 08:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42547] [PATCH] build-system/qt: Don't include useless inputs in wrapped variables. Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 26 Jul 2020 12:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 42547 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 42547@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.159576618118543 (code B ref -1); Sun, 26 Jul 2020 12:23:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Jul 2020 12:23:01 +0000 Received: from localhost ([127.0.0.1]:51882 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jzfg8-0004ov-O2 for submit@debbugs.gnu.org; Sun, 26 Jul 2020 08:23:01 -0400 Received: from lists.gnu.org ([209.51.188.17]:42072) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jzfg6-0004on-Mx for submit@debbugs.gnu.org; Sun, 26 Jul 2020 08:22:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33226) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jzfg6-0002Qg-HO for guix-patches@gnu.org; Sun, 26 Jul 2020 08:22:54 -0400 Received: from pat.zlotemysli.pl ([37.59.186.212]:36588) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jzfg4-00065s-7I for guix-patches@gnu.org; Sun, 26 Jul 2020 08:22:54 -0400 Received: (qmail 25295 invoked by uid 1009); 26 Jul 2020 14:22:43 +0200 Received: from 83.22.51.66.ipv4.supernova.orange.pl (kuba@kadziolka.net@83.22.51.66.ipv4.supernova.orange.pl) by pat.zlotemysli.pl (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25884. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(83.22.51.66):. Processed in 0.013482 secs); 26 Jul 2020 12:22:43 -0000 Received: from 83.22.51.66.ipv4.supernova.orange.pl (HELO localhost.localdomain) (kuba@kadziolka.net@83.22.51.66) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 26 Jul 2020 14:22:43 +0200 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Date: Sun, 26 Jul 2020 14:22:34 +0200 Message-Id: <20200726122234.6593-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=37.59.186.212; envelope-from=kuba@kadziolka.net; helo=pat.zlotemysli.pl X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/26 08:22:43 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -1.0 (-) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: -0.01 X-TUID: faaZnG2cCFdb * 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. --- guix/build-system/qt.scm | 3 +++ guix/build/qt-build-system.scm | 45 ++++++++++++++++++++++++---------- 2 files changed, 35 insertions(+), 13 deletions(-) diff --git a/guix/build-system/qt.scm b/guix/build-system/qt.scm index 118022ec45..3da73e2b58 100644 --- a/guix/build-system/qt.scm +++ b/guix/build-system/qt.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2013 Cyril Roelandt ;;; Copyright © 2017 Ricardo Wurmus ;;; Copyright © 2019 Hartmut Goebel +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -123,6 +124,7 @@ "bin" "sbin")) (phases '(@ (guix build qt-build-system) %standard-phases)) + (qt-wrap-excluded-inputs ''("qttools")) (qt-wrap-excluded-outputs ''()) (system (%current-system)) (imported-modules %qt-build-system-modules) @@ -146,6 +148,7 @@ provides a 'CMakeLists.txt' file as its build system." #:search-paths ',(map search-path-specification->sexp search-paths) #:phases ,phases + #:qt-wrap-excluded-inputs ,qt-wrap-excluded-inputs #:qt-wrap-excluded-outputs ,qt-wrap-excluded-outputs #:configure-flags ,configure-flags #:make-flags ,make-flags diff --git a/guix/build/qt-build-system.scm b/guix/build/qt-build-system.scm index 005157b0a4..1239c9f5fb 100644 --- a/guix/build/qt-build-system.scm +++ b/guix/build/qt-build-system.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2014, 2015 Ludovic Courtès ;;; Copyright © 2018 Mark H Weaver ;;; Copyright © 2019, 2020 Hartmut Goebel +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,29 +48,44 @@ (setenv "CTEST_OUTPUT_ON_FAILURE" "1") #t) -(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 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)) (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")) '("XDG_CONFIG_DIRS" "/etc/xdg") '("QT_PLUGIN_PATH" "/lib/qt5/plugins") '("QML2_IMPORT_PATH" "/lib/qt5/qml"))))) (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)) (define handle-output (match-lambda @@ -101,8 +120,8 @@ add a dependency of that output on Qt." (unless (member output qt-wrap-excluded-outputs) (let ((bin-list (find-files-to-wrap directory)) (vars-to-wrap (variables-for-wrapping - (append (list directory) - input-directories)))) + (cons directory input-directories) + directory))) (when (not (null? vars-to-wrap)) (for-each (cut apply wrap-program <> vars-to-wrap) bin-list))))))) -- 2.27.0