Subject: [bug#55903] [PATCH v6 01/41] gnu: Add go-github-com-zenhack-go-notmuch.

From: "(" <[email-masked]>
Date: Thu, 04 Aug 2022 18:16:39 +0100

This patchset makes two changes to the go.notmuch package.

On Thu Aug 4, 2022 at 6:10 PM BST, ( wrote:
> +              (modules '((guix build utils)))
> +              ;; XXX: We need to use a snippet, because if we don't modify
> +              ;; the source directly, the modifications will have to be
> +              ;; reapplied for every single package that depends on this
> +              ;; one.
> +              (snippet
> +               #~(substitute* (find-files (getcwd) "\\.go$")
> +                   (("// #cgo LDFLAGS:.*$")
> +                    (let ((notmuch #$notmuch))
> +                      (string-append "// #cgo LDFLAGS:"
> +                                     " -lnotmuch"
> +                                     " -L" notmuch "/lib\n"
> +                                     "// #cgo CFLAGS:"
> +                                     " -I" notmuch "/include\n")))))
(1) Patch the source directly to refer to our notmuch. This way, we don't have
to propagate it.

> +           #~(modify-phases %standard-phases
> +               (add-before 'check 'unpack-test-fixtures
> +                 (lambda* (#:key inputs import-path #:allow-other-keys)
> +                   (let ((fixtures (assoc-ref inputs "notmuch-fixtures")))
> +                     (invoke "tar" "xf" fixtures "-C"
> +                             (string-append "src/" import-path
> +                                            "/fixtures"))))))))
> +    (native-inputs
> +     `(("notmuch-fixtures"
> +        ,(origin
> +          (method url-fetch)
> +          (uri "http://notmuchmail.org/releases/test-databases/database-v1.tar.xz")
> +          (sha256
> +           (base32
> +            "1lk91s00y4qy4pjh8638b5lfkgwyl282g1m27srsf7qfn58y16a2"))))))
(2) Download and unpack the notmuch test fixtures. This means we can reenable
the tests :)

    -- (