[PATCH] Add Bower (notmuch curses email client)

  • Done
  • quality assurance status badge
Details
6 participants
  • Sarah Morgensen
  • jgart
  • Ludovic Courtès
  • Maxim Cournoyer
  • Maxime Devos
  • Munyoki Kilyungi
Owner
unassigned
Submitted by
jgart
Severity
normal
J
Add bower (it's not what you're thinking)
(name . Guix Patches)(address . guix-patches@gnu.org)
20210926190836.GB8410@gac.attlocal.net
Hi Guixers!

Here's bower, a notmuch client written in mercury.

This thing is awesome! It's my main email client.

I use it paired with offlineimap3, msmtp, and vis (composing emails).

One of the unique things about bower is that:

Toggle quote (7 lines)
> Bower is designed such that it can be run on the local machine but call
> out to notmuch on a remote machine (that holds your mail) via ssh. The
> advantage is that you can start helper programs on the local machine
> (e.g. a web browser or image viewer), and add or save attachments on
> the local filesystem, even if your mail archive is stored on a different
> machine.

Tests are enabled and passing.

If anyone can't wait for this bower to get reviewed and merged then it is also
available now from GuixRUS channel:


Bower's packaged for alpine linux, gentoo, aur and nix. I currently maintain
the nix package also:


all best,

jgart

3B1D 7F19 E36B B60C 0F5B 2CA9 A52A A2B4 77B6 DD35


My bower config:

J
[PATCH] gnu: Add bower.
(address . 50833@debbugs.gnu.org)(name . jgart)(address . jgart@dismail.de)
20210926231145.18651-1-jgart@dismail.de
* gnu/packages/mail.scm (bower): New variable.
---
gnu/packages/mail.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)

