Subject: [bug#68541] [PATCH 2/2] gnu: dovecot: Apply guix style.

From: Clément Lassieur <[email-masked]>
Date: Thu, 18 Jan 2024 00:47:23 +0100

On Wed, Jan 17 2024, Herman Rimm via Guix-patches via wrote:

> * gnu/packages/mail.scm (dovecot): Apply guix style.
>
> Change-Id: I2f50fa15ccbd2391be1f6f12e13e62aff707c54a
> ---
>  gnu/packages/mail.scm | 88 +++++++++++++++++++++++--------------------
>  1 file changed, 47 insertions(+), 41 deletions(-)

Hi, "guix style" is not perfect, and in this case the previous style
was, I believe, way better.  I think it's meant to help people automate
some stuff, but not to reformat the whole source tree.

Thanks!  And sorry :)
Clément

> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index b522943294..5bbe4ca7ea 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -2011,57 +2011,63 @@ (define-public dovecot
>       (origin
>         (method url-fetch)
>         (uri (string-append "https://www.dovecot.org/releases/"
> -                           (version-major+minor version) "/"
> -                           "dovecot-" version ".tar.gz"))
> +                           (version-major+minor version)
> +                           "/"
> +                           "dovecot-"
> +                           version
> +                           ".tar.gz"))

This is not readable :/

>         (sha256
>          (base32 "0bah6rn5ihczai8q50p6pqxwj73j21smib89ycp7q8qwly9i1c85"))
> -       (patches
> -        (search-patches "dovecot-bootstrap-cross-compile.patch"
> -                        "dovecot-opensslv3.patch"))
> +       (patches (search-patches "dovecot-bootstrap-cross-compile.patch"
> +                                "dovecot-opensslv3.patch"))
>         (modules '((guix build utils)))
>         (snippet '(delete-file "configure"))))
>      (build-system gnu-build-system)
> -    (native-inputs
> -     (list autoconf automake gettext-minimal libtool pkg-config))
> -    (inputs
> -     (list bzip2
> -           icu4c
> -           libsodium ; extra password algorithms
> -           libstemmer
> -           libunwind
> -           linux-pam
> -           lz4
> -           openssl
> -           sqlite
> -           zlib
> -           `(,zstd "lib")))
> +    (native-inputs (list autoconf automake gettext-minimal libtool pkg-config))
> +    (inputs (list bzip2
> +                  icu4c
> +                  libsodium ;extra password algorithms
> +                  libstemmer
> +                  libunwind
> +                  linux-pam
> +                  lz4
> +                  openssl
> +                  sqlite
> +                  zlib
> +                  `(,zstd "lib")))
>      (arguments
> -     `(#:configure-flags '("--sysconfdir=/etc"
> -                           "--localstatedir=/var"
> -                           "--with-sqlite") ; not auto-detected
> +     `(#:configure-flags '("--sysconfdir=/etc" "--localstatedir=/var"
> +                           "--with-sqlite") ;not auto-detected
>         ;; The -rdynamic linker flag is needed for the backtrace() function to
>         ;; have symbol names rather than just addresses.  Dovecot's tests rely
>         ;; on this, see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=962630.
>         #:make-flags (list "LDFLAGS=-rdynamic")
> -       #:phases
> -       (modify-phases %standard-phases
> -         (add-after 'unpack 'patch-file-names
> -           (lambda _
> -             (substitute* "src/lib-program-client/test-program-client-local.c"
> -               (("(/bin/| )cat") (which "cat"))
> -               (("/bin/echo") (which "echo"))
> -               (("/bin/false") (which "false"))
> -               (("/bin/sh") (which "bash"))
> -               (("head") (which "head"))
> -               (("sleep") (which "sleep")))
> -             (substitute* (list "src/lib-smtp/test-bin/sendmail-exit-1.sh"
> -                                "src/lib-smtp/test-bin/sendmail-success.sh")
> -               (("cat") (which "cat")))))
> -         (replace 'install
> -           (lambda* (#:key make-flags #:allow-other-keys)
> -             ;; Simple hack to avoid installing a trivial README in /etc.
> -             (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
> -                    make-flags))))))
> +       #:phases (modify-phases %standard-phases
> +                  (add-after 'unpack 'patch-file-names
> +                    (lambda _
> +                      (substitute* "src/lib-program-client/test-program-client-local.c"
> +                        (("(/bin/| )cat")
> +                         (which "cat"))
> +                        (("/bin/echo")
> +                         (which "echo"))
> +                        (("/bin/false")
> +                         (which "false"))
> +                        (("/bin/sh")
> +                         (which "bash"))
> +                        (("head")
> +                         (which "head"))
> +                        (("sleep")
> +                         (which "sleep")))

Same here, the previous version was more readable.

> +                      (substitute* (list
> +                                    "src/lib-smtp/test-bin/sendmail-exit-1.sh"
> +                                    "src/lib-smtp/test-bin/sendmail-success.sh")
> +                        (("cat")
> +                         (which "cat")))))
> +                  (replace 'install
> +                    (lambda* (#:key make-flags #:allow-other-keys)
> +                      ;; Simple hack to avoid installing a trivial README in /etc.
> +                      (apply invoke "make" "install" "sysconfdir=/tmp/bogus"
> +                             make-flags))))))
>      (home-page "https://www.dovecot.org")
>      (synopsis "Secure POP3/IMAP server")
>      (description