v2: Install notmuch-emacs-mua and notmuch-mutt with absolute shebangs

classic Classic list List threaded Threaded
9 messages Options
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

v2: Install notmuch-emacs-mua and notmuch-mutt with absolute shebangs

This obsoletes the WIP series at

     id:[hidden email]

There's unfortunately a bit more changes necessary to take advantage
of the configure calculated information than I anticipated, but
nothing very complicated.


_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/6] configure: absolute path of bash

This can be used to set shebang lines during install.
---
 configure | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/configure b/configure
index ab7e1610..20961763 100755
--- a/configure
+++ b/configure
@@ -53,6 +53,7 @@ fi
 
 # Set several defaults (optionally specified by the user in
 # environment variables)
+BASH=${BASH:-bash}
 CC=${CC:-cc}
 CXX=${CXX:-c++}
 CFLAGS=${CFLAGS:--g -O2}
@@ -557,6 +558,16 @@ else
     errors=$((errors + 1))
 fi
 
+printf "Checking for bash... "
+if command -v ${BASH} > /dev/null; then
+    have_bash=1
+    bash_absolute=$(command -v ${BASH})
+    printf "Yes (%s).\n" "$bash_absolute"
+else
+    have_bash=0
+    printf "No. (%s not found)\n" "${BASH}"
+fi
+
 printf "Checking for python... "
 have_python=0
 
@@ -1081,6 +1092,10 @@ emacslispdir=${EMACSLISPDIR}
 # be installed
 emacsetcdir=${EMACSETCDIR}
 
+# Whether bash exists, and if so where
+HAVE_BASH = ${have_bash}
+BASH_ABSOLUTE = ${bash_absolute}
+
 # Whether there's an emacs binary available for byte-compiling
 HAVE_EMACS = ${have_emacs}
 
@@ -1262,6 +1277,10 @@ NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
 # do we have man pages?
 NOTMUCH_HAVE_MAN=$((have_sphinx))
 
+# Whether bash exists, and if so where
+NOTMUCH_HAVE_BASH=${have_bash}
+NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
+
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
 
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/6] build: install notmuch-emacs-mua with absolute shebang

In reply to this post by David Bremner-2
Follow distro-centric rules to reduce the chance of surprising
behaviour due to PATH changes
---
 emacs/Makefile.local | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/emacs/Makefile.local b/emacs/Makefile.local
index 1b3ef584..5e4ae1bd 100644
--- a/emacs/Makefile.local
+++ b/emacs/Makefile.local
@@ -110,7 +110,10 @@ endif
  mkdir -p "$(DESTDIR)$(emacsetcdir)"
  install -m0644 $(emacs_images) "$(DESTDIR)$(emacsetcdir)"
  mkdir -p "$(DESTDIR)$(prefix)/bin/"
- install $(emacs_mua) "$(DESTDIR)$(prefix)/bin"
+ifeq ($(HAVE_BASH),1)
+ sed "1s|^#!.*|#! $(BASH_ABSOLUTE)|" < $(emacs_mua) > $(DESTDIR)$(prefix)/bin/notmuch-emacs-mua
+ chmod 755 $(DESTDIR)$(prefix)/bin/notmuch-emacs-mua
+endif
 ifeq ($(WITH_DESKTOP),1)
  mkdir -p "$(DESTDIR)$(desktop_dir)"
  desktop-file-install --mode 0644 --dir "$(DESTDIR)$(desktop_dir)" $(emacs_mua_desktop)
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/6] configure: absolute path of perl

In reply to this post by David Bremner-2
This can be used to set shebang lines during install.
---
 configure | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/configure b/configure
index 20961763..b2200be0 100755
--- a/configure
+++ b/configure
@@ -54,6 +54,7 @@ fi
 # Set several defaults (optionally specified by the user in
 # environment variables)
 BASH=${BASH:-bash}
+PERL=${PERL:-perl}
 CC=${CC:-cc}
 CXX=${CXX:-c++}
 CFLAGS=${CFLAGS:--g -O2}
@@ -568,6 +569,16 @@ else
     printf "No. (%s not found)\n" "${BASH}"
 fi
 
+printf "Checking for perl... "
+if command -v ${PERL} > /dev/null; then
+    have_perl=1
+    perl_absolute=$(command -v ${PERL})
+    printf "Yes (%s).\n" "$perl_absolute"
+else
+    have_perl=0
+    printf "No. (%s not found)\n" "${PERL}"
+fi
+
 printf "Checking for python... "
 have_python=0
 
@@ -1096,6 +1107,10 @@ emacsetcdir=${EMACSETCDIR}
 HAVE_BASH = ${have_bash}
 BASH_ABSOLUTE = ${bash_absolute}
 
+# Whether perl exists, and if so where
+HAVE_PERL = ${have_perl}
+PERL_ABSOLUTE = ${perl_absolute}
+
 # Whether there's an emacs binary available for byte-compiling
 HAVE_EMACS = ${have_emacs}
 
