Re: [PATCH] fix build without sfsexp

2022-04-15 Thread David Bremner
michaeljgruber+grubix+...@gmail.com writes:

> From: Michael J Gruber 
>
> a1d139de ("lib: add sexp: prefix to Xapian (infix) query parser.",
> 2022-04-09) introduced sfsexp infix queries. This requires the infix
> preprocessor to be built in in a way which does not require sfsexp when
> notmuch is built without it.
>
> Make the preprocessor throw a Xapian error in this case (and fix the
> build).
>
> Signed-off-by: Michael J Gruber 
> ---
> Maybe something like this - I have not test *with* sfsexp, though.

Either your patch or mine is OK with me. Yours might be slightly nicer
since it gives an actual error message, rather than falling back to the
corresponding phrase (generic Xapian query parser behaviour with unknown
prefixes).

I did test both with and without libsfsexp-dev installed.

d
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] lib: don't compile sexp: prefix if no sfsexp library

2022-04-15 Thread David Bremner
As Michael Gruber pointed out, the build is otherwise broken on
systems without libsfsexp.
---
 lib/prefix.cc  | 4 
 lib/sexp-fp.cc | 3 +++
 lib/sexp-fp.h  | 2 ++
 3 files changed, 9 insertions(+)

diff --git a/lib/prefix.cc b/lib/prefix.cc
index 06e2333a..538a2dd1 100644
--- a/lib/prefix.cc
+++ b/lib/prefix.cc
@@ -61,8 +61,10 @@ prefix_t prefix_table[] = {
   NOTMUCH_FIELD_PROCESSOR },
 { "query",  NULL,   NOTMUCH_FIELD_EXTERNAL |
   NOTMUCH_FIELD_PROCESSOR },
+#if HAVE_SFSEXP
 { "sexp",  NULL,NOTMUCH_FIELD_EXTERNAL |
   NOTMUCH_FIELD_PROCESSOR },
+#endif
 { "from",   "XFROM",NOTMUCH_FIELD_EXTERNAL |
   NOTMUCH_FIELD_PROBABILISTIC |
   NOTMUCH_FIELD_PROCESSOR },
@@ -141,8 +143,10 @@ _setup_query_field (const prefix_t *prefix, 
notmuch_database_t *notmuch)
fp = (new QueryFieldProcessor (*notmuch->query_parser, 
notmuch))->release ();
else if (STRNCMP_LITERAL (prefix->name, "thread") == 0)
fp = (new ThreadFieldProcessor (*notmuch->query_parser, 
notmuch))->release ();
+#if HAVE_SFSEXP
else if (STRNCMP_LITERAL (prefix->name, "sexp") == 0)
fp = (new SexpFieldProcessor (notmuch))->release ();
+#endif
else
fp = (new RegexpFieldProcessor (prefix->name, prefix->flags,
*notmuch->query_parser, 
notmuch))->release ();
diff --git a/lib/sexp-fp.cc b/lib/sexp-fp.cc
index ed26f6ec..eeb8be98 100644
--- a/lib/sexp-fp.cc
+++ b/lib/sexp-fp.cc
@@ -21,6 +21,8 @@
  */
 
 #include "database-private.h"
+
+#if HAVE_SFSEXP
 #include "sexp-fp.h"
 #include 
 
@@ -38,3 +40,4 @@ SexpFieldProcessor::operator() (const std::string & 
query_string)
 return output;
 
 }
+#endif /* HAVE_SFSEXP */
diff --git a/lib/sexp-fp.h b/lib/sexp-fp.h
index 341dfa7e..0e55b961 100644
--- a/lib/sexp-fp.h
+++ b/lib/sexp-fp.h
@@ -23,6 +23,7 @@
 #ifndef NOTMUCH_SEXP_FP_H
 #define NOTMUCH_SEXP_FP_H
 
+#if HAVE_SFSEXP
 #include 
 #include "notmuch.h"
 
@@ -38,4 +39,5 @@ public:
 Xapian::Query operator() (const std::string & query_string);
 };
 
+#endif /* HAVE_SFSEXP */
 #endif /* NOTMUCH_SEXP_FP_H */
-- 
2.35.1

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


[PATCH] fix build without sfsexp

2022-04-15 Thread michaeljgruber+grubix+git
From: Michael J Gruber 

