[PATCH] build: drop support for xapian versions less than 1.4
Tomi Ollila
tomi.ollila at iki.fi
Sat Feb 22 14:29:55 PST 2020
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.
---
doc/man7/notmuch-search-terms.rst was not changed in this commit --
I did not fully understand what was it saying...
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 | 5 --
17 files changed, 27 insertions(+), 153 deletions(-)
diff --git a/configure b/configure
index c16d18dc..c8d4d529 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<<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}
diff --git a/lib/built-with.c b/lib/built-with.c
index 320be6c5..0c70010b 100644
--- a/lib/built-with.c
+++ b/lib/built-with.c
@@ -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) {
diff --git a/lib/database.cc b/lib/database.cc
index 24b7ec43..78b5fec9 100644
--- a/lib/database.cc
+++ b/lib/database.cc
@@ -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)
diff --git a/lib/parse-time-vrp.cc b/lib/parse-time-vrp.cc
index 45db9597..168d5810 100644
--- a/lib/parse-time-vrp.cc
+++ b/lib/parse-time-vrp.cc
@@ -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
diff --git a/lib/parse-time-vrp.h b/lib/parse-time-vrp.h
index e6138d05..9fb1af60 100644
--- a/lib/parse-time-vrp.h
+++ b/lib/parse-time-vrp.h
@@ -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 */
diff --git a/lib/query-fp.cc b/lib/query-fp.cc
index c39f5915..b980b7f0 100644
--- a/lib/query-fp.cc
+++ b/lib/query-fp.cc
@@ -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
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 <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 */
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 <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 */
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 <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
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 <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 */
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<<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
diff --git a/test/T600-named-queries.sh b/test/T600-named-queries.sh
index abaee3b7..583ce0ef 100755
--- a/test/T600-named-queries.sh
+++ b/test/T600-named-queries.sh
@@ -53,17 +53,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..62f84482 100755
--- a/test/T670-duplicate-mid.sh
+++ b/test/T670-duplicate-mid.sh
@@ -48,11 +48,6 @@ 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
cat <<EOF >EXPECTED
MAIL_DIR/copy0
MAIL_DIR/copy1
--
2.24.1
More information about the notmuch
mailing list