@@ -1281,6 +1296,10 @@ NOTMUCH_HAVE_MAN=$((have_sphinx))
 NOTMUCH_HAVE_BASH=${have_bash}
 NOTMUCH_BASH_ABSOLUTE=${bash_absolute}
 
+# Whether perl exists, and if so where
+NOTMUCH_HAVE_PERL=${have_perl}
+NOTMUCH_PERL_ABSOLUTE=${perl_absolute}
+
 # Name of python interpreter
 NOTMUCH_PYTHON=${python}
 
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 4/6] contrib/notmuch-mutt: add install target

In reply to this post by David Bremner-2
The main goal here is to be able to install the notmuch-mutt script
with an absolute shebang. I have tried to make the notmuch-mut
Makefile use configure information from notmuch if available, but make
suitable guesses if not.
---
 contrib/notmuch-mutt/Makefile | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/contrib/notmuch-mutt/Makefile b/contrib/notmuch-mutt/Makefile
index 87f9031c..855438be 100644
--- a/contrib/notmuch-mutt/Makefile
+++ b/contrib/notmuch-mutt/Makefile
@@ -1,5 +1,11 @@
 NAME = notmuch-mutt
 
+-include ../../Makefile.config
+PERL_ABSOLUTE ?= $(shell command -v perl 2>/dev/null)
+prefix ?= /usr/local
+sysconfdir ?= ${prefix}/etc
+mandir ?= ${prefix}/share/man
+
 all: $(NAME) $(NAME).1
 
 $(NAME).1: $(NAME)
@@ -8,5 +14,12 @@ $(NAME).1: $(NAME)
 README.html: README
  markdown $< > $@
 
+install: all
+ mkdir -p $(DESTDIR)$(prefix)/bin
+ sed "1s|^#!.*|#! $(PERL_ABSOLUTE)|" < $(NAME) > $(DESTDIR)$(prefix)/bin/$(NAME)
+ chmod 755 $(DESTDIR)$(prefix)/bin/$(NAME)
+ install -D -m 644 $(NAME).1 $(DESTDIR)$(mandir)/man1/$(NAME).1
+ install -D -m 644 $(NAME).rc $(DESTDIR)$(sysconfdir)/Muttrc.d/$(NAME).rc
+
 clean:
  rm -f notmuch-mutt.1 README.html
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 5/6] debian: bump compat level to 11

In reply to this post by David Bremner-2
The immediate motivation is to have dh_installman look in debian/tmp
---
 debian/compat  | 3 ++-
 debian/control | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/debian/compat b/debian/compat
index f599e28b..9f1d48ef 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1,2 @@
-10
+11
+
diff --git a/debian/control b/debian/control
index 8b390f4c..922f6d8c 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Uploaders:
 Build-Conflicts: ruby1.8, gdb-minimal, gdb [ia64 mips mips64el]
 Build-Depends:
  dpkg-dev (>= 1.17.14),
- debhelper (>= 10~),
+ debhelper (>= 11~),
  pkg-config,
  libxapian-dev,
  libgmime-3.0-dev (>= 3.0.3~) | libgmime-2.6-dev (>= 2.6.7~),
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

[PATCH 6/6] debian: update notmuch-mutt packaging to use install target

In reply to this post by David Bremner-2
---
 debian/notmuch-mutt.install  |  4 ++--
 debian/notmuch-mutt.manpages |  2 +-
 debian/notmuch.install       |  4 ++--
 debian/notmuch.manpages      | 18 ++++++++++++++++++
 debian/rules                 |  1 +
 5 files changed, 24 insertions(+), 5 deletions(-)
 create mode 100644 debian/notmuch.manpages

diff --git a/debian/notmuch-mutt.install b/debian/notmuch-mutt.install
index 9141c26f..9b468bdb 100644
--- a/debian/notmuch-mutt.install
+++ b/debian/notmuch-mutt.install
@@ -1,2 +1,2 @@
-contrib/notmuch-mutt/notmuch-mutt usr/bin
-contrib/notmuch-mutt/notmuch-mutt.rc etc/Muttrc.d
+usr/bin/notmuch-mutt
+etc/Muttrc.d/notmuch-mutt.rc
diff --git a/debian/notmuch-mutt.manpages b/debian/notmuch-mutt.manpages
index 3f6b8abd..a14ed69b 100644
--- a/debian/notmuch-mutt.manpages
+++ b/debian/notmuch-mutt.manpages
@@ -1 +1 @@
-contrib/notmuch-mutt/notmuch-mutt.1
+usr/share/man/man1/notmuch-mutt.1
diff --git a/debian/notmuch.install b/debian/notmuch.install
index 31b9a37e..e32e1ac6 100644
--- a/debian/notmuch.install
+++ b/debian/notmuch.install
@@ -1,3 +1,3 @@
-usr/bin
-usr/share/man
+usr/bin/notmuch
+usr/bin/notmuch-emacs-mua
 usr/share/bash-completion
