From: David Bremner Date: Sun, 1 May 2016 01:24:28 +0000 (+2100) Subject: v3 of libconfig / single argument date / named query patches X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4c8de858e5032840493f63a3097b465009959e04;p=notmuch-archives.git v3 of libconfig / single argument date / named query patches --- diff --git a/53/005cda3a4298ab34198aea43534f313f5c1f55 b/53/005cda3a4298ab34198aea43534f313f5c1f55 new file mode 100644 index 000000000..cce0f912e --- /dev/null +++ b/53/005cda3a4298ab34198aea43534f313f5c1f55 @@ -0,0 +1,271 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id DD6886DE092B + for ; Sat, 30 Apr 2016 18:25:03 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.015 +X-Spam-Level: +X-Spam-Status: No, score=-0.015 tagged_above=-999 required=5 + tests=[AWL=-0.004, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id EFb3i-5C0av6 for ; + Sat, 30 Apr 2016 18:24:56 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id EC8EE6DE025F + for ; Sat, 30 Apr 2016 18:24:47 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) id 1awg7k-0006bD-Ms + for notmuch@notmuchmail.org; Sat, 30 Apr 2016 21:24:40 -0400 +Received: (nullmailer pid 29936 invoked by uid 1000); + Sun, 01 May 2016 01:24:43 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: v3 of libconfig / single argument date / named query patches +Date: Sat, 30 Apr 2016 22:24:28 -0300 +Message-Id: <1462065879-29860-1-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 01 May 2016 01:25:04 -0000 + +The main difference here is responding to Tomi's comments about +"options" and rebasing against master. Rebasing was surprisingly +messy, so I might have botched something up. + +One thing to discuss is the dump/restore format. dkg has discussed +attaching some non-tag metadata to messages, so we may want to make +sure the changes are general enough to handle that. If desired we +could add more "pseudo-comments" with #x where x is not @ to introduce +that metadata. I'm not sure how valuable this upward compatibility is; +I guess it would mainly allow us not maintain a third dump format. + +The first 3 patches are usable on their own. + +Interdiff follows. + +diff --git a/doc/man1/notmuch-config.rst b/doc/man1/notmuch-config.rst +index c3470a8..5a517eb 100644 +--- a/doc/man1/notmuch-config.rst ++++ b/doc/man1/notmuch-config.rst +@@ -132,9 +132,9 @@ The available configuration items are described below. + + Default: ``gpg``. + +- **options.** ++ **built_with.** + +- Compile time option . Current possibilities include ++ Compile time feature . Current possibilities include + "compact" (see **notmuch-compact(1)**) + and "field_processor" (see **notmuch-search-terms(7)**). + +diff --git a/doc/man7/notmuch-search-terms.rst b/doc/man7/notmuch-search-terms.rst +index 7474f53..223031b 100644 +--- a/doc/man7/notmuch-search-terms.rst ++++ b/doc/man7/notmuch-search-terms.rst +@@ -387,7 +387,7 @@ notmuch was built against a sufficiently recent version of Xapian by running + + :: + +- % notmuch config get options.field_processor ++ % notmuch config get built_with.field_processor + + Currently the following features require field processor support: + +diff --git a/lib/Makefile.local b/lib/Makefile.local +index fab1242..35caa3e 100644 +--- a/lib/Makefile.local ++++ b/lib/Makefile.local +@@ -39,7 +39,7 @@ libnotmuch_c_srcs = \ + $(dir)/message-file.c \ + $(dir)/messages.c \ + $(dir)/sha1.c \ +- $(dir)/options.c \ ++ $(dir)/built-with.c \ + $(dir)/tags.c + + libnotmuch_cxx_srcs = \ +diff --git a/lib/options.c b/lib/built-with.c +similarity index 69% +rename from lib/options.c +rename to lib/built-with.c +index 4e15d92..b619bed 100644 +--- a/lib/options.c ++++ b/lib/built-with.c +@@ -22,28 +22,11 @@ + #include "notmuch-private.h" + + notmuch_bool_t +-notmuch_options_present (notmuch_option_t mask) +-{ +- notmuch_option_t present = 0; +- +-#if HAVE_XAPIAN_COMPACT +- present |= NOTMUCH_OPTION_COMPACT; +-#endif +- +-#if HAVE_XAPIAN_COMPACT +- present |= NOTMUCH_OPTION_FIELD_PROCESSOR; +-#endif +- +- return (mask & present) != 0; +- +-} +- +-notmuch_bool_t +-notmuch_options_get (const char *name) { ++notmuch_built_with (const char *name) { + if (STRNCMP_LITERAL (name, "compact") == 0) { +- return notmuch_options_present (NOTMUCH_OPTION_COMPACT); ++ return HAVE_XAPIAN_COMPACT; + } else if (STRNCMP_LITERAL (name, "field_processor") == 0) { +- return notmuch_options_present (NOTMUCH_OPTION_FIELD_PROCESSOR); ++ return HAVE_XAPIAN_FIELD_PROCESSOR; + } else { + return FALSE; + } +diff --git a/lib/notmuch.h b/lib/notmuch.h +index 2278822..bd977c3 100644 +--- a/lib/notmuch.h ++++ b/lib/notmuch.h +@@ -1902,16 +1902,11 @@ notmuch_config_list_move_to_next (notmuch_config_list_t *config_list); + void + notmuch_config_list_destroy (notmuch_config_list_t *config_list); + +-typedef enum { +- NOTMUCH_OPTION_COMPACT = 1, +- NOTMUCH_OPTION_FIELD_PROCESSOR = 2 +-} notmuch_option_t; +- +-notmuch_bool_t +-notmuch_options_present (notmuch_option_t mask); +- ++/** ++ * interrogate the library for compile time features ++ */ + notmuch_bool_t +-notmuch_options_get (const char *name); ++notmuch_built_with (const char *name); + /* @} */ + + NOTMUCH_END_DECLS +diff --git a/notmuch-config.c b/notmuch-config.c +index 121fec6..e4f47e4 100644 +--- a/notmuch-config.c ++++ b/notmuch-config.c +@@ -750,7 +750,7 @@ _item_split (char *item, char **group, char **key) + return 0; + } + +-#define OPTION_PREFIX "options." ++#define BUILT_WITH_PREFIX "built_with." + #define QUERY_PREFIX "query." + + static int +@@ -797,9 +797,9 @@ notmuch_config_command_get (notmuch_config_t *config, char *item) + tags = notmuch_config_get_new_tags (config, &length); + for (i = 0; i < length; i++) + printf ("%s\n", tags[i]); +- } else if (STRNCMP_LITERAL (item, OPTION_PREFIX) == 0) { ++ } else if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) { + printf ("%s\n", +- notmuch_options_get (item + strlen (OPTION_PREFIX)) ? "true" : "false"); ++ notmuch_built_with (item + strlen (BUILT_WITH_PREFIX)) ? "true" : "false"); + } else if (STRNCMP_LITERAL (item, QUERY_PREFIX) == 0) { + return _print_db_config (config, item); + } else { +@@ -866,7 +866,7 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char + { + char *group, *key; + +- if (STRNCMP_LITERAL (item, OPTION_PREFIX) == 0) { ++ if (STRNCMP_LITERAL (item, BUILT_WITH_PREFIX) == 0) { + fprintf (stderr, "Error: read only option: %s\n", item); + return 1; + } +@@ -904,10 +904,12 @@ notmuch_config_command_set (notmuch_config_t *config, char *item, int argc, char + static + void + _notmuch_config_list_options () { +- printf("options.compact=%s\n", +- notmuch_options_present(NOTMUCH_OPTION_COMPACT) ? "true" : "false"); +- printf("options.field_processor=%s\n", +- notmuch_options_present(NOTMUCH_OPTION_FIELD_PROCESSOR) ? "true" : "false"); ++ printf("%scompact=%s\n", ++ BUILT_WITH_PREFIX, ++ notmuch_built_with ("compact") ? "true" : "false"); ++ printf("%sfield_processor=%s\n", ++ BUILT_WITH_PREFIX, ++ notmuch_built_with ("field_processor") ? "true" : "false"); + } + + static int +diff --git a/test/T030-config.sh b/test/T030-config.sh +index 39ee885..b8d5a86 100755 +--- a/test/T030-config.sh ++++ b/test/T030-config.sh +@@ -57,8 +57,8 @@ maildir.synchronize_flags=true + crypto.gpg_path=gpg + foo.string=this is another string value + foo.list=this;is another;list value; +-options.compact=something +-options.field_processor=something ++built_with.compact=something ++built_with.field_processor=something + EOF + test_expect_equal_file EXPECTED OUTPUT + +diff --git a/test/T040-setup.sh b/test/T040-setup.sh +index 5db03a6..be2f0db 100755 +--- a/test/T040-setup.sh ++++ b/test/T040-setup.sh +@@ -19,7 +19,7 @@ another.suite@example.com + foo bar + baz + EOF +-output=$(notmuch --config=new-notmuch-config config list | notmuch_options_sanitize) ++output=$(notmuch --config=new-notmuch-config config list | notmuch_built_with_sanitize) + test_expect_equal "$output" "\ + database.path=/path/to/maildir + user.name=Test Suite +@@ -30,7 +30,7 @@ new.ignore= + search.exclude_tags=baz; + maildir.synchronize_flags=true + crypto.gpg_path=gpg +-options.compact=something +-options.field_processor=something" ++built_with.compact=something ++built_with.field_processor=something" + + test_done +diff --git a/test/test-lib.sh b/test/test-lib.sh +index b5a1941..e96c184 100644 +--- a/test/test-lib.sh ++++ b/test/test-lib.sh +@@ -740,9 +740,9 @@ notmuch_uuid_sanitize () + sed 's/[0-9a-f]\{8\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{4\}-[0-9a-f]\{12\}/UUID/g' + } + +-notmuch_options_sanitize () ++notmuch_built_with_sanitize () + { +- sed 's/^options[.]\(.*\)=.*$/options.\1=something/' ++ sed 's/^built_with[.]\(.*\)=.*$/built_with.\1=something/' + } + + notmuch_config_sanitize ()