From 00cdfe10717020423870fdaf56e973db9aba9f5a Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Wed, 22 Apr 2020 00:07:29 +0300 Subject: [PATCH] build: drop support for xapian versions less than 1.4 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. --- configure | 101 +++++++---------------------------- lib/built-with.c | 4 +- lib/database.cc | 10 ---- lib/parse-time-vrp.cc | 2 - lib/parse-time-vrp.h | 3 +- lib/query-fp.cc | 3 -- lib/query-fp.h | 3 +- lib/regexp-fields.cc | 2 - lib/regexp-fields.h | 4 +- lib/thread-fp.cc | 3 -- lib/thread-fp.h | 3 +- test/T020-compact.sh | 12 ----- test/T500-search-date.sh | 3 -- test/T585-thread-subquery.sh | 12 ----- test/T600-named-queries.sh | 6 --- test/T650-regexp-query.sh | 4 -- test/T670-duplicate-mid.sh | 6 +-- 17 files changed, 28 insertions(+), 153 deletions(-) diff --git a/configure b/configure index 70031d14..0cfdaa6f 100755 --- 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< -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< -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< -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 < @@ -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 < -#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 diff --git a/lib/query-fp.h b/lib/query-fp.h index 8a8bde62..beaaf405 100644 --- a/lib/query-fp.h +++ b/lib/query-fp.h @@ -26,7 +26,6 @@ #include #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 */ diff --git a/lib/regexp-fields.cc b/lib/regexp-fields.cc index 198eb32f..0feb50e5 100644 --- a/lib/regexp-fields.cc +++ b/lib/regexp-fields.cc @@ -26,7 +26,6 @@ #include "notmuch-private.h" #include "database-private.h" -#if HAVE_XAPIAN_FIELD_PROCESSOR static void compile_regex (regex_t ®exp, const char *str) { @@ -208,4 +207,3 @@ RegexpFieldProcessor::operator() (const std::string & str) } } } -#endif diff --git a/lib/regexp-fields.h b/lib/regexp-fields.h index 97778a1d..a8cca243 100644 --- a/lib/regexp-fields.h +++ b/lib/regexp-fields.h @@ -24,7 +24,7 @@ #ifndef NOTMUCH_REGEXP_FIELDS_H #define NOTMUCH_REGEXP_FIELDS_H -#if HAVE_XAPIAN_FIELD_PROCESSOR + #include #include #include "database-private.h" @@ -79,5 +79,5 @@ public: Xapian::Query operator() (const std::string & str); }; -#endif + #endif /* NOTMUCH_REGEXP_FIELDS_H */ diff --git a/lib/thread-fp.cc b/lib/thread-fp.cc index 73277006..97a65211 100644 --- a/lib/thread-fp.cc +++ b/lib/thread-fp.cc @@ -24,8 +24,6 @@ #include "thread-fp.h" #include -#if HAVE_XAPIAN_FIELD_PROCESSOR - Xapian::Query ThreadFieldProcessor::operator() (const std::string & str) { @@ -64,4 +62,3 @@ ThreadFieldProcessor::operator() (const std::string & str) } } -#endif diff --git a/lib/thread-fp.h b/lib/thread-fp.h index de837d3e..00bf1aa2 100644 --- a/lib/thread-fp.h +++ b/lib/thread-fp.h @@ -26,7 +26,6 @@ #include #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 */ diff --git a/test/T020-compact.sh b/test/T020-compact.sh index 58cd2ba7..02f8738f 100755 --- a/test/T020-compact.sh +++ b/test/T020-compact.sh @@ -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" diff --git a/test/T500-search-date.sh b/test/T500-search-date.sh index f84b0962..85ff831f 100755 --- a/test/T500-search-date.sh +++ b/test/T500-search-date.sh @@ -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" diff --git a/test/T585-thread-subquery.sh b/test/T585-thread-subquery.sh index bf9894d3..71ced149 100755 --- a/test/T585-thread-subquery.sh +++ b/test/T585-thread-subquery.sh @@ -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< 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< 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< 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< EXPECTED notmuch search: A Xapian exception occurred diff --git a/test/T600-named-queries.sh b/test/T600-named-queries.sh index 421a11d4..0ae8b83d 100755 --- a/test/T600-named-queries.sh +++ b/test/T600-named-queries.sh @@ -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" diff --git a/test/T650-regexp-query.sh b/test/T650-regexp-query.sh index 43af3b47..55dc6c88 100755 --- a/test/T650-regexp-query.sh +++ b/test/T650-regexp-query.sh @@ -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"' diff --git a/test/T670-duplicate-mid.sh b/test/T670-duplicate-mid.sh index c17ccb69..4e5672ab 100755 --- a/test/T670-duplicate-mid.sh +++ b/test/T670-duplicate-mid.sh @@ -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 <EXPECTED MAIL_DIR/copy0 MAIL_DIR/copy1