]> git.cworth.org Git - notmuch/commitdiff
build: drop support for xapian versions less than 1.4
authorTomi Ollila <tomi.ollila@iki.fi>
Tue, 21 Apr 2020 21:07:29 +0000 (00:07 +0300)
committerDavid Bremner <david@tethera.net>
Fri, 24 Apr 2020 00:28:45 +0000 (21:28 -0300)
Xapian 1.4 is over 3 years old now (1.4.0 released 2016-06-24),
and 1.2 has been deprecated in Notmuch version 0.27 (2018-06-13).

Xapian 1.4 supports compaction, field processors and retry locking;
conditionals checking compaction and field processors were removed
but user may want to disable retry locking at configure time so it
is kept.

17 files changed:
configure
lib/built-with.c
lib/database.cc
lib/parse-time-vrp.cc
lib/parse-time-vrp.h
lib/query-fp.cc
lib/query-fp.h
lib/regexp-fields.cc
lib/regexp-fields.h
lib/thread-fp.cc
lib/thread-fp.h
test/T020-compact.sh
test/T500-search-date.sh
test/T585-thread-subquery.sh
test/T600-named-queries.sh
test/T650-regexp-query.sh
test/T670-duplicate-mid.sh

index 70031d14f8f91e891c57b5f977ffdbe9c85e098c..0cfdaa6f5cd2416cc76c305a8ccd72acb4e11bb7 100755 (executable)
--- a/configure
+++ b/configure
@@ -422,15 +422,22 @@ else
     have_pkg_config=0
 fi
 
-printf "Checking for Xapian development files... "
+
+
+printf "Checking for Xapian development files (>= 1.4.0)... "
 have_xapian=0
-for xapian_config in ${XAPIAN_CONFIG} xapian-config xapian-config-1.3; do
+for xapian_config in ${XAPIAN_CONFIG} xapian-config; do
     if ${xapian_config} --version > /dev/null 2>&1; then
        xapian_version=$(${xapian_config} --version | sed -e 's/.* //')
-       printf "Yes (%s).\n" ${xapian_version}
-       have_xapian=1
-       xapian_cxxflags=$(${xapian_config} --cxxflags)
-       xapian_ldflags=$(${xapian_config} --libs)
+       case $xapian_version in
+               1.[4-9]* | 1.[1-9][0-9]* | [2-9]* | [1-9][0-9]*)
+                       printf "Yes (%s).\n" ${xapian_version}
+                       have_xapian=1
+                       xapian_cxxflags=$(${xapian_config} --cxxflags)
+                       xapian_ldflags=$(${xapian_config} --libs)
+                       ;;
+               *) printf "Xapian $xapian_version not supported... "
+       esac
        break
     fi
 done
@@ -439,59 +446,8 @@ if [ ${have_xapian} = "0" ]; then
     errors=$((errors + 1))
 fi
 
-have_xapian_compact=0
-have_xapian_field_processor=0
 if [ ${have_xapian} = "1" ]; then
-    printf "Checking for Xapian compaction support... "
-    cat>_compact.cc<<EOF
-#include <xapian.h>
-class TestCompactor : public Xapian::Compactor { };
-EOF
-    if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _compact.cc -o _compact.o > /dev/null 2>&1
-    then
-       have_xapian_compact=1
-       printf "Yes.\n"
-    else
-       printf "No.\n"
-       errors=$((errors + 1))
-    fi
-
-    rm -f _compact.o _compact.cc
-
-    printf "Checking for Xapian FieldProcessor API... "
-    cat>_field_processor.cc<<EOF
-#include <xapian.h>
-class TitleFieldProcessor : public Xapian::FieldProcessor { };
-EOF
-    if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _field_processor.cc -o _field_processor.o > /dev/null 2>&1
-    then
-       have_xapian_field_processor=1
-       printf "Yes.\n"
-    else
-       printf "No. (optional)\n"
-    fi
-
-    rm -f _field_processor.o _field_processor.cc
-
     default_xapian_backend=""
