mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-21 10:28:09 +01:00
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.
This commit is contained in:
parent
e02bb7e9fd
commit
00cdfe1071
17 changed files with 28 additions and 153 deletions
91
configure
vendored
91
configure
vendored
|
@ -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/.* //')
|
||||
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,9 +1311,7 @@ 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)
|
||||
|
@ -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}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"'
|
||||
|
|
|
@ -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
|
||||
cat <<EOF >EXPECTED
|
||||
MAIL_DIR/copy0
|
||||
MAIL_DIR/copy1
|
||||
|
|
Loading…
Reference in a new issue