Subject: Re: [bug#45153] [PATCH v2] gnu: rottlog: Fix mail reporting.

From: Ludovic Courtès <[email-masked]>
Date: Wed, 23 Dec 2020 16:02:51 +0100

Hi!

John Doe <[email-masked]> skribis:

> From: Léo Le Bouter <[email-masked]>
>
> * gnu/packages/admin.scm (rottlog):
> [inputs]: Add sendmail.
> [phases]: Modify 'patch-paths to substitute sendmail command with
> /gnu/store item.

[...]

> +                        (("/usr/sbin/sendmail")
> +                         (string-append (assoc-ref inputs "sendmail")
> +                                        "/usr/sbin/sendmail")))

I thought this was a typo and then realized that our ‘sendmail’ package
is this broken, due to an incorrect use of ‘DESTDIR’.

The patch below is an attempt to fix that but some of the files are
silently not getting installed.  Anyone has ideas here?

Anyhow, can we instead use ‘mail’ from ‘mailutils’ instead?  (I
wrongfully mentioned Inetutils earlier, sorry for the confusion.)

Thanks,
Ludo’.

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index f85713433e..1f06450e6a 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2759,23 +2759,39 @@ powerful user customization features.")
                (("SHELL=/bin/sh") (string-append "SHELL=" (which "sh"))))
              #t))
          (replace 'configure
-           (lambda _
+           (lambda* (#:key outputs #:allow-other-keys)
 
              ;; Render harmless any attempts to chown or chgrp
              (substitute* "devtools/bin/install.sh"
                (("owner=\\$2") "owner=''")
                (("group=\\$2") "group=''"))
 
-             (with-output-to-file "devtools/Site/site.config.m4"
-               (lambda ()
-                 (format #t "
+             (let ((out (assoc-ref outputs "out")))
+               (with-output-to-file "devtools/Site/site.config.m4"
+                 (lambda ()
+                   ;; See 'devtools/M4/UNIX/defines.m4' for the list of
+                   ;; installation directories.
+                   (format #t "
 define(`confCC', `gcc')
 define(`confOPTIMIZE', `-g -O2')
 define(`confLIBS', `-lresolv')
 define(`confINSTALL', `~a/devtools/bin/install.sh')
 define(`confDEPEND_TYPE', `CC-M')
 define(`confINST_DEP', `')
-" (getcwd))))
+
+define(`confMBINDIR', `~a/bin')
+define(`confUBINDIR', `~a/bin')
+define(`confSBINDIR', `~a/sbin')
+define(`confEBINDIR', `~a/libexec')
+define(`confMANROOT', `~a/share/man')~%"
+                           (getcwd)
+                           out out out out out))))
+
+             (substitute* "cf/cf/Makefile"
+               (("^MAILDIR=.*")
+                (string-append "MAILDIR = "
+                               (assoc-ref outputs "out")
+                               "/etc/mail\n")))
              #t))
          (replace 'build
            (lambda _
@@ -2787,10 +2803,9 @@ define(`confINST_DEP', `')
          (add-before 'install 'pre-install
            (lambda _
              (let ((out (assoc-ref %outputs "out")))
-               (mkdir-p (string-append out "/usr/bin"))
-               (mkdir-p (string-append out "/usr/sbin"))
+               (mkdir-p (string-append out "/bin"))
+               (mkdir-p (string-append out "/sbin"))
                (mkdir-p (string-append out "/etc/mail"))
-               (setenv "DESTDIR" out)
                (with-directory-excursion "cf/cf"
                  (invoke "sh" "Build" "install-cf"))
                #t))))