-    # DB_RETRY_LOCK is only supported on Xapian > 1.3.2
-    have_xapian_db_retry_lock=0
-    if [ $WITH_RETRY_LOCK = "1" ]; then
-       printf "Checking for Xapian lock retry support... "
-       cat>_retry.cc<<EOF
-#include <xapian.h>
-int flag = Xapian::DB_RETRY_LOCK;
-EOF
-       if ${CXX} ${CXXFLAGS_for_sh} ${xapian_cxxflags} -c _retry.cc -o _retry.o > /dev/null 2>&1
-       then
-           have_xapian_db_retry_lock=1
-           printf "Yes.\n"
-       else
-           printf "No. (optional)\n"
-       fi
-       rm -f _retry.o _retry.cc
-    fi
-
     printf "Testing default Xapian backend... "
     cat >_default_backend.cc <<EOF
 #include <xapian.h>
@@ -879,8 +835,8 @@ EOF
     if [ $have_python -eq 0 ]; then
        echo "  python interpreter"
     fi
-    if [ $have_xapian -eq 0 -o $have_xapian_compact -eq 0 ]; then
-       echo "  Xapian library (>= version 1.2.6, including development files such as headers)"
+    if [ $have_xapian -eq 0 ]; then
+       echo "  Xapian library (>= version 1.4.0, including development files such as headers)"
        echo "  https://xapian.org/"
     fi
     if [ $have_zlib -eq 0 ]; then
@@ -1278,14 +1234,8 @@ HAVE_TIMEGM = ${have_timegm}
 # Whether struct dirent has d_type (if not, then notmuch will use stat)
 HAVE_D_TYPE = ${have_d_type}
 
-# Whether the Xapian version in use supports compaction
-HAVE_XAPIAN_COMPACT = ${have_xapian_compact}
-
-# Whether the Xapian version in use supports field processors
-HAVE_XAPIAN_FIELD_PROCESSOR = ${have_xapian_field_processor}
-
-# Whether the Xapian version in use supports DB_RETRY_LOCK
-HAVE_XAPIAN_DB_RETRY_LOCK = ${have_xapian_db_retry_lock}
+# Whether to have Xapian retry lock
+HAVE_XAPIAN_DB_RETRY_LOCK = ${WITH_RETRY_LOCK}
 
 # Whether the getpwuid_r function is standards-compliant
 # (if not, then notmuch will #define _POSIX_PTHREAD_SEMANTICS
@@ -1309,9 +1259,6 @@ LINKER_RESOLVES_LIBRARY_DEPENDENCIES = ${linker_resolves_library_dependencies}
 XAPIAN_CXXFLAGS = ${xapian_cxxflags}
 XAPIAN_LDFLAGS = ${xapian_ldflags}
 
-# Which backend will Xapian use by default?
-DEFAULT_XAPIAN_BACKEND = ${default_xapian_backend}
-
 # Flags needed to compile and link against GMime
 GMIME_CFLAGS = ${gmime_cflags}
 GMIME_LDFLAGS = ${gmime_ldflags}
@@ -1364,16 +1311,14 @@ COMMON_CONFIGURE_CFLAGS = \\
        -DHAVE_D_TYPE=\$(HAVE_D_TYPE)                           \\
        -DSTD_GETPWUID=\$(STD_GETPWUID)                         \\
        -DSTD_ASCTIME=\$(STD_ASCTIME)                           \\
-       -DHAVE_XAPIAN_COMPACT=\$(HAVE_XAPIAN_COMPACT)           \\
        -DSILENCE_XAPIAN_DEPRECATION_WARNINGS                   \\
-       -DHAVE_XAPIAN_FIELD_PROCESSOR=\$(HAVE_XAPIAN_FIELD_PROCESSOR) \\
        -DHAVE_XAPIAN_DB_RETRY_LOCK=\$(HAVE_XAPIAN_DB_RETRY_LOCK)
 
 CONFIGURE_CFLAGS = \$(COMMON_CONFIGURE_CFLAGS)
 
 CONFIGURE_CXXFLAGS = \$(COMMON_CONFIGURE_CFLAGS) \$(XAPIAN_CXXFLAGS)
 
-CONFIGURE_LDFLAGS =  \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
+CONFIGURE_LDFLAGS = \$(GMIME_LDFLAGS) \$(TALLOC_LDFLAGS) \$(ZLIB_LDFLAGS) \$(XAPIAN_LDFLAGS)
 EOF
 
 # construct the sh.config
@@ -1383,14 +1328,8 @@ cat > sh.config <<EOF
 
 NOTMUCH_SRCDIR='${NOTMUCH_SRCDIR}'
 
