]> git.cworth.org Git - notmuch/commitdiff
Merge branch 'release'
authorDavid Bremner <david@tethera.net>
Wed, 29 Dec 2021 18:20:49 +0000 (14:20 -0400)
committerDavid Bremner <david@tethera.net>
Wed, 29 Dec 2021 18:20:49 +0000 (14:20 -0400)
1  2 
configure
lib/open.cc
test/T055-path-config.sh

diff --combined configure
index d399457a92f36cd75810d0d226143852f2a3a811,9b692b3e0f0bb45eb0e97ec5029e95c3c31ca4bf..e7bb7edcbda39ee4184689e7797532382c426d3e
+++ b/configure
@@@ -55,6 -55,8 +55,8 @@@ subdirs="${subdirs} bindings
  # the directory structure and copy Makefiles.
  if [ "$srcdir" != "." ]; then
  
+     NOTMUCH_BUILDDIR=$PWD
      for dir in . ${subdirs}; do
        mkdir -p "$dir"
        cp "$srcdir"/"$dir"/Makefile.local "$dir"
@@@ -78,6 -80,8 +80,8 @@@
         "$srcdir"/bindings/python-cffi/notmuch2 \
         "$srcdir"/bindings/python-cffi/setup.py \
         bindings/python-cffi/
+ else
+     NOTMUCH_BUILDDIR=$NOTMUCH_SRCDIR
  fi
  
  # Set several defaults (optionally specified by the user in
@@@ -734,7 -738,6 +738,7 @@@ if command -v ${BASHCMD} > /dev/null; t
      printf "Yes (%s).\n" "$bash_absolute"
  else
      have_bash=0
 +    bash_absolute=
      printf "No. (%s not found)\n" "${BASHCMD}"
  fi
  
@@@ -745,7 -748,6 +749,7 @@@ if command -v ${PERL} > /dev/null; the
      printf "Yes (%s).\n" "$perl_absolute"
  else
      have_perl=0
 +    perl_absolute=
      printf "No. (%s not found)\n" "${PERL}"
  fi
  
@@@ -1247,6 -1249,7 +1251,7 @@@ cat > Makefile.config <<EO
  # directory (the current directory at the time configure was run).
  srcdir = ${srcdir}
  NOTMUCH_SRCDIR = ${NOTMUCH_SRCDIR}
+ NOTMUCH_BUILDDIR = ${NOTMUCH_BUILDDIR}
  
  # subdirectories to build
  subdirs = ${subdirs}
      printf "rsti_dir = '%s'\n" "$(cd emacs && pwd -P)"
  } > sphinx.config
  
 +cat > bindings/python-cffi/_notmuch_config.py <<EOF
 +# _notmuch_config.py was automatically generated by the configure
 +# script in the root of the notmuch source tree.
 +NOTMUCH_VERSION_FILE='${NOTMUCH_SRCDIR}/version.txt'
 +NOTMUCH_INCLUDE_DIR='${NOTMUCH_SRCDIR}/lib'
 +NOTMUCH_LIB_DIR='${NOTMUCH_SRCDIR}/lib'
 +EOF
 +
  # Finally, after everything configured, inform the user how to continue.
  cat <<EOF
  
diff --combined lib/open.cc
index a91d22efe6ecbf5e133dc1daded781229f9bf0a9,4dd62a9f25caafc5baec4803ee883e8bca333018..54510eace89b04a565a1b868af2d7f88d44f1e66
@@@ -19,8 -19,9 +19,8 @@@ notmuch_database_open (const char *path
      char *status_string = NULL;
      notmuch_status_t status;
  
 -    status = notmuch_database_open_verbose (path, mode, database,
 -                                          &status_string);
 -
 +    status = notmuch_database_open_with_config (path, mode, "", NULL,
 +                                              database, &status_string);
      if (status_string) {
        fputs (status_string, stderr);
        free (status_string);
@@@ -198,7 -199,7 +198,7 @@@ _choose_database_path (void *ctx
      }
  
      if (! *database_path && key_file) {
 -      char *path = g_key_file_get_value (key_file, "database", "path", NULL);
 +      char *path = g_key_file_get_string (key_file, "database", "path", NULL);
        if (path) {
            if (path[0] == '/')
                *database_path = talloc_strdup (ctx, path);
@@@ -642,7 -643,7 +642,7 @@@ notmuch_database_create_with_config (co
  
      if (key_file && ! split) {
        char *mail_root = notmuch_canonicalize_file_name (
 -          g_key_file_get_value (key_file, "database", "mail_root", NULL));
 +          g_key_file_get_string (key_file, "database", "mail_root", NULL));
        char *db_path = notmuch_canonicalize_file_name (database_path);
  
        split = (mail_root && (0 != strcmp (mail_root, db_path)));
  
        err = mkdir (notmuch_path, 0755);
        if (err) {
-           if (errno == EEXIST) {
-               status = NOTMUCH_STATUS_DATABASE_EXISTS;
-               talloc_free (notmuch);
-               notmuch = NULL;
-           } else {
+           if (errno != EEXIST) {
                IGNORE_RESULT (asprintf (&message, "Error: Cannot create directory %s: %s.\n",
                                         notmuch_path, strerror (errno)));
                status = NOTMUCH_STATUS_FILE_ERROR;
+               goto DONE;
            }
-           goto DONE;
        }
      }
  
diff --combined test/T055-path-config.sh
index f0ce55dac93a494d51ab3eab9cb1c9bbcdb9c9a7,b910e28ee6257ac8734bcde968257fb7ddb471f9..1df240dd0cec2665c17faebc2b833cf4ccac73c3
@@@ -277,7 -277,7 +277,7 @@@ EO
  built_with.compact=something
  built_with.field_processor=something
  built_with.retry_lock=something
 -built_with.sexpr_query=something
 +built_with.sexp_queries=something
  database.autocommit=8000
  database.backup_dir
  database.hook_dir
@@@ -318,7 -318,14 +318,14 @@@ to=m.header('To'
  print(to)
  EOF
           test_expect_equal_file EXPECTED OUTPUT
-          ;& # fall through
+          ;;
+        *)
+          backup_database
+          test_begin_subtest ".notmuch without xapian/ handled gracefully ($config)"
+          rm -r $XAPIAN_PATH
+          test_expect_success "notmuch new"
+          restore_database
+          ;;
     esac
  
     case $config in