unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#65745] [PATCH] gnu: yelp: Provide dependencies to display "man:" URIs.
@ 2023-09-04 20:58 Ludovic Courtès
  2023-09-05  3:43 ` Maxim Cournoyer
  0 siblings, 1 reply; 9+ messages in thread
From: Ludovic Courtès @ 2023-09-04 20:58 UTC (permalink / raw)
  To: 65745
  Cc: Ludovic Courtès, Luis Felipe, Liliana Marie Prikler,
	Maxim Cournoyer, Raghav Gururajan

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

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 "\""))))))))
     (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))

base-commit: 1af35bbb25b122cafddfd2f69b644d46c4beff85
-- 
2.41.0





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

end of thread, other threads:[~2023-09-11 21:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-04 20:58 [bug#65745] [PATCH] gnu: yelp: Provide dependencies to display "man:" URIs Ludovic Courtès
2023-09-05  3:43 ` Maxim Cournoyer
2023-09-09 16:45   ` Ludovic Courtès
2023-09-09 16:56     ` Liliana Marie Prikler
2023-09-09 22:06       ` Maxim Cournoyer
2023-09-11  9:08   ` [bug#65745] [PATCH v2] " Ludovic Courtès
2023-09-11 14:13     ` Maxim Cournoyer
2023-09-11 17:16       ` Liliana Marie Prikler
2023-09-11 21:56         ` bug#65745: [PATCH] " 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).