[bug#65745] gnu: yelp: Provide dependencies to display "man:" URIs.
Commit Message
Previously a command like the following one would fail to display the
expected man page:
guix shell yelp coreutils man-db -C \
--expose=/tmp/.X11-unix --expose=/run/user \
--expose=/var/run/dbus --expose=/etc/machine-id \
-E ^DISPLAY -- yelp man:ls
* gnu/packages/gnome.scm (yelp)[arguments]: New field.
[inputs]: Add 'man-db' and its "groff-minimal" input.
Reported-by: Luis Felipe <sirgazil@zoho.com>
---
gnu/packages/gnome.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
Hi!
Initially I wanted to fix support for URLs like “info:coreutils”,
which Luis also reported on the Fediverse as being broken. However,
after much debugging I got lost in a maze of callbacks and threads
and opaque objects and eventually gave up. Someone™ should take
another look.
For the record, this is how I went on my debugging journey:
guix shell yelp coreutils man-db info-reader \
--with-debug-info=yelp gdb --pure -E ^DISPLAY -- \
gdb --args /bin/sh yelp info:coreutils
Ludo’.
base-commit: 1af35bbb25b122cafddfd2f69b644d46c4beff85
Comments
Hello,
Ludovic Courtès <ludo@gnu.org> writes:
[...]
> diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
> index 3b80692e90..894d77d7ba 100644
> --- a/gnu/packages/gnome.scm
> +++ b/gnu/packages/gnome.scm
> @@ -7336,6 +7336,31 @@ (define-public yelp
> (base32
> "0h9vf4fx056imjf8ibmn03wg1c3hniipy1nsm2jqi62lp1m19c95"))))
> (build-system glib-or-gtk-build-system)
> + (arguments
> + (list #:phases
> + #~(modify-phases %standard-phases
> + (add-after 'unpack 'set-man-file-name
> + (lambda* (#:key inputs outputs #:allow-other-keys)
> + ;; Create a wrapper for 'man' that knows where to find
> + ;; 'groff' and 'gunzip'.
> + (define libexecdir
> + (string-append #$output "/libexec/yelp"))
> + (define wrapper
> + (string-append libexecdir "/man"))
> +
> + (mkdir-p libexecdir)
> + (symlink (search-input-file inputs "bin/man") wrapper)
> + (wrap-program wrapper
> + `("PATH" ":" =
> + ,(map (lambda (program)
> + (dirname (search-input-file inputs program)))
> + '("bin/groff" "bin/gunzip"))))
> +
> + ;; Have Yelp use that 'man' wrapper instead of searching
> + ;; for 'man' in $PATH.
> + (substitute* "libyelp/yelp-man-parser.c"
> + (("\"man\"")
> + (string-append "\"" wrapper "\""))))))))
Couldn't we more simply wrap the yelp command with the 'man', 'groff' and
'gunzip' command locations added to PATH?
Hi,
Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>> + ;; Create a wrapper for 'man' that knows where to find
>> + ;; 'groff' and 'gunzip'.
>> + (define libexecdir
>> + (string-append #$output "/libexec/yelp"))
>> + (define wrapper
>> + (string-append libexecdir "/man"))
>> +
>> + (mkdir-p libexecdir)
>> + (symlink (search-input-file inputs "bin/man") wrapper)
>> + (wrap-program wrapper
>> + `("PATH" ":" =
>> + ,(map (lambda (program)
>> + (dirname (search-input-file inputs program)))
>> + '("bin/groff" "bin/gunzip"))))
>> +
>> + ;; Have Yelp use that 'man' wrapper instead of searching
>> + ;; for 'man' in $PATH.
>> + (substitute* "libyelp/yelp-man-parser.c"
>> + (("\"man\"")
>> + (string-append "\"" wrapper "\""))))))))
>
> Couldn't we more simply wrap the yelp command with the 'man', 'groff' and
> 'gunzip' command locations added to PATH?
Yeah it’s convoluted; the idea was that the wrapper for ‘man’ is
something that should be fixed in ‘man-db’ proper but that we cannot fix
in ‘master’ because ‘man-db’ has too many dependents.
Maybe I should start with it though…
Ludo’.
Am Samstag, dem 09.09.2023 um 18:45 +0200 schrieb Ludovic Courtès:
> Hi,
>
> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>
> > > + ;; Create a wrapper for 'man' that knows
> > > where to find
> > > + ;; 'groff' and 'gunzip'.
> > > + (define libexecdir
> > > + (string-append #$output "/libexec/yelp"))
> > > + (define wrapper
> > > + (string-append libexecdir "/man"))
> > > +
> > > + (mkdir-p libexecdir)
> > > + (symlink (search-input-file inputs "bin/man")
> > > wrapper)
> > > + (wrap-program wrapper
> > > + `("PATH" ":" =
> > > + ,(map (lambda (program)
> > > + (dirname (search-input-file
> > > inputs program)))
> > > + '("bin/groff" "bin/gunzip"))))
> > > +
> > > + ;; Have Yelp use that 'man' wrapper instead
> > > of searching
> > > + ;; for 'man' in $PATH.
> > > + (substitute* "libyelp/yelp-man-parser.c"
> > > + (("\"man\"")
> > > + (string-append "\"" wrapper "\""))))))))
> >
> > Couldn't we more simply wrap the yelp command with the 'man',
> > 'groff' and
> > 'gunzip' command locations added to PATH?
>
> Yeah it’s convoluted; the idea was that the wrapper for ‘man’ is
> something that should be fixed in ‘man-db’ proper but that we cannot
> fix
> in ‘master’ because ‘man-db’ has too many dependents.
>
> Maybe I should start with it though…
Can we graft our man-db to get the same effect?
Hi,
Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
> Am Samstag, dem 09.09.2023 um 18:45 +0200 schrieb Ludovic Courtès:
>> Hi,
>>
>> Maxim Cournoyer <maxim.cournoyer@gmail.com> skribis:
>>
>> > > + ;; Create a wrapper for 'man' that knows
>> > > where to find
>> > > + ;; 'groff' and 'gunzip'.
>> > > + (define libexecdir
>> > > + (string-append #$output "/libexec/yelp"))
>> > > + (define wrapper
>> > > + (string-append libexecdir "/man"))
>> > > +
>> > > + (mkdir-p libexecdir)
>> > > + (symlink (search-input-file inputs "bin/man")
>> > > wrapper)
>> > > + (wrap-program wrapper
>> > > + `("PATH" ":" =
>> > > + ,(map (lambda (program)
>> > > + (dirname (search-input-file
>> > > inputs program)))
>> > > + '("bin/groff" "bin/gunzip"))))
>> > > +
>> > > + ;; Have Yelp use that 'man' wrapper instead
>> > > of searching
>> > > + ;; for 'man' in $PATH.
>> > > + (substitute* "libyelp/yelp-man-parser.c"
>> > > + (("\"man\"")
>> > > + (string-append "\"" wrapper "\""))))))))
>> >
>> > Couldn't we more simply wrap the yelp command with the 'man',
>> > 'groff' and
>> > 'gunzip' command locations added to PATH?
>>
>> Yeah it’s convoluted; the idea was that the wrapper for ‘man’ is
>> something that should be fixed in ‘man-db’ proper but that we cannot
>> fix
>> in ‘master’ because ‘man-db’ has too many dependents.
>>
>> Maybe I should start with it though…
> Can we graft our man-db to get the same effect?
We also have a core-updates branch; it could go there and we could merge
it with the docbook stuff that's going to go there.
I'd prefer this than convoluted solutions I don't understand :-).
--
Thanks,
Maxim
@@ -7336,6 +7336,31 @@ (define-public yelp
(base32
"0h9vf4fx056imjf8ibmn03wg1c3hniipy1nsm2jqi62lp1m19c95"))))
(build-system glib-or-gtk-build-system)
+ (arguments
+ (list #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'set-man-file-name
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ ;; Create a wrapper for 'man' that knows where to find
+ ;; 'groff' and 'gunzip'.
+ (define libexecdir
+ (string-append #$output "/libexec/yelp"))
+ (define wrapper
+ (string-append libexecdir "/man"))
+
+ (mkdir-p libexecdir)
+ (symlink (search-input-file inputs "bin/man") wrapper)
+ (wrap-program wrapper
+ `("PATH" ":" =
+ ,(map (lambda (program)
+ (dirname (search-input-file inputs program)))
+ '("bin/groff" "bin/gunzip"))))
+
+ ;; Have Yelp use that 'man' wrapper instead of searching
+ ;; for 'man' in $PATH.
+ (substitute* "libyelp/yelp-man-parser.c"
+ (("\"man\"")
+ (string-append "\"" wrapper "\""))))))))
(native-inputs
(list `(,glib "bin") ; for glib-genmarshal, etc.
intltool
@@ -7347,6 +7372,8 @@ (define-public yelp
(list gsettings-desktop-schemas
libhandy
libxslt
+ man-db ;for URIs like "man:ls"
+ (lookup-package-input man-db "groff-minimal") ;ditto
sqlite
webkitgtk
yelp-xsl))