From patchwork Tue Oct 26 17:33:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 34072 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 D3B4227BBE3; Tue, 26 Oct 2021 18:34:16 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 97F4F27BBE1 for ; Tue, 26 Oct 2021 18:34:16 +0100 (BST) Received: from localhost ([::1]:35066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mfQL1-000063-Ni for patchwork@mira.cbaines.net; Tue, 26 Oct 2021 13:34:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47156) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfQKp-000050-VF for guix-patches@gnu.org; Tue, 26 Oct 2021 13:34:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35902) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfQKo-0002hS-En for guix-patches@gnu.org; Tue, 26 Oct 2021 13:34:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mfQKo-0006Yy-82 for guix-patches@gnu.org; Tue, 26 Oct 2021 13:34:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 26 Oct 2021 17:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 51416 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51416@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.163526962625203 (code B ref -1); Tue, 26 Oct 2021 17:34:02 +0000 Received: (at submit) by debbugs.gnu.org; 26 Oct 2021 17:33:46 +0000 Received: from localhost ([127.0.0.1]:47448 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfQKY-0006YR-2L for submit@debbugs.gnu.org; Tue, 26 Oct 2021 13:33:46 -0400 Received: from lists.gnu.org ([209.51.188.17]:38234) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mfQKW-0006YJ-DK for submit@debbugs.gnu.org; Tue, 26 Oct 2021 13:33:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47096) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfQKW-0008NK-6Q for guix-patches@gnu.org; Tue, 26 Oct 2021 13:33:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mfQKU-0002WV-UB; Tue, 26 Oct 2021 13:33:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=eCodT/LNswAzcJh1vnigMQw5lzE49f/P4URfsvGufSs=; b=nutXGnPWad6OxF 9nzCYS87VuCafXbMW/sWf20anL57Ra2J6nwl2PY5ux6nw6VvDaa1HG89enfnR4MeS1tsG7fD6PCWj Q8G1RzWNxLbQEfqWj1TMCyfLpGX7JK4BKjwzhRsvCrnQje8zLhGvl9voeQlCmX3HbtObl2YzB9zXO /sVO5umAAUSznGcMdjA+TPph5WFR0QcSaaxNuYhYZNySr4o8H8P7RHym4SRF0Wv5hsh2uBdLHpU2J Cd33VijcMvcKe8BPf+4kE6/8xLtGNNYBYU/IGXvLbnhxXpGZ14ATRyO2/FHvpZ+ejvnhcvmXyPjDO PzlIdZc5oeHBzkFLukkQ==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:54222 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mfQKT-0005rP-H9; Tue, 26 Oct 2021 13:33:41 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Tue, 26 Oct 2021 19:33:28 +0200 Message-Id: <20211026173328.21511-1-ludo@gnu.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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 This allows us to skip the expensive man-db profile hook in most cases. Suggested by Liliana Marie Prikler . * guix/profiles.scm (manual-database/optional): New procedure. (%default-profile-hooks): Use it instead of 'manual-database'. --- guix/profiles.scm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) Hi! As y’all know, computing the manual page database is CPU- and I/O-intensive and thus a good candidate for removal, as discussed earlier¹. I would prefer to provide a replacement for the ‘man -k’ functionality, such as a Xapian-based full-text search². Now, this hasn’t materialized yet, but I feel it’s about time to remove that hook. The other day Liliana came with a smart idea on IRC: to build the database only when ‘man-db’ is also in the profile. It’s a good way to not quite make a decision :-), but it’s going to address the main pain point. Thoughts? Thanks, Ludo’. ¹ https://lists.gnu.org/archive/html/guix-devel/2020-12/msg00052.html Thread continues in January and March. ² https://lists.gnu.org/archive/html/guix-devel/2021-04/msg00027.html base-commit: 0a42998a50e8bbe9e49142b21a570db00efe7491 diff --git a/guix/profiles.scm b/guix/profiles.scm index 9f30349c69..ffdd5f57f6 100644 --- a/guix/profiles.scm +++ b/guix/profiles.scm @@ -1682,6 +1682,16 @@ (define man-directory `((type . profile-hook) (hook . manual-database)))) +(define (manual-database/optional manifest) + "Return a derivation to build the manual database of MANIFEST, but only if +MANIFEST contains the \"man-db\" package. Otherwise, return #f." + ;; Building the man database (for "man -k") is expensive and rarely used. + ;; Build it only if the profile also contains "man-db". + (mlet %store-monad ((man-db (manifest-lookup-package manifest "man-db"))) + (if man-db + (manual-database manifest) + (return #f)))) + (define (texlive-configuration manifest) "Return a derivation that builds a TeXlive configuration for the entries in MANIFEST." @@ -1784,7 +1794,7 @@ (define %default-profile-hooks ;; This is the list of derivation-returning procedures that are called by ;; default when making a non-empty profile. (list info-dir-file - manual-database + manual-database/optional fonts-dir-file ghc-package-cache-file ca-certificate-bundle