-# Whether the Xapian version in use supports compaction
-NOTMUCH_HAVE_XAPIAN_COMPACT=${have_xapian_compact}
-
-# Whether the Xapian version in use supports field processors
-NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR=${have_xapian_field_processor}
-
-# Whether the Xapian version in use supports lock retry
-NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${have_xapian_db_retry_lock}
+# Whether to have Xapian retry lock
+NOTMUCH_HAVE_XAPIAN_DB_RETRY_LOCK=${WITH_RETRY_LOCK}
 
 # Which backend will Xapian use by default?
 NOTMUCH_DEFAULT_XAPIAN_BACKEND=${default_xapian_backend}
index 320be6c5ed20d1e2114ae88ed1d37b92666a0b12..0c70010beca5548c012b531edb70691703df5ca6 100644 (file)
@@ -25,9 +25,9 @@ notmuch_bool_t
 notmuch_built_with (const char *name)
 {
     if (STRNCMP_LITERAL (name, "compact") == 0) {
-       return HAVE_XAPIAN_COMPACT;
+       return true;
     } else if (STRNCMP_LITERAL (name, "field_processor") == 0) {
-       return HAVE_XAPIAN_FIELD_PROCESSOR;
+       return true;
     } else if (STRNCMP_LITERAL (name, "retry_lock") == 0) {
        return HAVE_XAPIAN_DB_RETRY_LOCK;
     } else if (STRNCMP_LITERAL (name, "session_key") == 0) {
index 24b7ec4390096a6ba3b1f36a705d89c59f6c6b51..78b5fec921920c6fb3952417915c68aee10d7e8e 100644 (file)
@@ -291,12 +291,10 @@ prefix_t prefix_table[] = {
      */
     { "folder",                 "XFOLDER:",     NOTMUCH_FIELD_EXTERNAL |
       NOTMUCH_FIELD_PROCESSOR },
-#if HAVE_XAPIAN_FIELD_PROCESSOR
     { "date",                   NULL,           NOTMUCH_FIELD_EXTERNAL |
       NOTMUCH_FIELD_PROCESSOR },
     { "query",                  NULL,           NOTMUCH_FIELD_EXTERNAL |
       NOTMUCH_FIELD_PROCESSOR },
-#endif
     { "from",                   "XFROM",        NOTMUCH_FIELD_EXTERNAL |
       NOTMUCH_FIELD_PROBABILISTIC |
       NOTMUCH_FIELD_PROCESSOR },
@@ -380,7 +378,6 @@ _setup_user_query_fields (notmuch_database_t *notmuch)
     return NOTMUCH_STATUS_SUCCESS;
 }
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 static void
 _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch)
 {
@@ -405,13 +402,6 @@ _setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch)
        _setup_query_field_default (prefix, notmuch);
     }
 }
-#else
-static inline void
-_setup_query_field (const prefix_t *prefix, notmuch_database_t *notmuch)
-{
-    _setup_query_field_default (prefix, notmuch);
-}
-#endif
 
 const char *
 _find_prefix (const char *name)
index 45db959718e30c5f9178ef02cb050864bef4cb1e..168d58106db6e700bdf414cab1b120cb9cb49f75 100644 (file)
@@ -65,7 +65,6 @@ ParseTimeValueRangeProcessor::operator() (std::string &begin, std::string &end)
     return valno;
 }
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 /* XXX TODO: is throwing an exception the right thing to do here? */
 Xapian::Query
 DateFieldProcessor::operator() (const std::string & str)
@@ -86,4 +85,3 @@ DateFieldProcessor::operator() (const std::string & str)
                          Xapian::Query (Xapian::Query::OP_VALUE_GE, 0, Xapian::sortable_serialise ((double) from)),
                          Xapian::Query (Xapian::Query::OP_VALUE_LE, 0, Xapian::sortable_serialise ((double) to)));
 }
-#endif
index e6138d05b4a5113718eb2047e84994505fb96344..9fb1af609d975d13c71f1d3481203ba40be0ee23 100644 (file)
@@ -39,9 +39,8 @@ public:
     Xapian::valueno operator() (std::string &begin, std::string &end);
 };
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 class DateFieldProcessor : public Xapian::FieldProcessor {
     Xapian::Query operator() (const std::string & str);
 };
-#endif
+
 #endif /* NOTMUCH_PARSE_TIME_VRP_H */
