From patchwork Sun Jan 12 15:43:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 19759 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DB37F17A83; Sun, 12 Jan 2020 15:45:12 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,RCVD_NUMERIC_HELO, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 85D28179CA for ; Sun, 12 Jan 2020 15:45:12 +0000 (GMT) Received: from localhost ([::1]:39072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqfQN-0000hI-Ui for patchwork@mira.cbaines.net; Sun, 12 Jan 2020 10:45:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:36517) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqfQG-0000gz-8m for guix-patches@gnu.org; Sun, 12 Jan 2020 10:45:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iqfQE-00018r-Rd for guix-patches@gnu.org; Sun, 12 Jan 2020 10:45:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51845) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iqfQE-00015Z-M9 for guix-patches@gnu.org; Sun, 12 Jan 2020 10:45:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iqfQE-00006D-A2 for guix-patches@gnu.org; Sun, 12 Jan 2020 10:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39102] [PATCH 1/2] gnu: xdg-utils: Don't use propagated inputs. Resent-From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Jan 2020 15:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39102 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39102@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.157884385532740 (code B ref -1); Sun, 12 Jan 2020 15:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 12 Jan 2020 15:44:15 +0000 Received: from localhost ([127.0.0.1]:57817 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqfPO-0008Vv-0k for submit@debbugs.gnu.org; Sun, 12 Jan 2020 10:44:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:58541) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqfPM-0008Vn-9J for submit@debbugs.gnu.org; Sun, 12 Jan 2020 10:44:08 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33557) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqfPK-0000Rj-SN for guix-patches@gnu.org; Sun, 12 Jan 2020 10:44:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iqfPJ-0004oz-7C for guix-patches@gnu.org; Sun, 12 Jan 2020 10:44:06 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:47086) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iqfPI-00044N-SQ for guix-patches@gnu.org; Sun, 12 Jan 2020 10:44:05 -0500 Received: (qmail 17091 invoked by uid 1009); 12 Jan 2020 16:43:55 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25691. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.008612 secs); 12 Jan 2020 15:43:55 -0000 Received: from unknown (HELO zdrowyportier.kadziolka.net) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 12 Jan 2020 16:43:55 +0100 Date: Sun, 12 Jan 2020 16:43:53 +0100 From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Message-ID: <20200112154353.3xfdivef3fewlqx4@zdrowyportier.kadziolka.net> MIME-Version: 1.0 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/freedesktop.scm (xdg-utils) [propagated-inputs, inputs]: Add awk, coreutils, grep, inetutils and sed; make the dependencies not propagated. [arguments](patch-hardcoded-paths): Move to after 'install to make wrap-program function correctly. Wrap the installed programs. --- gnu/packages/freedesktop.scm | 43 +++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/gnu/packages/freedesktop.scm b/gnu/packages/freedesktop.scm index 7066685dee..06006ed53d 100644 --- a/gnu/packages/freedesktop.scm +++ b/gnu/packages/freedesktop.scm @@ -16,6 +16,7 @@ ;;; Copyright © 2018 Stefan Stefanović ;;; Copyright © 2019 Reza Alizadeh Majd ;;; Copyright © 2019 Guillaume Le Vaillant +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -47,6 +48,7 @@ #:use-module (gnu packages acl) #:use-module (gnu packages admin) #:use-module (gnu packages autotools) + #:use-module (gnu packages base) #:use-module (gnu packages bash) #:use-module (gnu packages boost) #:use-module (gnu packages check) @@ -55,6 +57,7 @@ #:use-module (gnu packages disk) #:use-module (gnu packages docbook) #:use-module (gnu packages documentation) + #:use-module (gnu packages gawk) #:use-module (gnu packages gettext) #:use-module (gnu packages ghostscript) #:use-module (gnu packages gl) @@ -107,20 +110,40 @@ ("libxslt" ,libxslt) ("w3m" ,w3m) ("xmlto" ,xmlto))) - (propagated-inputs - `(("perl-file-mimeinfo" ,perl-file-mimeinfo) ; for mimeopen fallback - ("xprop" ,xprop) ; for Xfce detecting - ("xset" ,xset))) ; for xdg-screensaver + (inputs + `(("PATH:awk" ,gawk) + ("PATH:coreutils" ,coreutils) + ("PATH:grep" ,grep) + ("PATH:inetutils" ,inetutils) ; xdg-screensaver uses `hostname' + ("PATH:perl-file-mimeinfo" ,perl-file-mimeinfo) ; for mimeopen fallback + ("PATH:sed" ,sed) + ("PATH:xprop" ,xprop) ; for Xfce detecting + ("PATH:xset" ,xset))) ; for xdg-screensaver (arguments `(#:tests? #f ; no check target #:phases (modify-phases %standard-phases - (add-after 'unpack 'patch-hardcoded-paths - (lambda _ - (substitute* "scripts/xdg-mime.in" - (("/usr/bin/file") (which "file"))) - (substitute* "scripts/xdg-open.in" - (("/usr/bin/printf") (which "printf"))) + (add-after 'install 'patch-hardcoded-paths + (lambda* (#:key inputs outputs #:allow-other-keys) + (with-directory-excursion (string-append (assoc-ref outputs "out") + "/bin") + (substitute* "xdg-mime" + (("/usr/bin/file") (which "file"))) + (substitute* "xdg-open" + (("/usr/bin/printf") (which "printf"))) + (let ((path-ext + (map (lambda (package) + (string-append package "/bin")) + (cons (assoc-ref outputs "out") + (map cdr + (filter (lambda (package) + (string-prefix? "PATH:" (car package))) + inputs)))))) + (for-each + (lambda (script) + (wrap-program script + `("PATH" ":" prefix ,path-ext))) + (find-files ".")))) #t)) (add-before 'build 'locate-catalog-files (lambda* (#:key inputs #:allow-other-keys) From patchwork Sun Jan 12 15:47:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Maja_K=C4=85dzio=C5=82ka?= X-Patchwork-Id: 19760 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id BFD3017A83; Sun, 12 Jan 2020 15:48:13 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-0.7 required=5.0 tests=BAYES_00,RCVD_NUMERIC_HELO, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 64DB9179CA for ; Sun, 12 Jan 2020 15:48:13 +0000 (GMT) Received: from localhost ([::1]:39100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqfTI-0001lB-SH for patchwork@mira.cbaines.net; Sun, 12 Jan 2020 10:48:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44839) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iqfTA-0001jf-7g for guix-patches@gnu.org; Sun, 12 Jan 2020 10:48:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iqfT8-0005f3-L7 for guix-patches@gnu.org; Sun, 12 Jan 2020 10:48:04 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:51853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iqfT8-0005df-FO for guix-patches@gnu.org; Sun, 12 Jan 2020 10:48:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iqfT8-0000BT-Du for guix-patches@gnu.org; Sun, 12 Jan 2020 10:48:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#39102] [PATCH 2/2 staging] gnu: qtbase: Open links properly without xdg-utils in profile References: <20200112154353.3xfdivef3fewlqx4@zdrowyportier.kadziolka.net> In-Reply-To: <20200112154353.3xfdivef3fewlqx4@zdrowyportier.kadziolka.net> Resent-From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 Jan 2020 15:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39102 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39102@debbugs.gnu.org Received: via spool by 39102-submit@debbugs.gnu.org id=B39102.1578844062678 (code B ref 39102); Sun, 12 Jan 2020 15:48:02 +0000 Received: (at 39102) by debbugs.gnu.org; 12 Jan 2020 15:47:42 +0000 Received: from localhost ([127.0.0.1]:57826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqfSo-0000As-73 for submit@debbugs.gnu.org; Sun, 12 Jan 2020 10:47:42 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:59836) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iqfSl-0000Aj-Bv for 39102@debbugs.gnu.org; Sun, 12 Jan 2020 10:47:40 -0500 Received: (qmail 19568 invoked by uid 1009); 12 Jan 2020 16:47:37 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25691. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 27.137554 secs); 12 Jan 2020 15:47:37 -0000 Received: from unknown (HELO zdrowyportier.kadziolka.net) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 12 Jan 2020 16:47:10 +0100 Date: Sun, 12 Jan 2020 16:47:09 +0100 From: Jakub =?utf-8?b?S8SFZHppb8WCa2E=?= Message-ID: <20200112154709.fhxirioephom3zvc@zdrowyportier.kadziolka.net> MIME-Version: 1.0 Content-Disposition: inline X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/patches/qtbase-use-xdg-open-in-store.patch: New file. * gnu/packages/qt.scm (qtbase)[source][patches]: Apply the patch. [inputs]: Add a dependency on xdg-utils to get its store path. [arguments]: Add a new phase to patch the path into the source code. --- .../qtbase-use-xdg-open-in-store.patch | 103 ++++++++++++++++++ gnu/packages/qt.scm | 10 +- 2 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/qtbase-use-xdg-open-in-store.patch diff --git a/gnu/packages/patches/qtbase-use-xdg-open-in-store.patch b/gnu/packages/patches/qtbase-use-xdg-open-in-store.patch new file mode 100644 index 0000000000..505fff13c2 --- /dev/null +++ b/gnu/packages/patches/qtbase-use-xdg-open-in-store.patch @@ -0,0 +1,103 @@ +To make Qt respect the user's settings for the preferred browser, use xdg-open +even if it is not installed in the profile. The patch makes Qt always use +xdg-open, and makes the path used easy to substitute when building. +======================================================================== +--- qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices.cpp 2020-01-01 20:47:16.775671802 +0100 ++++ qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices.cpp 2020-01-01 20:56:22.167662035 +0100 +@@ -117,47 +117,6 @@ + return QByteArrayLiteral("UNKNOWN"); + } + +-static inline bool checkExecutable(const QString &candidate, QString *result) +-{ +- *result = QStandardPaths::findExecutable(candidate); +- return !result->isEmpty(); +-} +- +-static inline bool detectWebBrowser(const QByteArray &desktop, +- bool checkBrowserVariable, +- QString *browser) +-{ +- const char *browsers[] = {"google-chrome", "firefox", "mozilla", "opera"}; +- +- browser->clear(); +- if (checkExecutable(QStringLiteral("xdg-open"), browser)) +- return true; +- +- if (checkBrowserVariable) { +- QByteArray browserVariable = qgetenv("DEFAULT_BROWSER"); +- if (browserVariable.isEmpty()) +- browserVariable = qgetenv("BROWSER"); +- if (!browserVariable.isEmpty() && checkExecutable(QString::fromLocal8Bit(browserVariable), browser)) +- return true; +- } +- +- if (desktop == QByteArray("KDE")) { +- // Konqueror launcher +- if (checkExecutable(QStringLiteral("kfmclient"), browser)) { +- browser->append(QLatin1String(" exec")); +- return true; +- } +- } else if (desktop == QByteArray("GNOME")) { +- if (checkExecutable(QStringLiteral("gnome-open"), browser)) +- return true; +- } +- +- for (size_t i = 0; i < sizeof(browsers)/sizeof(char *); ++i) +- if (checkExecutable(QLatin1String(browsers[i]), browser)) +- return true; +- return false; +-} +- + static inline bool launch(const QString &launcher, const QUrl &url) + { + const QString command = launcher + QLatin1Char(' ') + QLatin1String(url.toEncoded()); +@@ -297,6 +256,8 @@ + return result; + } + ++static QString xdg_open = QStringLiteral("@@GUIX:XDG-OPEN@@"); ++ + bool QGenericUnixServices::openUrl(const QUrl &url) + { + if (url.scheme() == QLatin1String("mailto")) { +@@ -320,11 +281,7 @@ + } + #endif + +- if (m_webBrowser.isEmpty() && !detectWebBrowser(desktopEnvironment(), true, &m_webBrowser)) { +- qWarning("Unable to detect a web browser to launch '%s'", qPrintable(url.toString())); +- return false; +- } +- return launch(m_webBrowser, url); ++ return launch(xdg_open, url); + } + + bool QGenericUnixServices::openDocument(const QUrl &url) +@@ -337,11 +294,7 @@ + } + #endif + +- if (m_documentLauncher.isEmpty() && !detectWebBrowser(desktopEnvironment(), false, &m_documentLauncher)) { +- qWarning("Unable to detect a launcher for '%s'", qPrintable(url.toString())); +- return false; +- } +- return launch(m_documentLauncher, url); ++ return launch(xdg_open, url); + } + + #else +diff -ur qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices_p.h qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices_p.h +--- qtbase-everywhere-src-5.12.6.orig/src/platformsupport/services/genericunix/qgenericunixservices_p.h 2020-01-01 20:47:16.775671802 +0100 ++++ qtbase-everywhere-src-5.12.6/src/platformsupport/services/genericunix/qgenericunixservices_p.h 2020-01-01 20:54:12.135664364 +0100 +@@ -65,10 +65,6 @@ + + bool openUrl(const QUrl &url) override; + bool openDocument(const QUrl &url) override; +- +-private: +- QString m_webBrowser; +- QString m_documentLauncher; + }; + + QT_END_NAMESPACE diff --git a/gnu/packages/qt.scm b/gnu/packages/qt.scm index 514577678e..0b1d372d8b 100644 --- a/gnu/packages/qt.scm +++ b/gnu/packages/qt.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2019, 2020 Marius Bakke ;;; Copyright © 2018 John Soo ;;; Copyright © 2020 Mike Rosset +;;; Copyright © 2020 Jakub Kądziołka ;;; ;;; This file is part of GNU Guix. ;;; @@ -349,7 +350,8 @@ developers using C++ or QML, a CSS & JavaScript like language.") (base32 "09wz7zs1x5mpgs2y4xnl2zv3naqls4sz6v2arwl1fz2dsx4jddba")) ;; Use TZDIR to avoid depending on package "tzdata". - (patches (search-patches "qtbase-use-TZDIR.patch")) + (patches (search-patches "qtbase-use-TZDIR.patch" + "qtbase-use-xdg-open-in-store.patch")) (modules '((guix build utils))) (snippet ;; corelib uses bundled harfbuzz, md4, md5, sha3 @@ -407,6 +409,7 @@ developers using C++ or QML, a CSS & JavaScript like language.") ("xcb-util-keysyms" ,xcb-util-keysyms) ("xcb-util-renderutil" ,xcb-util-renderutil) ("xcb-util-wm" ,xcb-util-wm) + ("xdg-utils" ,xdg-utils) ("zlib" ,zlib))) (native-inputs `(("bison" ,bison) @@ -428,6 +431,11 @@ developers using C++ or QML, a CSS & JavaScript like language.") "qmake/library/qmakebuiltins.cpp") (("/bin/sh") (which "sh"))) #t)) + (add-after 'configure 'patch-xdg-open + (lambda _ + (substitute* '("src/platformsupport/services/genericunix/qgenericunixservices.cpp") + (("@@GUIX:XDG-OPEN@@") (which "xdg-open"))) + #t)) (replace 'configure (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out")))