diff --git a/debian/notmuch.manpages b/debian/notmuch.manpages
new file mode 100644
index 00000000..f9fcb54a
--- /dev/null
+++ b/debian/notmuch.manpages
@@ -0,0 +1,18 @@
+usr/share/man/man5/notmuch-hooks.5.gz
+usr/share/man/man1/notmuch-dump.1.gz
+usr/share/man/man1/notmuch-count.1.gz
+usr/share/man/man1/notmuch-compact.1.gz
+usr/share/man/man1/notmuch-emacs-mua.1.gz
+usr/share/man/man1/notmuch-new.1.gz
+usr/share/man/man1/notmuch.1.gz
+usr/share/man/man1/notmuch-reindex.1.gz
+usr/share/man/man1/notmuch-address.1.gz
+usr/share/man/man1/notmuch-tag.1.gz
+usr/share/man/man1/notmuch-reply.1.gz
+usr/share/man/man1/notmuch-search.1.gz
+usr/share/man/man1/notmuch-restore.1.gz
+usr/share/man/man1/notmuch-insert.1.gz
+usr/share/man/man1/notmuch-show.1.gz
+usr/share/man/man1/notmuch-config.1.gz
+usr/share/man/man7/notmuch-properties.7.gz
+usr/share/man/man7/notmuch-search-terms.7.gz
diff --git a/debian/rules b/debian/rules
index 1ac6498c..07b755c0 100755
--- a/debian/rules
+++ b/debian/rules
@@ -31,4 +31,5 @@ override_dh_auto_install:
  dh_auto_install
  dh_auto_install --sourcedirectory bindings/python
  cd bindings/python && $(python3_all) setup.py install --install-layout=deb --root=$(CURDIR)/debian/tmp
+ $(MAKE) -C contrib/notmuch-mutt DESTDIR=$(CURDIR)/debian/tmp install
  dh_auto_install --sourcedirectory bindings/ruby
--
2.18.0

_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 4/6] contrib/notmuch-mutt: add install target

In reply to this post by David Bremner-2
On Sun, Sep 16 2018, David Bremner wrote:

> The main goal here is to be able to install the notmuch-mutt script
> with an absolute shebang. I have tried to make the notmuch-mut

Series looks pretty good to me... mut mut should probably be mutt ;D

Also we probably don't care those who have footguns in form of relative
directories in $PATH ;)

Example:
    ~$ PATH=./bin:$PATH command -v notmuch
    ./bin/notmuch
    ~$

Tomi


> Makefile use configure information from notmuch if available, but make
> suitable guesses if not.
> ---
>  contrib/notmuch-mutt/Makefile | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/contrib/notmuch-mutt/Makefile b/contrib/notmuch-mutt/Makefile
> index 87f9031c..855438be 100644
> --- a/contrib/notmuch-mutt/Makefile
> +++ b/contrib/notmuch-mutt/Makefile
> @@ -1,5 +1,11 @@
>  NAME = notmuch-mutt
>  
> +-include ../../Makefile.config
> +PERL_ABSOLUTE ?= $(shell command -v perl 2>/dev/null)
> +prefix ?= /usr/local
> +sysconfdir ?= ${prefix}/etc
> +mandir ?= ${prefix}/share/man
> +
>  all: $(NAME) $(NAME).1
>  
>  $(NAME).1: $(NAME)
> @@ -8,5 +14,12 @@ $(NAME).1: $(NAME)
>  README.html: README
>   markdown $< > $@
>  
> +install: all
> + mkdir -p $(DESTDIR)$(prefix)/bin
> + sed "1s|^#!.*|#! $(PERL_ABSOLUTE)|" < $(NAME) > $(DESTDIR)$(prefix)/bin/$(NAME)
> + chmod 755 $(DESTDIR)$(prefix)/bin/$(NAME)
> + install -D -m 644 $(NAME).1 $(DESTDIR)$(mandir)/man1/$(NAME).1
> + install -D -m 644 $(NAME).rc $(DESTDIR)$(sysconfdir)/Muttrc.d/$(NAME).rc
> +
>  clean:
>   rm -f notmuch-mutt.1 README.html
> --
> 2.18.0
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> https://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 4/6] contrib/notmuch-mutt: add install target

Tomi Ollila <[hidden email]> writes:

> On Sun, Sep 16 2018, David Bremner wrote:
>
>> The main goal here is to be able to install the notmuch-mutt script
>> with an absolute shebang. I have tried to make the notmuch-mut
>
> Series looks pretty good to me... mut mut should probably be mutt ;D

Done, and pushed.

>
> Also we probably don't care those who have footguns in form of relative
> directories in $PATH ;)

Yes, people with extra copies of bash and perl laying around will have
to take extra care, probably passing BASH=foo and PERL=bar in the
configure environment.

d
_______________________________________________
notmuch mailing list
[hidden email]
https://notmuchmail.org/mailman/listinfo/notmuch