index c39f59156d1f9e32f53bfd09bac21340328d2480..b980b7f06669402c2f592ed0159a8c034ca1a157 100644 (file)
@@ -24,8 +24,6 @@
 #include "query-fp.h"
 #include <iostream>
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
-
 Xapian::Query
 QueryFieldProcessor::operator() (const std::string & name)
 {
@@ -40,4 +38,3 @@ QueryFieldProcessor::operator() (const std::string & name)
 
     return parser.parse_query (expansion, NOTMUCH_QUERY_PARSER_FLAGS);
 }
-#endif
index 8a8bde62a7977d5e63622a90fc835373b70bb4f2..beaaf4054cd921b508b25acaa5a719f072033ab3 100644 (file)
@@ -26,7 +26,6 @@
 #include <xapian.h>
 #include "notmuch.h"
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 class QueryFieldProcessor : public Xapian::FieldProcessor {
 protected:
     Xapian::QueryParser &parser;
@@ -40,5 +39,5 @@ public:
 
     Xapian::Query operator() (const std::string & str);
 };
-#endif
+
 #endif /* NOTMUCH_QUERY_FP_H */
index 198eb32f49583310d984ace493ad25924b998a50..0feb50e586ba84f1c4ef84cb62e78ea679b472c3 100644 (file)
@@ -26,7 +26,6 @@
 #include "notmuch-private.h"
 #include "database-private.h"
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 static void
 compile_regex (regex_t &regexp, const char *str)
 {
@@ -208,4 +207,3 @@ RegexpFieldProcessor::operator() (const std::string & str)
        }
     }
 }
-#endif
index 97778a1d6200fc0a20a42d1db6ca668279784c6e..a8cca2431d737d9284c66ba311f9f9f26f4d0268 100644 (file)
@@ -24,7 +24,7 @@
 
 #ifndef NOTMUCH_REGEXP_FIELDS_H
 #define NOTMUCH_REGEXP_FIELDS_H
-#if HAVE_XAPIAN_FIELD_PROCESSOR
+
 #include <sys/types.h>
 #include <regex.h>
 #include "database-private.h"
@@ -79,5 +79,5 @@ public:
 
     Xapian::Query operator() (const std::string & str);
 };
-#endif
+
 #endif /* NOTMUCH_REGEXP_FIELDS_H */
index 7327700653bcab8ead048b55257617dfe9f52bc3..97a65211992654b629269a74bdde0d6bbf82504f 100644 (file)
@@ -24,8 +24,6 @@
 #include "thread-fp.h"
 #include <iostream>
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
-
 Xapian::Query
 ThreadFieldProcessor::operator() (const std::string & str)
 {
@@ -64,4 +62,3 @@ ThreadFieldProcessor::operator() (const std::string & str)
     }
 
 }
-#endif
index de837d3e7128d3ff240e0f2a33ac1319ac291830..00bf1aa286f78cfd6acaa6268fc291e72984e796 100644 (file)
@@ -26,7 +26,6 @@
 #include <xapian.h>
 #include "notmuch.h"
 
-#if HAVE_XAPIAN_FIELD_PROCESSOR
 class ThreadFieldProcessor : public Xapian::FieldProcessor {
 protected:
     Xapian::QueryParser &parser;
@@ -40,5 +39,5 @@ public:
 
     Xapian::Query operator() (const std::string & str);
 };
-#endif
+
 #endif /* NOTMUCH_THREAD_FP_H */
index 58cd2ba74cefd7f9a1b6fa6808be7fd77c424a1c..02f8738fdfb5ce9b1ebe826f47781916dbab9286 100755 (executable)
@@ -10,18 +10,6 @@ notmuch tag +tag1 \*
 notmuch tag +tag2 subject:Two
 notmuch tag -tag1 +tag3 subject:Three
 
-if [ $NOTMUCH_HAVE_XAPIAN_COMPACT -eq 0 ]; then
-    test_begin_subtest "Compact unsupported: error message"
-    output=$(notmuch compact --quiet 2>&1)
-    test_expect_equal "$output" "notmuch was compiled against a xapian version lacking compaction support.
-Compaction failed: Unsupported operation"
-
-    test_begin_subtest "Compact unsupported: status code"
-    test_expect_code 1 "notmuch compact"
-
-    test_done
-fi
-
 test_begin_subtest "Running compact"
 test_expect_success "notmuch compact --backup=${TEST_DIRECTORY}/xapian.old"
 