Toggle diff (81 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b3bdf13537..f0624c12c4 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -87,6 +87,7 @@
#:use-module (gnu packages file)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages gawk)
#:use-module (gnu packages gdb)
#:use-module (gnu packages gettext)
#:use-module (gnu packages ghostscript)
@@ -114,6 +115,7 @@
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
+ #:use-module (gnu packages mercury)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages nettle)
#:use-module (gnu packages networking)
@@ -1302,6 +1304,58 @@ agent (@dfn{MUA}) experience as an alternative to the Emacs mode shipped with
Notmuch.")
(license license:gpl3+)))
+(define-public bower
+ (package
+ (name "bower")
+ (version "0.13")
+ (home-page "https://github.com/wangp/bower")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url home-page)
+ (commit (string-append version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags
+ (list
+ "bower" "man"
+ (string-append "CC=" ,(cc-for-target))
+ (string-append "prefix=" %output))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (chdir "tests")
+ (invoke "make"))))
+ (replace 'install
+ (lambda* (#:key outpus #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (man (string-append (assoc-ref %outputs "out") "/share/man/man1")))
+ (chdir "..")
+ (install-file "bower" bin)
+ (install-file "bower.1" man)))))))
+ (native-inputs
+ `(("diffutils" ,diffutils) ; needed for diff command
+ ("gawk" ,gawk)
+ ("mercury" ,mercury)
+ ("pandoc" ,pandoc)
+ ("util-linux" ,util-linux))) ; needed by rev command for test_process.m
+ (inputs
+ `(("gpgme" ,gpgme)
+ ("ncurses" ,ncurses)))
+ (synopsis "Terminal client for the notmuch email system")
+ (description
+"@command{bower} is a curses frontend for the notmuch email system.
+@command{bower} is written in mercury.")
+ (license license:gpl3+)))
+
(define-public notifymuch
(let
((commit "9d4aaf54599282ce80643b38195ff501120807f0")
--
2.33.0
S
S
Sarah Morgensen wrote on 27 Sep 2021 03:01
(name . jgart)(address . jgart@dismail.de)(address . 50833@debbugs.gnu.org)
864ka6vnkv.fsf@mgsn.dev
Hi,

Thanks for the patch. I don't use notmuch (yet) but I test-built this
and I have a few suggestions :)

jgart <jgart@dismail.de> writes:

Toggle quote (60 lines)
> * gnu/packages/mail.scm (bower): New variable.
> ---
> gnu/packages/mail.scm | 54 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 54 insertions(+)
>
> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index b3bdf13537..f0624c12c4 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -87,6 +87,7 @@
> #:use-module (gnu packages file)
> #:use-module (gnu packages fontutils)
> #:use-module (gnu packages freedesktop)
> + #:use-module (gnu packages gawk)
> #:use-module (gnu packages gdb)
> #:use-module (gnu packages gettext)
> #:use-module (gnu packages ghostscript)
> @@ -114,6 +115,7 @@
> #:use-module (gnu packages lua)
> #:use-module (gnu packages m4)
> #:use-module (gnu packages man)
> + #:use-module (gnu packages mercury)
> #:use-module (gnu packages ncurses)
> #:use-module (gnu packages nettle)
> #:use-module (gnu packages networking)
> @@ -1302,6 +1304,58 @@ agent (@dfn{MUA}) experience as an alternative to the Emacs mode shipped with
> Notmuch.")
> (license license:gpl3+)))
>
> +(define-public bower
> + (package
> + (name "bower")
> + (version "0.13")
> + (home-page "https://github.com/wangp/bower")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url home-page)
> + (commit (string-append version))))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
> + (build-system gnu-build-system)
> + (arguments
> + `(#:make-flags
> + (list
> + "bower" "man"
> + (string-append "CC=" ,(cc-for-target))
> + (string-append "prefix=" %output))
> + #:phases
> + (modify-phases %standard-phases
> + (delete 'configure)
> + (replace 'check
> + (lambda* (#:key inputs outputs tests? #:allow-other-keys)
> + (when tests?
> + (chdir "tests")
> + (invoke "make"))))

Rather than chdir, you can just

(invoke "make" "-C" "tests")

or maybe even avoid the custom phase with test-target:

#:test-target "--directory=tests"

(Yes, it's a bit of a cheat, but test-target is just passed as the first
argument to make, and we want the default target anyway, so it works.)

Toggle quote (8 lines)
> + (replace 'install
> + (lambda* (#:key outpus #:allow-other-keys)
> + (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
> + (man (string-append (assoc-ref %outputs "out") "/share/man/man1")))
> + (chdir "..")
> + (install-file "bower" bin)
> + (install-file "bower.1" man)))))))

It might be helpful to also install bower.conf.sample to "/share/bower",
so we have an example config file.

Toggle quote (10 lines)
> + (native-inputs
> + `(("diffutils" ,diffutils) ; needed for diff command
> + ("gawk" ,gawk)
> + ("mercury" ,mercury)
> + ("pandoc" ,pandoc)
> + ("util-linux" ,util-linux))) ; needed by rev command for test_process.m
> + (inputs
> + `(("gpgme" ,gpgme)
> + ("ncurses" ,ncurses)))

The README says that it also uses "base64" from coreutils, "file", and
optionally "lynx"; a grep through the source shows the following
commands used (some of them are just defaults):

base64
file

vi (used if EDITOR is not set)
lynx (used for formatting HTML messages)
xdg-open (used for opening links and MIME parts)
xclip
pandoc (used for composing multipart/alternative messages)
/usr/bin/sendmail

Other than "base64" and "file" I'm not sure which (if any) of these
should be directly linked. "/usr/bin/sendmail" should be "sendmail" if
it's not linked, though. "xdg-open" and "xclip" aren't available from
my PATH, but they are configurable in bower.conf, so... yeah, I'm not
sure. Just know that without changing the bower.conf value or
installing "xdg-open", links won't open automatically. Same for the
clipboard and reading/composing HTML messages.

If it's not possible to 'substitute*' those values, 'wrap-program' could
be used to add the correct directories to PATH, but that can introduce
other issues.

Toggle quote (5 lines)
> + (synopsis "Terminal client for the notmuch email system")
> + (description
> +"@command{bower} is a curses frontend for the notmuch email system.
> +@command{bower} is written in mercury.")

Could you expand the description a bit, perhaps with some of the
features you quoted in your first email? It also seems that
configurability (seen above) is another of its draws, so maybe mention
that as well :)

(Also, in my opinion "written in X" isn't relevant for end-user
packages, but I know others who would disagree, so...)

Toggle quote (6 lines)
> + (license license:gpl3+)))
> +
> (define-public notifymuch
> (let
> ((commit "9d4aaf54599282ce80643b38195ff501120807f0")

Thanks again for your work!

--
Sarah
J
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50833@debbugs.gnu.org)
20210928211220.GB21136@gac.attlocal.net
On Sun, 26 Sep 2021 18:01:20 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:

Hi Sarah, thanks for all the feedback! It is much appreciated that you took
the time to do that.

Toggle quote (2 lines)
> (invoke "make" "-C" "tests")

I added this.

Toggle quote (4 lines)
> or maybe even avoid the custom phase with test-target:
>
> #:test-target "--directory=tests"

This one didn't work out for me.

Toggle quote (3 lines)
> It might be helpful to also install bower.conf.sample to "/share/bower",
> so we have an example config file.

Added this request.

Toggle quote (4 lines)
> If it's not possible to 'substitute*' those values, 'wrap-program' could
> be used to add the correct directories to PATH, but that can introduce
> other issues.

I'll have to wrap my head around this one a bit more to understand what is needed.

It looks like the mercury code does not call the binaries directly.
I might be wrong. I have to take a closer look. Do you happen to have
some places in the code where you see the binaries being called in a way that
requires wrapping the path?

I updated the description :)

Below is the updated patch.

all best
J
[PATCH] gnu: Add bower.
(address . 50833@debbugs.gnu.org)(name . jgart)(address . jgart@dismail.de)
20210929011232.21061-1-jgart@dismail.de
* gnu/packages/mail.scm (bower): New variable.
---
gnu/packages/mail.scm | 66 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)

Toggle diff (93 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b3bdf13537..9c5a1a7e22 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -87,6 +87,7 @@
#:use-module (gnu packages file)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages gawk)
#:use-module (gnu packages gdb)
#:use-module (gnu packages gettext)
#:use-module (gnu packages ghostscript)
@@ -114,6 +115,7 @@
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
+ #:use-module (gnu packages mercury)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages nettle)
#:use-module (gnu packages networking)
@@ -1302,6 +1304,70 @@ agent (@dfn{MUA}) experience as an alternative to the Emacs mode shipped with
Notmuch.")
(license license:gpl3+)))
+(define-public bower
+ (package
+ (name "bower")
+ (version "0.13")
+ (home-page "https://github.com/wangp/bower")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url home-page)
+ (commit (string-append version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags
+ (list
+ "bower" "man"
+ (string-append "CC=" ,(cc-for-target))
+ (string-append "prefix=" %output))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "-C" "tests"))))
+ (replace 'install
+ (lambda* (#:key outpus #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (man (string-append (assoc-ref %outputs "out") "/share/man/man1"))
+ (conf (string-append (assoc-ref %outputs "out") "/share/bower")))
+ (install-file "bower" bin)
+ (install-file "bower.conf.sample" (string-append conf "/bower.conf"))
+ (install-file "bower.1" man)))))))
+ (native-inputs
+ `(("diffutils" ,diffutils) ; needed for diff command
+ ("gawk" ,gawk)
+ ("mercury" ,mercury)
+ ("pandoc" ,pandoc)
+ ("util-linux" ,util-linux))) ; needed by rev command for test_process.m
+ (inputs
+ `(("coreutils" ,coreutils) ; needed for base64
+ ("file" ,file)
+ ("gpgme" ,gpgme)
+ ("ncurses" ,ncurses)
+ ("xclip" ,xclip)
+ ("xdg-utils" ,xdg-utils))) ; needed for xdg-open
+ (synopsis "Terminal client for the notmuch email system")
+ (description
+"@command{bower} is a curses frontend for the notmuch email system.
+Bower has two main views: an index, and a combined message thread and pager.
+Bower can use the @command{notmuch address} command to look up email addresses
+where required, for example, when composing a new message.
+Bower is designed such that it can be run on the local machine but call
+out to @command{notmuch} via ssh on a remote machine storing your mail.
+ The advantage is that you can start helper programs on the local machine,
+for example, a web browser or image viewer, and add or save attachments on
+the local filesystem, even if your mail archive is stored on a different
+machine.")
+ (license license:gpl3+)))
+
(define-public notifymuch
(let
((commit "9d4aaf54599282ce80643b38195ff501120807f0")
--
2.33.0
S
S
Sarah Morgensen wrote on 1 Oct 2021 04:11
(name . jgart)(address . jgart@dismail.de)(address . 50833@debbugs.gnu.org)
868rzdtrxv.fsf@mgsn.dev
Hello,

Apologies for the delayed reply.

jgart <jgart@dismail.de> writes:

Toggle quote (11 lines)
>> If it's not possible to 'substitute*' those values, 'wrap-program' could
>> be used to add the correct directories to PATH, but that can introduce
>> other issues.
>
> I'll have to wrap my head around this one a bit more to understand what is needed.
>
> It looks like the mercury code does not call the binaries directly.
> I might be wrong. I have to take a closer look. Do you happen to have
> some places in the code where you see the binaries being called in a way that
> requires wrapping the path?

These are the locations I found.

src/compose.m
1488:base64_command = command_prefix(shell_quoted("base64"), quote_once).

src/detect_mime_type.m
55:file_command = command_prefix(shell_quoted("file"), quote_once).

src/prog_config.m
Toggle snippet (46 lines)
:- func default_notmuch_command = command_prefix.

default_notmuch_command =
command_prefix(shell_quoted("notmuch"), quote_once).

:- func default_editor_command = command_prefix.

default_editor_command =
command_prefix(shell_quoted("vi"), quote_once).

:- func default_html_dump_command = command_prefix.

default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".

:- func default_open_part_command = string.

default_open_part_command = "xdg-open&".

:- func default_open_url_command = string.

default_open_url_command = "xdg-open&".

:- func default_pipe_id_command = string.

default_pipe_id_command = "xclip".

:- func default_alt_html_filter_command = command_prefix.

default_alt_html_filter_command =
command_prefix(shell_quoted("pandoc -f markdown -t html"), quote_once).

:- func default_poll_period_secs = maybe(int).

default_poll_period_secs = yes(60).

:- func default_auto_refresh_inactive_secs = maybe(int).

default_auto_refresh_inactive_secs = no.

:- func default_sendmail_command = command_prefix.

default_sendmail_command =
command_prefix(shell_quoted("/usr/bin/sendmail -oi -oem"), quote_once).

Also, I just caught one more thing--usually we write out the full URL in
the origin, rather than re-use the 'home-page' field.

Hope that helps,
--
Sarah
J
J
jgart wrote on 1 Oct 2021 05:31
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50833@debbugs.gnu.org)
20210930233116.GB1935@gac.attlocal.net
On Thu, 30 Sep 2021 19:11:24 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:
Toggle quote (2 lines)
> These are the locations I found.

Thanks! Not sure how I missed that :) I must have done the wrong thing with ripgrep

Toggle quote (3 lines)
> default_sendmail_command =
> command_prefix(shell_quoted("/usr/bin/sendmail -oi -oem"), quote_once).

Should sendmail really be wrapped? I feel like sendmail won't work "out of the" box
without some configuration first. I may be wrong. Not sure what to do there.

Maybe someone in the community can advise us further on that point?

The other ones seem sensible to wrap and as they mostly work without configuration.

I'm using msmtp instead of sendmail in my bower config. Seemed much simpler
at the time to set up. I think the founding/main author of bower also uses msmtp
instead of sendmail.


Toggle quote (3 lines)
> Also, I just caught one more thing--usually we write out the full URL in
> the origin, rather than re-use the 'home-page' field.

Good catch! I stopped doing that also. That must have been from the package
template I started from ;)

I added a new patch with the home-page swapped below.

Toggle quote (2 lines)
> Hope that helps,

Thank you! Yes, it does. Much appreciated :)

I hope to get back to this in a few days when I have more free time.

Feel free to add patches if you'd like. We can commit together as co-authors.

all best,

jgart
J
J
jgart wrote on 1 Oct 2021 05:31
[PATCH] gnu: Add bower.
(address . 50833@debbugs.gnu.org)(name . jgart)(address . jgart@dismail.de)
20211001033127.4233-1-jgart@dismail.de
* gnu/packages/mail.scm (bower): New variable.
---
gnu/packages/mail.scm | 66 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 66 insertions(+)

Toggle diff (93 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index e1e56c33d0..3bfb81085b 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -87,6 +87,7 @@
#:use-module (gnu packages file)
#:use-module (gnu packages fontutils)
#:use-module (gnu packages freedesktop)
+ #:use-module (gnu packages gawk)
#:use-module (gnu packages gdb)
#:use-module (gnu packages gettext)
#:use-module (gnu packages ghostscript)
@@ -114,6 +115,7 @@
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
+ #:use-module (gnu packages mercury)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages nettle)
#:use-module (gnu packages networking)
@@ -1302,6 +1304,70 @@ agent (@dfn{MUA}) experience as an alternative to the Emacs mode shipped with
Notmuch.")
(license license:gpl3+)))
+(define-public bower
+ (package
+ (name "bower")
+ (version "0.13")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url "https://github.com/wangp/bower")
+ (commit (string-append version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags
+ (list
+ "bower" "man"
+ (string-append "CC=" ,(cc-for-target))
+ (string-append "prefix=" %output))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "-C" "tests"))))
+ (replace 'install
+ (lambda* (#:key outpus #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (man (string-append (assoc-ref %outputs "out") "/share/man/man1"))
+ (conf (string-append (assoc-ref %outputs "out") "/share/bower")))
+ (install-file "bower" bin)
+ (install-file "bower.conf.sample" (string-append conf "/bower.conf"))
+ (install-file "bower.1" man)))))))
+ (native-inputs
+ `(("diffutils" ,diffutils) ; needed for diff command
+ ("gawk" ,gawk)
+ ("mercury" ,mercury)
+ ("pandoc" ,pandoc)
+ ("util-linux" ,util-linux))) ; needed by rev command for test_process.m
+ (inputs
+ `(("coreutils" ,coreutils) ; needed for base64
+ ("file" ,file)
+ ("gpgme" ,gpgme)
+ ("ncurses" ,ncurses)
+ ("xclip" ,xclip)
+ ("xdg-utils" ,xdg-utils))) ; needed for xdg-open
+ (home-page "https://github.com/wangp/bower")
+ (synopsis "Terminal client for the notmuch email system")
+ (description
+"@command{bower} is a curses frontend for the notmuch email system.
+Bower has two main views: an index, and a combined message thread and pager.
+Bower can use the @command{notmuch address} command to look up email addresses
+where required, for example, when composing a new message.
+Bower is designed such that it can be run on the local machine but call
+out to @command{notmuch} via ssh on a remote machine storing your mail.
+ The advantage is that you can start helper programs on the local machine,
+for example, a web browser or image viewer, and add or save attachments on
+the local filesystem, even if your mail archive is stored on a different
+machine.")
+ (license license:gpl3+)))
+
(define-public notifymuch
(let
((commit "9d4aaf54599282ce80643b38195ff501120807f0")
--
2.33.0
J
J
jgart wrote on 2 Oct 2021 09:58
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50833@debbugs.gnu.org)
20211002035855.GB1450@gac.attlocal.net
Toggle quote (3 lines)
> default_editor_command =
> command_prefix(shell_quoted("vi"), quote_once).

Should we really patch/wrap vi?

I imagine we would also have to propagate it?

I have a feeling vi shouldn't be part of the bower package.

WDYT?
J
(name . Sarah Morgensen)(address . iskarian@mgsn.dev)(address . 50833@debbugs.gnu.org)
20211025003258.GB16646@gac.attlocal.net
On Thu, 30 Sep 2021 19:11:24 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:
Toggle quote (3 lines)
> default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
> Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".

Hi again,

If lynx is being detected without needing to be wrapped should I still wrap it?

bower is currently finding lynx without me wrapping the binary in the store.

I installed both packages (lynx and bower) with guix and tested an html email
that would trigger lynx to render it. It works :)

This might reduce the code needed for the package definition if it is not necessary.

WDYT?
L
L
Ludovic Courtès wrote on 25 Oct 2021 14:25
Re: bug#50833: Add bower (it's not what you're thinking)
(name . jgart)(address . jgart@dismail.de)
87h7d5l29p.fsf_-_@gnu.org
Hi!

jgart <jgart@dismail.de> skribis:

Toggle quote (8 lines)
> On Thu, 30 Sep 2021 19:11:24 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:
>> default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
>> Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".
>
> Hi again,
>
> If lynx is being detected without needing to be wrapped should I still wrap it?

It’s detected if it happens to be in $PATH, otherwise it won’t be found.

Like Sarah suggested, I’d recommend using ‘substitute*’ to replace, say,
/usr/bin/sendmail by /gnu/store/…/bin/sendmail. You can grep the code
for examples on how to do that; see also:


As for Lynx specifically, whether you’d leave it as is (in which case
it’s found if and only if it’s in $PATH), or whether you’d use
‘substitute*’ depends on whether it’s an optional dependency or not. If
Bower can gracefully handle lack of Lynx and, for instance, fall back to
another rendering method, then perhaps you can leave it as is.

HTH!

Ludo’.
L
L
Ludovic Courtès wrote on 25 Oct 2021 14:26
control message for bug #50833
(address . control@debbugs.gnu.org)
87fsspl28o.fsf@gnu.org
retitle 50833 [PATCH] Add Bower (notmuch curses email client)
quit
M
M
Maxim Cournoyer wrote on 20 Apr 2022 23:07
Re: bug#50833: [PATCH] Add Bower (notmuch curses email client)
(name . Ludovic Courtès)(address . ludo@gnu.org)
878rrzwjj1.fsf_-_@gmail.com
Hello,

Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (26 lines)
> Hi!
>
> jgart <jgart@dismail.de> skribis:
>
>> On Thu, 30 Sep 2021 19:11:24 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:
>>> default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
>>> Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".
>>
>> Hi again,
>>
>> If lynx is being detected without needing to be wrapped should I still wrap it?
>
> It’s detected if it happens to be in $PATH, otherwise it won’t be found.
>
> Like Sarah suggested, I’d recommend using ‘substitute*’ to replace, say,
> /usr/bin/sendmail by /gnu/store/…/bin/sendmail. You can grep the code
> for examples on how to do that; see also:
>
> https://guix.gnu.org/manual/en/html_node/Build-Utilities.html#index-substitute_002a
>
> As for Lynx specifically, whether you’d leave it as is (in which case
> it’s found if and only if it’s in $PATH), or whether you’d use
> ‘substitute*’ depends on whether it’s an optional dependency or not. If
> Bower can gracefully handle lack of Lynx and, for instance, fall back to
> another rendering method, then perhaps you can leave it as is.

jgart, could you look into that? Then we can bring this review to
completion :-)

Thanks,

Maxim
M
M
Maxim Cournoyer wrote on 20 Apr 2022 23:08
control message for bug #50833
(address . control@debbugs.gnu.org)
877d7jwjim.fsf@gmail.com
tags 50833 + moreinfo
quit
J
J
jgart wrote on 5 May 2022 16:31
Re: bug#50833: [PATCH] Add Bower (notmuch curses email client)
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20220505143110.GB5411@gac
On Wed, 20 Apr 2022 17:07:46 -0400 Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
Toggle quote (33 lines)
> Hello,
>
> Ludovic Courtès <ludo@gnu.org> writes:
>
> > Hi!
> >
> > jgart <jgart@dismail.de> skribis:
> >
> >> On Thu, 30 Sep 2021 19:11:24 -0700 Sarah Morgensen <iskarian@mgsn.dev> wrote:
> >>> default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
> >>> Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".
> >>
> >> Hi again,
> >>
> >> If lynx is being detected without needing to be wrapped should I still wrap it?
> >
> > It’s detected if it happens to be in $PATH, otherwise it won’t be found.
> >
> > Like Sarah suggested, I’d recommend using ‘substitute*’ to replace, say,
> > /usr/bin/sendmail by /gnu/store/…/bin/sendmail. You can grep the code
> > for examples on how to do that; see also:
> >
> > https://guix.gnu.org/manual/en/html_node/Build-Utilities.html#index-substitute_002a
> >
> > As for Lynx specifically, whether you’d leave it as is (in which case
> > it’s found if and only if it’s in $PATH), or whether you’d use
> > ‘substitute*’ depends on whether it’s an optional dependency or not. If
> > Bower can gracefully handle lack of Lynx and, for instance, fall back to
> > another rendering method, then perhaps you can leave it as is.
>
> jgart, could you look into that? Then we can bring this review to
> completion :-)

Hi Ludo, Maxim,


Thanks for the review and encouragement. Sorry for the delay. I've been
in the process of relocating/starting a new job and haven't been able
to catch up on Guix stuff I have pending.

I spoke with wangp regading Lynx as an optional dependency:


Toggle quote (1 lines)
> Like Sarah suggested, I’d recommend using ‘substitute*’ to
replace, say, /usr/bin/sendmail by /gnu/store/…/bin/sendmail.

I can patch sendmail and the others mentioned by Sarah. What should we
do about lynx given wangp's insight on lynx as default in bower?

all best,

jgart
M
M
Maxim Cournoyer wrote on 7 Jul 2022 20:01
(name . jgart)(address . jgart@dismail.de)
87o7y0ztse.fsf_-_@gmail.com
Hi jgart,

[...]

Toggle quote (20 lines)
>> jgart, could you look into that? Then we can bring this review to
>> completion :-)
>
> Hi Ludo, Maxim,
>
>
> Thanks for the review and encouragement. Sorry for the delay. I've been
> in the process of relocating/starting a new job and haven't been able
> to catch up on Guix stuff I have pending.
>
> I spoke with wangp regading Lynx as an optional dependency:
>
> https://github.com/wangp/bower/issues/103
>
>> Like Sarah suggested, I’d recommend using ‘substitute*’ to
> replace, say, /usr/bin/sendmail by /gnu/store/…/bin/sendmail.
>
> I can patch sendmail and the others mentioned by Sarah. What should we
> do about lynx given wangp's insight on lynx as default in bower?

I think we should patch it, given that according to wangp "it doesn't
behave that nicely when lynx is missing but it won't crash." and taking
into account that lynx is very small (guix size lynx says it has a
closure of 185.4 MiB).

I'm looking forward to the v2 :-)

Thanks,

Maxim
J
J
jgart wrote on 8 Jul 2022 02:23
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20220707192306.GV1675@gac
On Thu, 07 Jul 2022 14:01:21 -0400 Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:
Toggle quote (31 lines)
> Hi jgart,
>
> [...]
>
> >> jgart, could you look into that? Then we can bring this review to
> >> completion :-)
> >
> > Hi Ludo, Maxim,
> >
> >
> > Thanks for the review and encouragement. Sorry for the delay. I've been
> > in the process of relocating/starting a new job and haven't been able
> > to catch up on Guix stuff I have pending.
> >
> > I spoke with wangp regading Lynx as an optional dependency:
> >
> > https://github.com/wangp/bower/issues/103
> >
> >> Like Sarah suggested, I’d recommend using ‘substitute*’ to
> > replace, say, /usr/bin/sendmail by /gnu/store/…/bin/sendmail.
> >
> > I can patch sendmail and the others mentioned by Sarah. What should we
> > do about lynx given wangp's insight on lynx as default in bower?
>
> I think we should patch it, given that according to wangp "it doesn't
> behave that nicely when lynx is missing but it won't crash." and taking
> into account that lynx is very small (guix size lynx says it has a
> closure of 185.4 MiB).
>
> I'm looking forward to the v2 :-)

So, I should just patch lynx then, or also other things on that list?

btw, bower is currently available from guixrus:


I also maintain the nix package for bower:


I might stop maintaining the nix package since it's not as exciting work as maintaining the Guix package and I think I don't have time for that anymore ;()

all best,

jgart
M
M
Munyoki Kilyungi wrote on 8 Jul 2022 12:33
Re: [bug#50833] [PATCH] Add Bower (notmuch curses email client)
(name . jgart via Guix-patches via)(address . guix-patches@gnu.org)
86edyvq4fp.fsf@bonfacemunyoki.com
jgart via Guix-patches via <guix-patches@gnu.org>
anaandika:

[...]

Toggle quote (14 lines)
>
> So, I should just patch lynx then, or also other things on that list?
>
> btw, bower is currently available from guixrus:
>
> https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/misc.scm#L143
>
> I also maintain the nix package for bower:
>
> https://github.com/NixOS/nixpkgs/blob/nixos-22.05/pkgs/applications/networking/mailreaders/notmuch-bower/default.nix#L34
>

> I might stop maintaining the nix package since it's not as exciting work as maintaining the Guix package and I think I don't have time for that anymore ;()
>
A bit of yak-shaving here, but why would you want
nix+guix on the same system?

--
(Life is like a pencil that will surely run out,
but will leave the beautiful writing of life.)
(D4F09EB110177E03C28E2FE1F5BBAE1E0392253F
(hkp://keys.gnupg.net))
-----BEGIN PGP SIGNATURE-----

iQJKBAEBCAA0FiEE1PCesRAXfgPCji/h9buuHgOSJT8FAmLICAoWHG1lQGJvbmZh
Y2VtdW55b2tpLmNvbQAKCRD1u64eA5IlP4eXD/0d6l0GZBRPZMaH93IWqrqD4xh4
eeIekXVeJLEeISAw22lkySwqaa56ZMpn8xgjxRmAZ1wjyJzdvzZHe0x0HXdfxhN8
4+wl7RFEvH5dMLUmrwLG5OojBviQzFXxWA079ElJNvU+kjKR36OtNVLctT6B3aR2
Tv29hLWaBI2AHVTzMw25tSmxPTMozaPih7Tb4lJ2N3CcKw7QvSOxLFZhw2qTWHHf
fHpOTg6m4TA7Oj7Qjzx4xzArgyyn5SySC2t7T7qVfK2yRlmaHzfcAmMrRdBnw1Zc
daNK5lUwhHDSc8ylDB972QYYAW32fNJuWCfxQa/v4bet9JFwuL6CLXbKpcMSz2Aa
PF/ue43oPAwEYD3D9OnyPcLAIsksV5UEo9Vgz43BI3DNpDTNOL2PAuD1sVUoSFlU
2RNsKKThzk6DZjkNJtcc3NytiEXHVQ9UbRzfrz/exF1EDgQxXaFFrEyGVJE8g9pF
UeiFR9dQXT7tgs2xPFH68u8kv0CRpQQTKWSSIu6mzq7CUj6P2NAt0d5QSUHGS32T
N31QDwML90T7Hg2tywYDs0bVcFQVZYPoauxrbCX4F4WJbS2jlP1+hGThvQI615WI
pcK/brxyoDZeqrUGptB79XEU9OMYRgueE533li7qKGWNaUIeRnqCftXWLDzJbX+Y
biKi5QSayNY0zHHvgw==
=sUGr
-----END PGP SIGNATURE-----

J
J
jgart wrote on 8 Jul 2022 20:47
(name . Munyoki Kilyungi)(address . me@bonfacemunyoki.com)
20220708134701.GB20435@gac
On Fri, 08 Jul 2022 13:33:46 +0300 Munyoki Kilyungi <me@bonfacemunyoki.com> wrote:
Toggle quote (22 lines)
> jgart via Guix-patches via <guix-patches@gnu.org>
> anaandika:
>
> [...]
>
> >
> > So, I should just patch lynx then, or also other things on that list?
> >
> > btw, bower is currently available from guixrus:
> >
> > https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/misc.scm#L143
> >
> > I also maintain the nix package for bower:
> >
> > https://github.com/NixOS/nixpkgs/blob/nixos-22.05/pkgs/applications/networking/mailreaders/notmuch-bower/default.nix#L34
> >
>
> > I might stop maintaining the nix package since it's not as exciting work as maintaining the Guix package and I think I don't have time for that anymore ;()
> >
> A bit of yak-shaving here, but why would you want
> nix+guix on the same system?

Sometimes nix has a package that guix doesn't have and it might take a long time to package it for Guix properly so I just install it immediately with nix (think escape hatch).
J
J
jgart wrote on 8 Jul 2022 21:42
(name . Munyoki Kilyungi)(address . me@bonfacemunyoki.com)
20220708144249.GB22276@gac
On Fri, 08 Jul 2022 13:47:01 -0500 jgart <jgart@dismail.de> wrote:
Toggle quote (25 lines)
> On Fri, 08 Jul 2022 13:33:46 +0300 Munyoki Kilyungi <me@bonfacemunyoki.com> wrote:
> > jgart via Guix-patches via <guix-patches@gnu.org>
> > anaandika:
> >
> > [...]
> >
> > >
> > > So, I should just patch lynx then, or also other things on that list?
> > >
> > > btw, bower is currently available from guixrus:
> > >
> > > https://git.sr.ht/~whereiseveryone/guixrus/tree/master/item/guixrus/packages/misc.scm#L143
> > >
> > > I also maintain the nix package for bower:
> > >
> > > https://github.com/NixOS/nixpkgs/blob/nixos-22.05/pkgs/applications/networking/mailreaders/notmuch-bower/default.nix#L34
> > >
> >
> > > I might stop maintaining the nix package since it's not as exciting work as maintaining the Guix package and I think I don't have time for that anymore ;()
> > >
> > A bit of yak-shaving here, but why would you want
> > nix+guix on the same system?
>
> Sometimes nix has a package that guix doesn't have and it might take a long time to package it for Guix properly so I just install it immediately with nix (think escape hatch).

The same goes for any other package manager (e.g. pip, xbps, apt, npm, etc...). This is not an exclusive technique I use only with nix. I'm a consumer of packages. Guix keeps me honest, though.
M
M
Maxim Cournoyer wrote on 11 Jul 2022 18:09
Re: bug#50833: [PATCH] Add Bower (notmuch curses email client)
(name . jgart)(address . jgart@dismail.de)
87leszd42l.fsf@gmail.com
Hi,

jgart <jgart@dismail.de> writes:

[...]

Toggle quote (12 lines)
>> > I can patch sendmail and the others mentioned by Sarah. What should we
>> > do about lynx given wangp's insight on lynx as default in bower?
>>
>> I think we should patch it, given that according to wangp "it doesn't
>> behave that nicely when lynx is missing but it won't crash." and taking
>> into account that lynx is very small (guix size lynx says it has a
>> closure of 185.4 MiB).
>>
>> I'm looking forward to the v2 :-)
>
> So, I should just patch lynx then, or also other things on that list?

Sarah had sent a useful list of commands they could find referenced in
the source:

Toggle quote (1 lines)
>--8<---------------cut here---------------start------------->8---
src/compose.m
1488:base64_command = command_prefix(shell_quoted("base64"), quote_once).

src/detect_mime_type.m
55:file_command = command_prefix(shell_quoted("file"), quote_once).

src/prog_config.m

:- func default_notmuch_command = command_prefix.

default_notmuch_command =
command_prefix(shell_quoted("notmuch"), quote_once).

:- func default_editor_command = command_prefix.

default_editor_command =
command_prefix(shell_quoted("vi"), quote_once).

:- func default_html_dump_command = command_prefix.

default_html_dump_command = command_prefix(shell_quoted(Lynx), quote_once) :-
Lynx = "lynx -dump -force-html -stdin -display-charset=utf-8".

:- func default_open_part_command = string.

default_open_part_command = "xdg-open&".

:- func default_open_url_command = string.

default_open_url_command = "xdg-open&".

:- func default_pipe_id_command = string.

default_pipe_id_command = "xclip".

:- func default_alt_html_filter_command = command_prefix.

default_alt_html_filter_command =
command_prefix(shell_quoted("pandoc -f markdown -t html"), quote_once).

:- func default_poll_period_secs = maybe(int).

default_poll_period_secs = yes(60).

:- func default_auto_refresh_inactive_secs = maybe(int).

default_auto_refresh_inactive_secs = no.

:- func default_sendmail_command = command_prefix.

default_sendmail_command =
command_prefix(shell_quoted("/usr/bin/sendmail -oi -oem"), quote_once).
Toggle snippet (11 lines)
Out of these, I'd patch 'base64', 'file', 'notmuch', 'lynx' and
'sendmail', and leave the rest to be picked from PATH if available.

Could you send an updated version patching the above commands? With
this, it should be good to go.

Thank you,

Maxim
M
M
Munyoki Kilyungi wrote on 14 Jul 2022 10:54
Re: [bug#50833] [PATCH] Add Bower (notmuch curses email client)
(name . jgart)(address . jgart@dismail.de)
864jzk13cm.fsf@susa.mail-host-address-is-not-set
jgart <jgart@dismail.de> anaandika:

[...]
Toggle quote (4 lines)
>> Sometimes nix has a package that guix doesn't have and it might take a long time to package it for Guix properly so I just install it immediately with nix (think escape hatch).
>
> The same goes for any other package manager (e.g. pip, xbps, apt, npm, etc...). This is not an exclusive technique I use only with nix. I'm a consumer of packages. Guix keeps me honest, though.

Ah I see. For me that's been the upstream Arch or
AUR.

--
(Life is like a pencil that will surely run out,
but will leave the beautiful writing of life.)
(D4F09EB110177E03C28E2FE1F5BBAE1E0392253F
(hkp://keys.gnupg.net))
-----BEGIN PGP SIGNATURE-----

iQJKBAEBCAA0FiEE1PCesRAXfgPCji/h9buuHgOSJT8FAmLP2ckWHG1lQGJvbmZh
Y2VtdW55b2tpLmNvbQAKCRD1u64eA5IlP3obD/4/dVHC2n3vnMk+pk4IHamWZDcU
eufy9RaiB4sRAZGb9LuxOstgEzxhGM7Qbo/Dg/bc8Jb8wf/frj5hK8m/QCHXZGIs
W0MFgh1iV4qvzRX0LDD8YqRbI2YKqRxrKPnA6JE2+snv4ynKvnMQOrWfkoPQRRYx
XzeYkUYIQ9srxqUZ7oVDJ9XhR01dmbfKG2VaF1wAK1tzhASAwi9tMEksLeSfPgLk
qkeUcXZowJPA49dSRLznebBATwVoV+qYCuJQOImjGmSnC0DOUQcMz8FOap7E3gja
cWv/xDCD9UuLq89RRIEDlrbwCUDUgf9D9Byy6HCBz5PExNxjcs1kp53gEbn236Ag
NzKe0Ylv7RzkHCd8XW3N3C8eyyrNX3aXq1vnJKFjGaBQiFlcFPV+1hVWDLCEpUFe
vIfClygvDZLqFja0gOtwWbHYEXa/YXnJhTaiv3D66buGPif5p0VBEBl/aHIoy3gu
95tZfDeQDCIi4wsKKej8zLiy23WgWft+Tm46UvYzbKr1ghM58HAeJMtiIdfv9eTw
Lw9LVMtArd/wRknFqOmnWYOD1SaVX0AnEkXWvAsL8GN6yi+bTl8UrUovXSJiOLJv
dL2titfXJbDbKj1SWfGujcdiUeOLBGoZ4NvTieqal1ywSSbsqfLhVom9ZlIhkUxj
1S0jvNKpLXYTEtc+3Q==
=4qRq
-----END PGP SIGNATURE-----

J
Re: bug#50833: [PATCH] Add Bower (notmuch curses email client)
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
20220714205052.GD1464@gac
On Mon, 11 Jul 2022 12:09:06 -0400 Maxim Cournoyer <maxim.cournoyer@gmail.com> wrote:

Maxim, give me till this weekend to attempt to finish this.

all best,

jgart
J
[PATCH v2] gnu: Add bower.
(address . 50833@debbugs.gnu.org)
20220720051833.23801-1-jgart@dismail.de
* gnu/packages/mail.scm (bower): New variable.

Hi Maxim, Here's v2 patching the executables you requested. Sorry for the delay.

all best,

jgart
---
gnu/packages/mail.scm | 80 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+)

Toggle diff (107 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 556c5b4305..afad1cc4bf 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -48,6 +48,7 @@
;;; Copyright © 2022 Justin Veilleux <terramorpha@cock.li>
;;; Copyright © 2022 Thiago Jung Bauermann <bauermann@kolabnow.com>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
+;;; Copyright © 2022 jgart <jgart@dismail.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -124,6 +125,7 @@ (define-module (gnu packages mail)
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
+ #:use-module (gnu packages mercury)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages nettle)
#:use-module (gnu packages networking)
@@ -1522,6 +1524,84 @@ (define-public python-notmuch2
(synopsis "Pythonic bindings for the notmuch mail database using CFFI")
(license license:gpl3+)))
+(define-public bower
+ (package
+ (name "bower")
+ (version "0.13")
+ (home-page "https://github.com/wangp/bower")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url home-page)
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
+ (build-system gnu-build-system)
+ (arguments
+ `(#:make-flags
+ (list
+ "bower"
+ "man"
+ (string-append "CC=" ,(cc-for-target))
+ (string-append "prefix=" %output))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'unpack 'patch-executables
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let ((file (assoc-ref inputs "file"))
+ (base64 (assoc-ref inputs "coreutils"))
+ (lynx (assoc-ref inputs "lynx"))
+ (sendmail (assoc-ref inputs "sendmail"))
+ (notmuch (assoc-ref inputs "notmuch")))
+ (substitute* "src/detect_mime_type.m"
+ (("\"file")
+ (string-append "\"" file "/bin/file")))
+ (substitute* "src/compose.m"
+ (("\"base64")
+ (string-append "\"" base64 "/bin/base64"))
+ (("\"lynx")
+ (string-append "\"" lynx "/bin/lynx")))
+ (substitute* "src/prog_config.m"
+ (("\"notmuch\"")
+ (string-append "\"" notmuch "/bin/notmuch\""))
+ (("/usr/bin/sendmail")
+ (string-append sendmail "/sbin/sendmail"))
+ (("\"lynx")
+ (string-append "\"" lynx "/bin/lynx"))))))
+ (replace 'check
+ (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+ (when tests?
+ (chdir "tests")
+ (invoke "make"))))
+ (replace 'install
+ (lambda* (#:key outpus #:allow-other-keys)
+ (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
+ (man (string-append (assoc-ref %outputs "out") "/share/man/man1")))
+ (chdir "..")
+ (install-file "bower" bin)
+ (install-file "bower.1" man)))))))
+ (native-inputs
+ (list diffutils
+ gawk
+ mercury
+ pandoc
+ util-linux))
+ (inputs
+ (list gpgme
+ coreutils
+ lynx
+ notmuch
+ sendmail
+ ncurses))
+ (synopsis "Terminal client for the notmuch email system")
+ (description "@code{bower} is a curses frontend for the notmuch email
+system. It is written in @{mercury}.")
+ (license license:gpl3+)))
+
(define-public muchsync
(package
(name "muchsync")
--
2.37.1
M
M
Maxime Devos wrote on 20 Jul 2022 13:59
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)
daf58596-3bd1-9798-14f7-84621197e6f8@telenet.be
On 20-07-2022 07:18, jgart via Guix-patches via wrote:
Toggle quote (58 lines)
> * gnu/packages/mail.scm (bower): New variable.
>
> Hi Maxim, Here's v2 patching the executables you requested. Sorry for the delay.
>
> all best,
>
> jgart
> ---
> gnu/packages/mail.scm | 80 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 80 insertions(+)
>
> diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
> index 556c5b4305..afad1cc4bf 100644
> --- a/gnu/packages/mail.scm
> +++ b/gnu/packages/mail.scm
> @@ -48,6 +48,7 @@
> ;;; Copyright © 2022 Justin Veilleux<terramorpha@cock.li>
> ;;; Copyright © 2022 Thiago Jung Bauermann<bauermann@kolabnow.com>
> ;;; Copyright © 2022 Guillaume Le Vaillant<glv@posteo.net>
> +;;; Copyright © 2022 jgart<jgart@dismail.de>
> ;;;
> ;;; This file is part of GNU Guix.
> ;;;
> @@ -124,6 +125,7 @@ (define-module (gnu packages mail)
> #:use-module (gnu packages lua)
> #:use-module (gnu packages m4)
> #:use-module (gnu packages man)
> + #:use-module (gnu packages mercury)
> #:use-module (gnu packages ncurses)
> #:use-module (gnu packages nettle)
> #:use-module (gnu packages networking)
> @@ -1522,6 +1524,84 @@ (define-public python-notmuch2
> (synopsis "Pythonic bindings for the notmuch mail database using CFFI")
> (license license:gpl3+)))
>
> +(define-public bower
> + (package
> + (name "bower")
> + (version "0.13")
> + (home-page"https://github.com/wangp/bower")
> + (source
> + (origin
> + (method git-fetch)
> + (uri
> + (git-reference
> + (url home-page)
> + (commit version)))
> + (file-name (git-file-name name version))
> + (sha256
> + (base32 "0r5s16pc3ym5nd33lv9ljv1p1gpb7yysrdni4g7w7yvjrnwk35l6"))))
> + (build-system gnu-build-system)
> + (arguments
> + `(#:make-flags
> + (list
> + "bower"
> + "man"
> + (string-append "CC=" ,(cc-for-target))
> + (string-append "prefix=" %output))
IIRC, %output is not documented -- you can use #$output instead:
(arguments
(list #:make-flags
#~(list "bower" "man" (string-append "CC=" #$(cc-for-target)) (string-append "prefix=" #$output))
[...]))
Toggle quote (13 lines)
> + #:phases
> + (modify-phases %standard-phases
> + (delete 'configure)
> + (add-after 'unpack 'patch-executables
> + (lambda* (#:key inputs #:allow-other-keys)
> + (let ((file (assoc-ref inputs "file"))
> + (base64 (assoc-ref inputs "coreutils"))
> + (lynx (assoc-ref inputs "lynx"))
> + (sendmail (assoc-ref inputs "sendmail"))
> + (notmuch (assoc-ref inputs "notmuch")))
> + (substitute* "src/detect_mime_type.m"
> + (("\"file")
> + (string-append "\"" file "/bin/file")))
Not using input labels is preferred (such that package transformations
can easily be used to, say, replace "coreutils" with something
sufficiently compatible that isn't "coreutils"). You can use
search-input-file instead. E.g.,:
(substitute* "src/detect_mime_type.m"
  ("\"file") (string-append "\"" (search-input-file inputs "/bin/file")))
  [...])
and likewise for the other substitutions.
Toggle quote (14 lines)
> + (substitute* "src/compose.m"
> + (("\"base64")
> + (string-append "\"" base64 "/bin/base64"))
> + (("\"lynx")
> + (string-append "\"" lynx "/bin/lynx")))
> + (substitute* "src/prog_config.m"
> + (("\"notmuch\"")
> + (string-append "\"" notmuch "/bin/notmuch\""))
> + (("/usr/bin/sendmail")
> + (string-append sendmail "/sbin/sendmail"))
> + (("\"lynx")
> + (string-append "\"" lynx "/bin/lynx"))))))
> + (replace 'check
> + (lambda* (#:key inputs outputs tests? #:allow-other-keys)
You are not using inputs or outputs here, so they can be removed.
Toggle quote (3 lines)
> + (when tests?
> + (chdir "tests")
> + (invoke "make"))))
Due to the issue noted below, I recommend keeping the 'chdir'
unconditional. I believe (with-directory-excursion ...) to be even
better, as it restores the change in directory automatically, less room
for trouble.
Toggle quote (2 lines)
> + (replace 'install
> + (lambda* (#:key outpus #:allow-other-keys)
You are not using 'outpus' here (also, 'outpus' -> 'outputs'), so it can
be removed.
Toggle quote (2 lines)
> + (let ((bin (string-append (assoc-ref %outputs "out") "/bin"))
> + (man (string-append (assoc-ref %outputs "out") "/share/man/man1")))
I'd replace (assoc-ref %outputs "out") by #$output (don't forget to add
#~ before the (modify-phases ...)) to avoid the assoc-ref construct and
%outputs in favour of the simpler #$output.
Toggle quote (1 lines)
> + (chdir "..")
This is to undo the (chdir "tests") above, right?  If so, remember that
the (chdir "tests") above is unconditional, so this will break when
tests are disabled (in case of --without-tests, or in case of
cross-compiling with --target=aarch64-linux-gnu or such).  So it needs
to be made conditional on tests? as well, or the (chdir "tests") from
above would need to be made unconditional, or the with-directory-excursion.
Greetings,
Maxime
Attachment: file
Attachment: OpenPGP_signature
J
(name . Maxime Devos)(address . maximedevos@telenet.be)
20220724124512.GD1765@gac
On Wed, 20 Jul 2022 13:59:19 +0200 Maxime Devos <maximedevos@telenet.be> wrote:
Toggle quote (3 lines)
>
> On 20-07-2022 07:18, jgart via Guix-patches via wrote:

Hi Maxime,

Thanks for the review!

Give me till next weekend to try again with your new suggestions.

all best,

jgart
J
[PATCH v3] gnu: Add bower.
(address . 50833@debbugs.gnu.org)
20220821065336.22194-1-jgart@dismail.de
* gnu/packages/mail.scm (bower): New variable.

Hi Maxim,

Here's a version 3 patch set.

I bumped bower to version 1.0 which was released a few days ago.

lynx is no longer configured by default in the bower sources.

all best,

jgart
---
gnu/packages/mail.scm | 72 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 72 insertions(+)

Toggle diff (99 lines)
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index b4b3162fff..dd307520df 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -49,6 +49,7 @@
;;; Copyright © 2022 Thiago Jung Bauermann <bauermann@kolabnow.com>
;;; Copyright © 2022 Guillaume Le Vaillant <glv@posteo.net>
;;; Copyright © 2022 muradm <mail@muradm.net>
+;;; Copyright © 2022 jgart <jgart@dismail.de>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -125,6 +126,7 @@ (define-module (gnu packages mail)
#:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
+ #:use-module (gnu packages mercury)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages nettle)
#:use-module (gnu packages networking)
@@ -1506,6 +1508,76 @@ (define-public python-notmuch2
(synopsis "Pythonic bindings for the notmuch mail database using CFFI")
(license license:gpl3+)))
+(define-public bower
+ (package
+ (name "bower")
+ (version "1.0")
+ (home-page "https://github.com/wangp/bower")
+ (source
+ (origin
+ (method git-fetch)
+ (uri
+ (git-reference
+ (url home-page)
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "0vcsbxlsvr2wv3c7sfr3yj21kbqy259skpxg00vf5bdkbc8qknq4"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list
+ #:make-flags
+ #~(list
+ "bower"
+ "man"
+ (string-append "CC=" #+(cc-for-target))
+ (string-append "prefix=" #$output))
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'unpack 'patch-executables
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/detect_mime_type.m"
+ (("\"file")
+ (string-append "\"" (search-input-file inputs "/bin/file"))))
+ (substitute* "src/compose.m"
+ (("\"base64")
+ (string-append "\"" (search-input-file inputs "/bin/base64"))))
+ (substitute* "src/prog_config.m"
+ (("\\(\"false")
+ (string-append "(\"" (search-input-file inputs "/bin/false")))
+ (("\\(\"notmuch\"")
+ (string-append "(\"" (search-input-file inputs "/bin/notmuch") "\""))
+ (("/usr/bin/sendmail")
+ (search-input-file inputs "/sbin/sendmail")))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion "tests"
+ (invoke "make")))))
+ (replace 'install
+ (lambda* _
+ (let ((bin (string-append #$output "/bin"))
+ (man (string-append #$output "/share/man/man1")))
+ (install-file "bower" bin)
+ (install-file "bower.1" man)))))))
+ (native-inputs
+ (list diffutils
+ gawk
+ mercury
+ pandoc
+ util-linux))
+ (inputs
+ (list gpgme
+ coreutils
+ notmuch
+ sendmail
+ ncurses))
+ (synopsis "Terminal client for the notmuch email system")
+ (description "@code{bower} is a curses frontend for the notmuch email
+system. It is written in @{mercury}.")
+ (license license:gpl3+)))
+
(define-public muchsync
(package
(name "muchsync")
--
2.37.2
M
M
Maxim Cournoyer wrote on 2 Sep 2022 16:05
Re: bug#50833: [PATCH] Add Bower (notmuch curses email client)
(name . jgart)(address . jgart@dismail.de)
87o7vx7ty2.fsf@gmail.com
Hi,

jgart <jgart@dismail.de> writes:

Toggle quote (8 lines)
> * gnu/packages/mail.scm (bower): New variable.
>
> Hi Maxim,
>
> Here's a version 3 patch set.
>
> I bumped bower to version 1.0 which was released a few days ago.

Thanks.

I've made the following changes:

Toggle snippet (115 lines)
modified gnu/packages/mail.scm
@@ -1517,51 +1517,50 @@ (define-public bower
(source
(origin
(method git-fetch)
- (uri
- (git-reference
- (url home-page)
- (commit version)))
+ (uri (git-reference
+ (url home-page)
+ (commit version)))
(file-name (git-file-name name version))
(sha256
(base32 "0vcsbxlsvr2wv3c7sfr3yj21kbqy259skpxg00vf5bdkbc8qknq4"))))
(build-system gnu-build-system)
(arguments
- (list
- #:make-flags
- #~(list
- "bower"
- "man"
- (string-append "CC=" #+(cc-for-target))
- (string-append "prefix=" #$output))
- #:phases
- #~(modify-phases %standard-phases
- (delete 'configure)
- (add-after 'unpack 'patch-executables
- (lambda* (#:key inputs #:allow-other-keys)
- (substitute* "src/detect_mime_type.m"
- (("\"file")
- (string-append "\"" (search-input-file inputs "/bin/file"))))
- (substitute* "src/compose.m"
- (("\"base64")
- (string-append "\"" (search-input-file inputs "/bin/base64"))))
- (substitute* "src/prog_config.m"
- (("\\(\"false")
- (string-append "(\"" (search-input-file inputs "/bin/false")))
- (("\\(\"notmuch\"")
- (string-append "(\"" (search-input-file inputs "/bin/notmuch") "\""))
- (("/usr/bin/sendmail")
- (search-input-file inputs "/sbin/sendmail")))))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (with-directory-excursion "tests"
- (invoke "make")))))
- (replace 'install
- (lambda* _
- (let ((bin (string-append #$output "/bin"))
- (man (string-append #$output "/share/man/man1")))
- (install-file "bower" bin)
- (install-file "bower.1" man)))))))
+ (list
+ #:make-flags #~(list "bower" "man"
+ (string-append "CC=" #+(cc-for-target))
+ (string-append "prefix=" #$output))
+ #:parallel-tests? #f ;parallelism breaks test suite
+ #:phases
+ #~(modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'unpack 'patch-executables
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* "src/detect_mime_type.m"
+ (("\"file\"")
+ (format #f "~s" (search-input-file inputs "bin/file"))))
+ (substitute* "src/compose.m"
+ (("\"base64\"")
+ (format #f "~s" (search-input-file inputs "bin/base64"))))
+ (substitute* "src/prog_config.m"
+ (("shell_quoted\\(\"false\")")
+ (format #f "shell_quoted(~s)"
+ (search-input-file inputs "bin/false")))
+ (("shell_quoted\\(\"notmuch\")")
+ (format #f "shell_quoted(~s)"
+ (search-input-file inputs "bin/notmuch")))
+ (("/usr/bin/sendmail")
+ (search-input-file inputs "/sbin/sendmail")))))
+ (replace 'check
+ (lambda* (#:key parallel-tests? tests? #:allow-other-keys)
+ (when tests?
+ (invoke "make" "-C" "tests"
+ "-j" (if parallel-tests?
+ (number->string (parallel-job-count))
+ "1")))))
+ (replace 'install
+ (lambda* _
+ (install-file "bower" (string-append #$output "/bin"))
+ (install-file "bower.1" (string-append #$output
+ "/share/man/man1")))))))
(native-inputs
(list diffutils
gawk
@@ -1569,14 +1568,14 @@ (define-public bower
pandoc
util-linux))
(inputs
- (list gpgme
- coreutils
+ (list coreutils
+ gpgme
+ ncurses
notmuch
- sendmail
- ncurses))
- (synopsis "Terminal client for the notmuch email system")
- (description "@code{bower} is a curses frontend for the notmuch email
-system. It is written in @{mercury}.")
+ sendmail))
+ (synopsis "Terminal client for the Notmuch email system")
+ (description "@code{bower} is a curses front-end for the Notmuch email
+system, written in the Mercury language.")
(license license:gpl3+)))

I also added:

Toggle snippet (3 lines)
(properties `((cpe-name . "bower-cpe-refers-to-a-different-bower")))

After realizing the CPE database referred to a different package with
the same name, reporting a false positive.

And pushed!

Thank you,

Closing.

Maxim
Closed
?