a1d139de ("lib: add sexp: prefix to Xapian (infix) query parser.",
2022-04-09) introduced sfsexp infix queries. This requires the infix
preprocessor to be built in in a way which does not require sfsexp when
notmuch is built without it.

Make the preprocessor throw a Xapian error in this case (and fix the
build).

Signed-off-by: Michael J Gruber 
---
Maybe something like this - I have not test *with* sfsexp, though.

 lib/database-private.h | 4 
 lib/query.cc   | 2 ++
 lib/sexp-fp.cc | 4 
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/lib/database-private.h b/lib/database-private.h
index 657b1aa1..419b9fe6 100644
--- a/lib/database-private.h
+++ b/lib/database-private.h
@@ -354,10 +354,6 @@ _notmuch_query_string_to_xapian_query (notmuch_database_t 
*notmuch,
   std::string query_string,
   Xapian::Query &output,
   std::string &msg);
-/* parse-sexp.cc */
-notmuch_status_t
-_notmuch_sexp_string_to_xapian_query (notmuch_database_t *notmuch, const char 
*querystr,
- Xapian::Query &output);
 
 notmuch_status_t
 _notmuch_query_expand (notmuch_database_t *notmuch, const char *field, 
Xapian::Query subquery,
diff --git a/lib/query.cc b/lib/query.cc
index b0937fcc..707f6222 100644
--- a/lib/query.cc
+++ b/lib/query.cc
@@ -227,6 +227,7 @@ _notmuch_query_ensure_parsed_xapian (notmuch_query_t *query)
 return NOTMUCH_STATUS_SUCCESS;
 }
 
+#if HAVE_SFSEXP
 static notmuch_status_t
 _notmuch_query_ensure_parsed_sexpr (notmuch_query_t *query)
 {
@@ -243,6 +244,7 @@ _notmuch_query_ensure_parsed_sexpr (notmuch_query_t *query)
 _notmuch_query_cache_terms (query);
 return NOTMUCH_STATUS_SUCCESS;
 }
+#endif
 
 static notmuch_status_t
 _notmuch_query_ensure_parsed (notmuch_query_t *query)
diff --git a/lib/sexp-fp.cc b/lib/sexp-fp.cc
index ed26f6ec..1fdf5225 100644
--- a/lib/sexp-fp.cc
+++ b/lib/sexp-fp.cc
@@ -30,10 +30,14 @@ SexpFieldProcessor::operator() (const std::string & 
query_string)
 notmuch_status_t status;
 Xapian::Query output;
 
+#if HAVE_SFSEXP
 status = _notmuch_sexp_string_to_xapian_query (notmuch, query_string.c_str 
(), output);
 if (status) {
throw Xapian::QueryParserError ("error parsing " + query_string);
 }
+#else
+throw Xapian::QueryParserError ("sexp query parser not available");
+#endif
 
 return output;
 
-- 
2.36.0.rc2.472.gf6a51f5f41

___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 2/2] lib: add sexp: prefix to Xapian (infix) query parser.

2022-04-15 Thread Michael J Gruber
This breaks builds if you don't have sfexp, unfortunately. (And since there
is no sfsexp release with the recent fixes, there is no sfsexp in Fedora,
for example.)

Not declaring _notmuch_sexp_string_to_xapian_query() twice
in lib/database-private.h (once unconditionally, once depending on
HAVE_SFSEXP) may be part of the fix, as well as guarding it in
lib/query.cc. But I'm not sure what SexpFieldProcessor::operator() should
do when sfsexp is not available - throw a Xapian error?

Am Fr., 15. Apr. 2022 um 13:32 Uhr schrieb David Bremner :

> David Bremner  writes:
>
> > This is analogous to the "infix" prefix provided by the s-expression
> > based query parser.
>
> series applied to master.
> ___
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-le...@notmuchmail.org
>
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: release process for notmuch 0.36

2022-04-15 Thread David Bremner
David Bremner  writes:

> I plan to feature freeze in mid April, and release 0.36 sometime before
> the end of April.

As promised I have tagged and uploaded the first release candidate for
0.36. I will watch for bug reports for a week or so before doing the
final release.

d


signature.asc
Description: PGP signature
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org


Re: [PATCH v2 2/2] lib: add sexp: prefix to Xapian (infix) query parser.

2022-04-15 Thread David Bremner
David Bremner  writes:

> This is analogous to the "infix" prefix provided by the s-expression
> based query parser.

series applied to master.
___
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org