guix: Index the man-db database via man pages names.

Fixes <https://issues.guix.gnu.org/38838>.

* guix/man-db.scm (write-mandb-database): Use the abbreviated base name of the
man page as the key, not its full file name.
This commit is contained in:
Maxim Cournoyer 2022-03-01 23:51:12 -05:00
parent cda78ec8ac
commit deaa322963
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -110,7 +110,12 @@ (define (write-mandb-database file entries)
;; Write ENTRIES in sorted order so we get deterministic output.
(for-each (lambda (entry)
(gdbm-set! db
(string-append (mandb-entry-file-name entry)
;; For the 'whatis' tool to find anything, the key
;; should match the name of the software,
;; e.g. 'cat'. Derive it from the file name, as
;; the name could technically be #f.
(string-append (abbreviate-file-name
(mandb-entry-file-name entry))
"\x00")
(entry->string entry)))
(sort entries mandb-entry<?))