Subject: [PATCH 1/3] gnu: public-inbox: Some packaging fixes

From: Thiago Jung Bauermann <[email-masked]>
Date: Sun, 15 May 2022 19:02:28 -0300

The file ‘script/public-inbox-compact’ doesn't call ‘xapian-compact’ directly
anymore, so the substitution in the ‘qualify-paths’ phase doesn't do anything.

Now there's a reference to ‘xapian-compact’ in ‘lib/PublicInbox/Xapcmd.pm’,
so substitute the path there.

And move xapian from native-inputs to inputs and use its input path in the
substitution, since ‘xapian-compact’ is called during normal execution of
public-inbox.

Also add ‘bash-minimal’ to the package's inputs, since it uses ‘wrap-program’.

Finally, take the opportunity to change build phases to not return #t
unconditionally, since that isn't necessary anymore.

* gnu/packages/mail.scm (public-inbox)[arguments]<#:phases>: Don't return #t
from each phase.
{qualify-paths}: Substitute ‘xapian-compact’ path in the correct file.  Use
‘search-input-file’ rather than ‘which’ to find it.
[native-inputs]: Move ‘xapian’ from here ...
[inputs]: ... to here. Add ‘bash-minimal’.
---
 gnu/packages/mail.scm | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index c4ccc53e84ef..0728d65d1d10 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -47,6 +47,7 @@
 ;;; Copyright © 2021 Philip McGrath <[email-masked]>
 ;;; Copyright © 2022 Andrew Tropin <[email-masked]>
 ;;; Copyright © 2022 Justin Veilleux <[email-masked]>
+;;; Copyright © 2022 Thiago Jung Bauermann <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -4101,12 +4102,12 @@ (define-public public-inbox
      '(#:phases
        (modify-phases %standard-phases
          (add-before 'configure 'qualify-paths
-           (lambda _
+           (lambda* (#:key inputs #:allow-other-keys)
              ;; Use absolute paths for 'xapian-compact'.
-             (let ((xapian-compact (which "xapian-compact")))
-               (substitute* "script/public-inbox-compact"
-                 (("xapian-compact") xapian-compact)))
-             #t))
+             (substitute* "lib/PublicInbox/Xapcmd.pm"
+               (("'xapian-compact'")
+                (format #f "'~a'" (search-input-file inputs
+                                                     "/bin/xapian-compact"))))))
          (add-before 'check 'pre-check
            (lambda _
              (substitute* "t/spawn.t"
@@ -4117,8 +4118,7 @@ (define-public public-inbox
              ;; XXX: This test fails due to zombie process is not reaped by
              ;; the builder.
              (substitute* "t/httpd-unix.t"
-               (("^SKIP: \\{") "SKIP: { skip('Guix');"))
-             #t))
+               (("^SKIP: \\{") "SKIP: { skip('Guix');"))))
          (add-after 'install 'wrap-programs
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (let ((out (assoc-ref outputs "out")))
@@ -4133,14 +4133,13 @@ (define-public public-inbox
                     ;; perl module.
                     `("PATH" ":" prefix
                       (,(dirname (search-input-file inputs "/bin/git"))))))
-                (find-files (string-append out "/bin"))))
-             #t)))))
+                (find-files (string-append out "/bin")))))))))
     (native-inputs
-     (list xapian
-           ;; For testing.
+     (list ;; For testing.
            lsof openssl))
     (inputs
-     (list git
+     (list bash-minimal
+           git
            perl-dbd-sqlite
            perl-dbi
            perl-email-address-xs
@@ -4162,7 +4161,8 @@ (define-public public-inbox
            ;; ("highlight" ,highlight)
            ;; For testing.
            perl-ipc-run
-           perl-xml-feed))
+           perl-xml-feed
+           xapian))
     (home-page "https://public-inbox.org/README.html")
     (synopsis "Archive mailing lists in Git repositories")
     (description