From patchwork Thu Aug 11 13:21:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?5a6L5paH5q2m?= X-Patchwork-Id: 14489 Received: (qmail 40060 invoked by uid 89); 11 Aug 2016 13:21:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.1 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 spammy=73212, Hx-languages-length:1799 X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-HELO: lists.gnu.org Received: from lists.gnu.org (HELO lists.gnu.org) (208.118.235.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 11 Aug 2016 13:21:46 +0000 Received: from localhost ([::1]:48573 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXpvb-0003a2-Rh for patchwork@sourceware.org; Thu, 11 Aug 2016 09:21:43 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXpvT-0003Xx-Qw for guix-devel@gnu.org; Thu, 11 Aug 2016 09:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXpvP-0001D5-KY for guix-devel@gnu.org; Thu, 11 Aug 2016 09:21:34 -0400 Received: from mail.openmailbox.org ([62.4.1.34]:33446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXpvP-0001Ca-Dx for guix-devel@gnu.org; Thu, 11 Aug 2016 09:21:31 -0400 Received: by mail.openmailbox.org (Postfix, from userid 20002) id 9722B2170B8; Thu, 11 Aug 2016 15:21:27 +0200 (CEST) From: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= To: guix-devel@gnu.org Subject: [PATCH] profiles: xdg-mime-database: Run the hook when have GLib based applications. Date: Thu, 11 Aug 2016 21:21:18 +0800 Message-Id: <20160811132118.30771-1-iyzsong@gmail.com> X-Mailer: git-send-email 2.8.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 62.4.1.34 X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?=E5=AE=8B=E6=96=87=E6=AD=A6?= Errors-To: guix-devel-bounces+patchwork=sourceware.org@gnu.org Sender: "Guix-devel" * guix/profiles.scm (xdg-mime-database): Run the hook when GLIB is referenced by the manifest. Add SHARED-MIME-INFO to the mime packages of `update-mime-database'. --- guix/profiles.scm | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/guix/profiles.scm b/guix/profiles.scm index 9c2dbba..169c700 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -732,9 +732,12 @@ MIME type." (define (xdg-mime-database manifest) "Return a derivation that builds the @file{mime.cache} database from manifest entries. It's used to query the MIME type of a given file." - (mlet %store-monad ((shared-mime-info + (define shared-mime-info ; lazy reference + (module-ref (resolve-interface '(gnu packages gnome)) 'shared-mime-info)) + + (mlet %store-monad ((glib (manifest-lookup-package - manifest "shared-mime-info"))) + manifest "glib"))) (define build (with-imported-modules '((guix build utils) (guix build union)) @@ -747,7 +750,8 @@ entries. It's used to query the MIME type of a given file." (pkgdirs (filter file-exists? (map (cut string-append <> "/share/mime/packages") - '#$(manifest-inputs manifest)))) + (cons #+shared-mime-info + '#$(manifest-inputs manifest))))) (update-mime-database (string-append #+shared-mime-info "/bin/update-mime-database"))) @@ -757,8 +761,8 @@ entries. It's used to query the MIME type of a given file." (setenv "XDG_DATA_HOME" datadir) (exit (zero? (system* update-mime-database destdir))))))) - ;; Don't run the hook when 'shared-mime-info' is referenced. - (if shared-mime-info + ;; Don't run the hook when there are no GLib based applications. + (if glib (gexp->derivation "xdg-mime-database" build #:local-build? #t #:substitutable? #f)