[RFC PATCH] python-cffi out-of-tree build

2021-02-17 Thread Tomi Ollila
setup.py and _build.py to refer some other files based on directory where setup.py is located (os.path.dirname(sys.argv[0]). Dropped bindings/python-cffi/version.txt and refer ../../version.txt instead -- _build.py already refers ../../lib so why have version.txt twice (with identical content).

[PATCH 03/21] lib: support reopening databases for write access.

2021-02-17 Thread David Bremner
In the future xapian will apparently support this more conveniently for the cases other than READ_ONLY => READ_ONLY --- lib/database.cc | 23 lib/notmuch.h | 6 +++ lib/open.cc | 45 test/T595-reopen.sh | 125

[PATCH 02/21] lib: save path of xapian database in notmuch struct.

2021-02-17 Thread David Bremner
This will allow re-opening in a different mode (read/write vs. read-only) with current Xapian API. --- lib/database-private.h | 4 lib/open.cc| 19 ++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/database-private.h b/lib/database-private.h

[PATCH 18/21] lib/compact: enable split config

2021-02-17 Thread David Bremner
This promotes _choose_xapian_path from static to extern linkage in order to share between open.cc and database.cc. --- lib/database.cc | 13 - lib/notmuch-private.h| 4 lib/open.cc | 6 +++--- test/T055-path-config.sh | 7 +++ 4 files changed, 18

[PATCH 19/21] lib/open: fix hook directory calculation in split configuration

2021-02-17 Thread David Bremner
Choose sibling directory of xapian database, as .notmuch may not exist. --- lib/open.cc| 6 -- test/T400-hooks.sh | 9 - 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index 1e2a62cd..4324deae 100644 --- a/lib/open.cc +++

[PATCH 17/21] CLI/insert: support split database and mail root

2021-02-17 Thread David Bremner
The new test is in T055-path-config because it uses the helper function split_config, and because it seems easier to follow the database path related tests in one place. --- notmuch-insert.c | 12 +++- test/T055-path-config.sh | 10 ++ 2 files changed, 13 insertions(+), 9

[PATCH 13/21] support splitting mail from database location.

2021-02-17 Thread David Bremner
Introduce a new configuration value for the mail root, and use it in preference to the database.path (which previously implied the mail was also in this location. Further changes to the CLI will be needed to work in this split configuration. --- doc/man1/notmuch-config.rst | 14 --

[PATCH 10/21] lib/open: factor out the second half of n_d_open_with_config

2021-02-17 Thread David Bremner
The idea is to allow reuse in n_d_create_with_config. This is primarily code movement, with some changes in error messages to reduce the number of input parameters. --- lib/open.cc | 115 +++- 1 file changed, 68 insertions(+), 47 deletions(-) diff

[PATCH 12/21] lib/open: Use check for existing database by trial opening

2021-02-17 Thread David Bremner
This is a bit heavyweight for now, but it will make more sense when we check multiple locations for the xapian database. --- lib/open.cc| 67 +++--- test/T360-symbol-hiding.sh | 2 +- 2 files changed, 49 insertions(+), 20 deletions(-) diff --git

[PATCH 21/21] CLI/new: use configuration variable for backup directory

2021-02-17 Thread David Bremner
The stat is dropped to avoid a race condition between stat and mkdir. This changes the default location for backups to make things tidier. Hopefully there is not user scripts relying on this location. --- notmuch-new.c| 18 ++ test/T055-path-config.sh | 15

[PATCH 15/21] CLI/new: support split database and mail location

2021-02-17 Thread David Bremner
This adds new state variable for the mail root, and uses it most places db_path was used. The notable exception is dumps from backups. --- notmuch-new.c| 54 ++-- test/T055-path-config.sh | 41 ++ 2 files changed, 76

[PATCH 08/21] lib/open: factor out library initialization

2021-02-17 Thread David Bremner
This is slightly more tidy, but more importantly it allows for re-use of this code in n_d_create_with_config. --- lib/open.cc | 29 ++--- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index d599aeac..7f25bd36 100644 ---

[PATCH 20/21] lib/config: add configuration variable for backup directory

2021-02-17 Thread David Bremner
Like the hook directory, we primarily need a way to communicate this directory between various components, but we may as well let the user configure it. --- lib/config.cc | 3 +++ lib/notmuch.h | 1 + lib/open.cc| 47 --

v2 flexible database location

2021-02-17 Thread David Bremner
This is series 2 of 3 revamping configuration. It obsoletes [1]. The first 4 patches are really unfinished business from the the first series already merged to master. They bring merged configuration (no more "Defined in Database") to notmuch-show (leaving only notmuch-config and notmuch-setup

[PATCH 01/21] lib: publish API for notmuch_database_reopen

2021-02-17 Thread David Bremner
Include the (currently unused) mode argument which will specify which mode to re-open the database in. Functionality and docs to be finalized in a followup commit. --- lib/database.cc | 3 ++- lib/message.cc| 3 ++- lib/notmuch-private.h | 3 --- lib/notmuch.h | 7 +++ 4

[PATCH 05/21] lib/open: support NOTMUCH_DATABASE environment variable

2021-02-17 Thread David Bremner
The additional code is trivial, but making sure we get the priority of various options correct takes a few tests. --- lib/open.cc| 4 +++ test/T590-libconfig.sh | 67 +- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/lib/open.cc

[PATCH 14/21] lib/open: check for split configuration when creating database.

2021-02-17 Thread David Bremner
This will be tested when notmuch-new is converted to support split configuration. --- lib/open.cc | 53 ++-- test/T055-path-config.sh | 15 ++-- 2 files changed, 53 insertions(+), 15 deletions(-) diff --git a/lib/open.cc b/lib/open.cc

[PATCH 16/21] lib/open: support XDG_DATA_HOME as a fallback database location.

2021-02-17 Thread David Bremner
This changes some error reporting, either intentionally by reporting the highest level missing directory, or by side effect from looking in XDG locations when given null database location. --- lib/open.cc | 18 +++--- test/T055-path-config.sh | 35

[PATCH 11/21] lib/open: use _finish_open in n_d_create_with_config

2021-02-17 Thread David Bremner
This avoids reading the configuration file twice. --- lib/open.cc | 19 +++ 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index d052f95d..ebf70c15 100644 --- a/lib/open.cc +++ b/lib/open.cc @@ -429,8 +429,7 @@

[PATCH 09/21] lib/open: reuse directory checks from n_d_c_with_config

2021-02-17 Thread David Bremner
Make checks more uniform between creating new databases and opening existing ones. --- lib/open.cc | 73 +--- test/T030-config.sh | 2 +- test/T560-lib-error.sh | 4 +-- test/T750-user-header.sh | 2 +- 4 files changed, 50 insertions(+),

[PATCH 06/21] lib/open: allocate notmuch_t struct early

2021-02-17 Thread David Bremner
This gives more flexibility in restructuring the database opening code. --- lib/open.cc | 46 +- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/lib/open.cc b/lib/open.cc index f08b5de5..c7fb6f81 100644 --- a/lib/open.cc +++

[PATCH 04/21] CLI/show: complete conversion to new configuration framework.

2021-02-17 Thread David Bremner
In order to open the database in main() for this command, we may need to re-open it in the (possibly less common) case where crypto options require it. --- notmuch-show.c | 26 +++--- notmuch.c| 2 +- test/T035-read-config.sh | 2 -- 3 files

[PATCH 07/21] lib: remove "path" from notmuch struct

2021-02-17 Thread David Bremner
This removes duplication between the struct element and the configuration string_map entry. --- lib/config.cc | 3 +++ lib/database-private.h | 3 --- lib/database.cc| 2 +- lib/open.cc| 13 +++-- 4 files changed, 15 insertions(+), 6 deletions(-) diff