unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
@ 2021-10-26 17:33 Ludovic Courtès
  2021-10-26 17:44 ` Leo Famulari
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2021-10-26 17:33 UTC (permalink / raw)
  To: 51416; +Cc: Ludovic Courtès

This allows us to skip the expensive man-db profile hook in most cases.

Suggested by Liliana Marie Prikler <liliana.prikler@gmail.com>.

* 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

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

base-commit: 0a42998a50e8bbe9e49142b21a570db00efe7491
-- 
2.33.0





^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-26 17:33 [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile Ludovic Courtès
@ 2021-10-26 17:44 ` Leo Famulari
  2021-10-26 21:50   ` Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Leo Famulari @ 2021-10-26 17:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 51416

On Tue, Oct 26, 2021 at 07:33:28PM +0200, Ludovic Courtès wrote:
> 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?

From the user's perspective, what would change? Would `man foo` still
work after installing foo?




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-26 17:44 ` Leo Famulari
@ 2021-10-26 21:50   ` Ludovic Courtès
  2021-10-26 22:45     ` Leo Famulari
  2021-10-27 10:29     ` Oleg Pykhalov
  0 siblings, 2 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-10-26 21:50 UTC (permalink / raw)
  To: Leo Famulari; +Cc: 51416

Leo Famulari <leo@famulari.name> skribis:

> On Tue, Oct 26, 2021 at 07:33:28PM +0200, Ludovic Courtès wrote:
>> 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?
>
>>From the user's perspective, what would change? Would `man foo` still
> work after installing foo?

Yes.  What wouldn’t work, unless ‘man-db’ is in the same profile, is
‘man -k whatever’:

  https://guix.gnu.org/manual/en/html_node/Documentation.html

On Guix System, the system profile does include man-db by default.

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-26 21:50   ` Ludovic Courtès
@ 2021-10-26 22:45     ` Leo Famulari
  2021-10-27 10:29     ` Oleg Pykhalov
  1 sibling, 0 replies; 7+ messages in thread
From: Leo Famulari @ 2021-10-26 22:45 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 51416

On Tue, Oct 26, 2021 at 11:50:54PM +0200, Ludovic Courtès wrote:
> Yes.  What wouldn’t work, unless ‘man-db’ is in the same profile, is
> ‘man -k whatever’:
> 
>   https://guix.gnu.org/manual/en/html_node/Documentation.html
> 
> On Guix System, the system profile does include man-db by default.

Wow, I never knew about that feature. I figured the database was
necessary for `man foo`.

+1 for this change!




^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-26 21:50   ` Ludovic Courtès
  2021-10-26 22:45     ` Leo Famulari
@ 2021-10-27 10:29     ` Oleg Pykhalov
  2021-10-27 14:03       ` Ludovic Courtès
  1 sibling, 1 reply; 7+ messages in thread
From: Oleg Pykhalov @ 2021-10-27 10:29 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 51416, Leo Famulari

[-- Attachment #1: Type: text/plain, Size: 344 bytes --]

Hi,

Ludovic Courtès <ludo@gnu.org> writes:

[…]

>   https://guix.gnu.org/manual/en/html_node/Documentation.html
>
> On Guix System, the system profile does include man-db by default.

We probably should add a line in the documentation about 'man -k'
requirement on non Guix system, WDYT?  Otherwise +1 for the change.

Oleg.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-27 10:29     ` Oleg Pykhalov
@ 2021-10-27 14:03       ` Ludovic Courtès
  2021-11-06 22:22         ` bug#51416: " Ludovic Courtès
  0 siblings, 1 reply; 7+ messages in thread
From: Ludovic Courtès @ 2021-10-27 14:03 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51416, Leo Famulari

Hi,

Oleg Pykhalov <go.wigust@gmail.com> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
> […]
>
>>   https://guix.gnu.org/manual/en/html_node/Documentation.html
>>
>> On Guix System, the system profile does include man-db by default.
>
> We probably should add a line in the documentation about 'man -k'
> requirement on non Guix system, WDYT?  Otherwise +1 for the change.

Yes, good idea, I’ll do that.

Thanks!

Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#51416: [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
  2021-10-27 14:03       ` Ludovic Courtès
@ 2021-11-06 22:22         ` Ludovic Courtès
  0 siblings, 0 replies; 7+ messages in thread
From: Ludovic Courtès @ 2021-11-06 22:22 UTC (permalink / raw)
  To: Oleg Pykhalov; +Cc: 51416-done, Leo Famulari

Hi,

Ludovic Courtès <ludo@gnu.org> skribis:

> Oleg Pykhalov <go.wigust@gmail.com> skribis:
>
>> Ludovic Courtès <ludo@gnu.org> writes:
>>
>> […]
>>
>>>   https://guix.gnu.org/manual/en/html_node/Documentation.html
>>>
>>> On Guix System, the system profile does include man-db by default.
>>
>> We probably should add a line in the documentation about 'man -k'
>> requirement on non Guix system, WDYT?  Otherwise +1 for the change.
>
> Yes, good idea, I’ll do that.

Done in 3c1158ac4e5ef825a9b9a229a233fabd7cef334e!

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-11-06 22:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 17:33 [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile Ludovic Courtès
2021-10-26 17:44 ` Leo Famulari
2021-10-26 21:50   ` Ludovic Courtès
2021-10-26 22:45     ` Leo Famulari
2021-10-27 10:29     ` Oleg Pykhalov
2021-10-27 14:03       ` Ludovic Courtès
2021-11-06 22:22         ` bug#51416: " Ludovic Courtès

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).