diff mbox series

[bug#47435] gnu: mail: Make the sendmail package actually output its binary

Message ID CAAaf0CCUVMmrADMj9Ow200z=jJuzf=W1jPCgwT78gHEKUonSKA@mail.gmail.com
State New
Headers show
Series [bug#47435] gnu: mail: Make the sendmail package actually output its binary | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Rovanion Luckey March 27, 2021, 5:34 p.m. UTC
This is an attempt at getting the sendmail package working. Currently
installing the package does not make the `sendmail` executable appear in
`$PATH`:


> └$ guix environment --ad-hoc sendmail
> └$ sendmail
> bash: sendmail: command not found

This patch fixes that.

Though there are questions that still need to be resolved. While this patch
does fix what it sets out to fix, the solutions aren't neccicerily correct.
It configures a "helpfile" to be put in "$out/usr/share" and the same goes
for its "statistics" file. I have no idea what these does and where they
should go in reality. If someone happens to know, please do tell.

Comments

Léo Le Bouter March 27, 2021, 6:07 p.m. UTC | #1
On Sat, 2021-03-27 at 18:34 +0100, Rovanion Luckey wrote:
> This is an attempt at getting the sendmail package working. Currently
> installing the package does not make the `sendmail` executable appear
> in `$PATH`:
> 
> 
> > └$ guix environment --ad-hoc sendmail
> > └$ sendmail
> > bash: sendmail: command not found
> 
> This patch fixes that.
> 

Thanks a lot for working on this!

It seems the commit message does not follow the ChangeLog guidelines as
used by GNU Guix, I suggest using this:

> gnu: sendmail: Fix output's directory structure.
>     
> * gnu/packages/mail.scm (sendmail)[arguments]<#:phases>: Properly
> specify output directories in replacement 'configure and 'pre-
> install.

Look at the commit history of GNU Guix for more examples and
inspiration.

> Though there are questions that still need to be resolved. While this
> patch does fix what it sets out to fix, the solutions aren't
> neccicerily correct. It configures a "helpfile" to be put in
> "$out/usr/share" and the same goes for its "statistics" file. I have
> no idea what these does and where they should go in reality. If
> someone happens to know, please do tell.

If we look at the output of these commands:

With your patch applied:

$ tree $(./pre-inst-env guix build sendmail)
/gnu/store/ygz55p6g8z4kjbp6418w385jzy53324h-sendmail-8.15.2
├── bin
│   ├── hoststat -> /gnu/store/ygz55p6g8z4kjbp6418w385jzy53324h-
sendmail-8.15.2/bin/sendmail
│   ├── mailq -> /gnu/store/ygz55p6g8z4kjbp6418w385jzy53324h-sendmail-
8.15.2/bin/sendmail
│   ├── newaliases -> /gnu/store/ygz55p6g8z4kjbp6418w385jzy53324h-
sendmail-8.15.2/bin/sendmail
│   ├── purgestat -> /gnu/store/ygz55p6g8z4kjbp6418w385jzy53324h-
sendmail-8.15.2/bin/sendmail
│   ├── sendmail
│   └── vacation
├── etc
│   └── mail
│       ├── sendmail.cf
│       └── submit.cf
├── libexec
├── sbin
│   ├── editmap
│   ├── mailstats
│   ├── makemap
│   └── praliases
└── share
    ├── doc
    │   └── sendmail-8.15.2
    │       └── LICENSE
    ├── helpfile
    └── statistics

7 directories, 16 files

Without your patch applied:

$ tree $(./pre-inst-env guix build sendmail)
/gnu/store/yn6dlixw6cnbmgjggk640vbv8hidfhi7-sendmail-8.15.2
├── etc
│   └── mail
│       ├── helpfile
│       ├── sendmail.cf
│       ├── statistics
│       └── submit.cf
├── share
│   └── doc
│       └── sendmail-8.15.2
│           └── LICENSE
└── usr
    ├── bin
    │   ├── hoststat -> /usr/sbin/sendmail
    │   ├── mailq -> /usr/sbin/sendmail
    │   ├── newaliases -> /usr/sbin/sendmail
    │   ├── purgestat -> /usr/sbin/sendmail
    │   └── vacation
    └── sbin
        ├── editmap
        ├── mailstats
        ├── makemap
        ├── praliases
        ├── sendmail
        └── smrsh

8 directories, 16 files

We can see helpfile and statistics file go into etc/mail, then sendmail
goes into sbin, smrsh is missing in sbin.

Léo
Leo Famulari March 27, 2021, 6:22 p.m. UTC | #2
On Sat, Mar 27, 2021 at 06:34:03PM +0100, Rovanion Luckey wrote:
> This is an attempt at getting the sendmail package working. Currently
> installing the package does not make the `sendmail` executable appear in
> `$PATH`:
> 
> 
> > └$ guix environment --ad-hoc sendmail
> > └$ sendmail
> > bash: sendmail: command not found
> 
> This patch fixes that.
> 
> Though there are questions that still need to be resolved. While this patch
> does fix what it sets out to fix, the solutions aren't neccicerily correct.
> It configures a "helpfile" to be put in "$out/usr/share" and the same goes
> for its "statistics" file. I have no idea what these does and where they
> should go in reality. If someone happens to know, please do tell.

Thanks for working on this!

> +             (substitute* "cf/cf/Makefile"
> +               (("^MAILDIR=.*")
> +                (string-append "MAILDIR = "
> +                               (assoc-ref outputs "out")
> +                               "/etc/mail\n")))

In addition to Léo Le Bouter's comments, I suggest either omitting or
amending this part. A Maildir is where the user's emails will be kept,
but it cannot be stored in the build output, because that directory will
be immutable after the build is complete.

https://en.wikipedia.org/wiki/Maildir

What is the default?
diff mbox series

Patch

From db5c0cf1b4686410f365b36d708aceed1742efec Mon Sep 17 00:00:00 2001
From: Rovanion Luckey <rovanion.luckey@gmail.com>
Date: Sat, 27 Mar 2021 18:28:02 +0100
Subject: [PATCH] gnu: mail: Make the sendmail package actually output its
 binary

The binary sendmail was not installed when sendmail was installed. This patch fixes this.
---
 gnu/packages/mail.scm | 33 +++++++++++++++++++++++++--------
 1 file changed, 25 insertions(+), 8 deletions(-)

diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b02f547e03..6fefc15d65 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -2761,23 +2761,41 @@  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(`confHFDIR',   `~a/share')
+define(`confSTDIR',   `~a/share')
+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 out out))))
+
+             (substitute* "cf/cf/Makefile"
+               (("^MAILDIR=.*")
+                (string-append "MAILDIR = "
+                               (assoc-ref outputs "out")
+                               "/etc/mail\n")))
              #t))
          (replace 'build
            (lambda _
@@ -2789,10 +2807,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))))
-- 
2.30.0