[PATCH] profiles: Build the man database only if 'man-db' is in the profile.

  • Done
  • quality assurance status badge
Details
3 participants
  • Oleg Pykhalov
  • Leo Famulari
  • Ludovic Courtès
Owner
unassigned
Submitted by
Ludovic Courtès
Severity
normal
L
L
Ludovic Courtès wrote on 26 Oct 2021 19:33
(address . guix-patches@gnu.org)(name . Ludovic Courtès)(address . ludo@gnu.org)
20211026173328.21511-1-ludo@gnu.org
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’.

Thread continues in January and March.


Toggle diff (34 lines)
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
L
L
Leo Famulari wrote on 26 Oct 2021 19:44
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 51416@debbugs.gnu.org)
YXg+aa/etPJZu5L8@jasmine.lan
On Tue, Oct 26, 2021 at 07:33:28PM +0200, Ludovic Courtès wrote:
Toggle quote (6 lines)
> 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?
L
L
Ludovic Courtès wrote on 26 Oct 2021 23:50
Re: bug#51416: [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
(name . Leo Famulari)(address . leo@famulari.name)(address . 51416@debbugs.gnu.org)
87bl3bihfl.fsf_-_@gnu.org
Leo Famulari <leo@famulari.name> skribis:

Toggle quote (10 lines)
> 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’:


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

Ludo’.
L
L
Leo Famulari wrote on 27 Oct 2021 00:45
(name . Ludovic Courtès)(address . ludo@gnu.org)(address . 51416@debbugs.gnu.org)
YXiE7AUsV0f2lB+v@jasmine.lan
On Tue, Oct 26, 2021 at 11:50:54PM +0200, Ludovic Courtès wrote:
Toggle quote (7 lines)
> 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!
O
O
Oleg Pykhalov wrote on 27 Oct 2021 12:29
Re: [bug#51416] [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
(name . Ludovic Courtès)(address . ludo@gnu.org)
87o87a69sf.fsf@gmail.com
Hi,

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

[…]

Toggle quote (4 lines)
>
> 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.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmF5KfAUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pwaPQ/+MXsJ0SiOFFn34EKRF8ZTXSGVJAIo
WxVkZ6GCpaY8HcbHnUniStVF9F329q8gQYT+pweTb0L9ne0FhbUmH1aeInpEw+P+
uvhvc7xJkIMTLwx+H3GmlhDi7drSTGj1z6iJsqJlUzlFa1KoJgGZbF2dV6jp4suI
qtDADlcJg4Ry3eOr3pqUckmXuE3D26Br/4iI4hxQXywVMD2xvhLgWaU0v1iTvYEk
JvVVDyn37qj/Qdeqemg/xgwodTjTjSzHmAxjNYiRa6CnQWsxeY9cY/qDqsc1i10c
xU3TIe6ZPgD80YvWwfm15j97ox8hIhB0kqhTx57LvQkh9M/HupuYX4Ls+BHgJFCD
ULpDWdapEmIXyKfTi43XMjKIBeH7u6eZDmZd6hHNGULcakLjMFukTfV6n+iulBlC
wjNCtfF75Y0ZrJshhhqXEzB2kvezKBdBIbEiEfGtYb2EI/quTDS+djCzlGAAx9dG
fsmQ9PZDiGFOP1u8nN8XiGIuHiKY9OpMwEsfYms8bPi3PiI/JBlfMYbab7v+e/dA
MR43rmswmycQxrfu2E5O30am0TaNf4MNQQ7otQyvg73Bno8bmU3xoBu8QXOw6Ubl
fpcBIBX1z8JCs9SaQ6WqQle/XyzioZg830Q0KYKQXhtocJ6OY5NkXZtAr3wdRL3o
ov+5k5QiAjSed18=
=L8aJ
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 27 Oct 2021 16:03
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
874k92imy9.fsf@gnu.org
Hi,

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

Toggle quote (11 lines)
> 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’.
L
L
Ludovic Courtès wrote on 6 Nov 2021 23:22
Re: bug#51416: [PATCH] profiles: Build the man database only if 'man-db' is in the profile.
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87r1bsly9t.fsf_-_@gnu.org
Hi,

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

Toggle quote (15 lines)
> 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’.
Closed
?