index f84b0962c25ee5446d94b6208e88035f29c43e1e..85ff831f4f6d163ccf5bf2f26a9d32932ea1e017 100755 (executable)
@@ -14,9 +14,6 @@ test_expect_equal "$output" "thread:XXX   2010-12-16 [1/1] Olivier Berger; Essai
 
 test_begin_subtest "Absolute date field"
 output=$(notmuch search date:2010-12-16 | notmuch_search_sanitize)
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -ne 1 ]; then
-    test_subtest_known_broken
-fi
 test_expect_equal "$output" "thread:XXX   2010-12-16 [1/1] Olivier Berger; Essai accentuĂ© (inbox unread)"
 
 test_begin_subtest "Absolute time range with TZ"
index bf9894d3cb457cbb4e312327c5dfa3814ad6ae3b..71ced1491568d5514307c29b9e9035205c585bf3 100755 (executable)
@@ -14,9 +14,6 @@ count=$(notmuch count from:keithp and to:keithp)
 test_expect_equal 0 "$count"
 
 test_begin_subtest "Same query against threads"
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
-    test_subtest_known_broken
-fi
 notmuch search thread:{from:keithp} and thread:{to:keithp} | notmuch_search_sanitize > OUTPUT
 cat<<EOF > EXPECTED
 thread:XXX   2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
@@ -24,9 +21,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Mix thread and non-threads query"
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
-    test_subtest_known_broken
-fi
 notmuch search thread:{from:keithp} and to:keithp | notmuch_search_sanitize > OUTPUT
 cat<<EOF > EXPECTED
 thread:XXX   2009-11-18 [1/7] Lars Kellogg-Stedman| Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
@@ -34,9 +28,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Compound subquery"
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
-    test_subtest_known_broken
-fi
 notmuch search 'thread:"{from:keithp and date:2009}" and thread:{to:keithp}' | notmuch_search_sanitize > OUTPUT
 cat<<EOF > EXPECTED
 thread:XXX   2009-11-18 [7/7] Lars Kellogg-Stedman, Mikhail Gusarov, Keith Packard, Carl Worth; [notmuch] Working with Maildir storage? (inbox signed unread)
@@ -44,9 +35,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Syntax/quoting error in subquery"
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
-    test_subtest_known_broken
-fi
 notmuch search 'thread:{from:keithp and date:2009} and thread:{to:keithp}' 1>OUTPUT 2>&1
 cat<<EOF > EXPECTED
 notmuch search: A Xapian exception occurred
index 421a11d42b493c858d0cb92262594c28756209c3..0ae8b83d976a8ac897ed26f8127d7495cbba22b6 100755 (executable)
@@ -68,17 +68,11 @@ test_expect_equal_file QUERIES.BEFORE OUTPUT
 test_begin_subtest "search named query"
 notmuch search query:test > OUTPUT
 notmuch search $QUERYSTR > EXPECTED
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -ne 1 ]; then
-    test_subtest_known_broken
-fi
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "search named query with other terms"
 notmuch search query:test and subject:Maildir > OUTPUT
 notmuch search $QUERYSTR and subject:Maildir > EXPECTED
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -ne 1 ]; then
-    test_subtest_known_broken
-fi
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "search nested named query"
index 43af3b47ced7826ed0a710a3bda3e9df1b54c2a1..55dc6c8870d3a1fd8eccbf280bc79628e9b36aec 100755 (executable)
@@ -2,10 +2,6 @@
 test_description='regular expression searches'
 . $(dirname "$0")/test-lib.sh || exit 1
 
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 0 ]; then
-    test_done
-fi
-
 add_message '[dir]=bad' '[subject]="To the bone"'
 add_message '[dir]=.' '[subject]="Top level"'
 add_message '[dir]=bad/news' '[subject]="Bears"'
index c17ccb6970ac0740517c00dbaa6325e9d0e259ea..4e5672abc4e880a1b6c536366d5936d03d7c373b 100755 (executable)
@@ -48,11 +48,7 @@ notmuch search --output=files subject:'"message 2"' | notmuch_dir_sanitize > OUT
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest 'Regexp search for second subject'
-# Note that missing field processor support really means the test
-# doesn't make sense, but it happens to pass.
-if [ $NOTMUCH_HAVE_XAPIAN_FIELD_PROCESSOR -eq 1 ]; then
-    test_subtest_known_broken
-fi
+test_subtest_known_broken
 cat <<EOF >EXPECTED
 MAIL_DIR/copy0
 MAIL_DIR/copy1