[tracker] libtracker-common: Drop automatic parser versioning
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Drop automatic parser versioning
- Date: Thu, 21 Jun 2018 16:21:01 +0000 (UTC)
commit 2aaeda7495387d87a5b3f51326a1389dae0ff8dd
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jun 17 16:25:37 2018 +0200
libtracker-common: Drop automatic parser versioning
The TRACKER_PARSER_VERSION number must be bumped on every change
to src/libtracker-common/tracker-parser*. This policy shall be
enforced through a server-side update hook.
This is a bit more cumbersome for the OTOH sparse changes to the
parser, but friendlier to the meson build system, where we can't
have build-generated files added to dist.
src/Makefile.am | 3 +--
src/libtracker-bus/meson.build | 2 +-
src/libtracker-common/Makefile.am | 6 -----
.../generate-tracker-parser-sha1-header.sh | 30 ----------------------
src/libtracker-common/meson.build | 7 +----
src/libtracker-common/tracker-parser.h | 7 +++++
src/libtracker-control/meson.build | 2 +-
src/libtracker-data/meson.build | 4 +--
src/libtracker-data/tracker-db-manager.c | 25 ++++++++++--------
9 files changed, 27 insertions(+), 59 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 22b6ad84f..5d76e30c5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,5 +19,4 @@ SUBDIRS = \
tracker-store
EXTRA_DIST = \
- meson.build \
- install-generated-header.sh
+ meson.build
diff --git a/src/libtracker-bus/meson.build b/src/libtracker-bus/meson.build
index 025a1ff9f..6b3a3b1e3 100644
--- a/src/libtracker-bus/meson.build
+++ b/src/libtracker-bus/meson.build
@@ -4,7 +4,7 @@ libtracker_bus = static_library('tracker-bus',
'tracker-array-cursor.vala',
'tracker-bus-fd-cursor.vala',
'../libtracker-common/libtracker-common.vapi',
- tracker_common_enum_header, tracker_common_parser_sha1_header,
+ tracker_common_enum_header,
c_args: tracker_c_args,
vala_args: [
'--debug',
diff --git a/src/libtracker-common/Makefile.am b/src/libtracker-common/Makefile.am
index df7593704..f525668c1 100644
--- a/src/libtracker-common/Makefile.am
+++ b/src/libtracker-common/Makefile.am
@@ -13,9 +13,6 @@ TRACKER_PARSER_FILES = \
tracker-parser-libicu.c \
tracker-parser-libunistring.c
-tracker-parser-sha1.h: $(TRACKER_PARSER_FILES)
- $(AM_V_GEN) echo $(ECHO_N) "#define TRACKER_PARSER_SHA1 \""`git log -n1 --format=format:%H --
$^`"\"$(ECHO_C)" > $@
-
libtracker_commondir = $(libdir)/tracker-$(TRACKER_API_VERSION)
libtracker_common_LTLIBRARIES = libtracker-common.la
@@ -73,7 +70,6 @@ tracker-enum-types.c: tracker-enum-types.c.template tracker-enums.h
BUILT_SOURCES = \
- tracker-parser-sha1.h \
tracker-enum-types.c \
tracker-enum-types.h
@@ -82,9 +78,7 @@ CLEANFILES = \
tracker-enum-types.h
EXTRA_DIST = \
- tracker-parser-sha1.h \
libtracker-common.vapi \
tracker-enum-types.c.template \
tracker-enum-types.h.template \
- generate-tracker-parser-sha1-header.sh \
meson.build
diff --git a/src/libtracker-common/meson.build b/src/libtracker-common/meson.build
index 4e82e6c7e..3e53ee3bd 100644
--- a/src/libtracker-common/meson.build
+++ b/src/libtracker-common/meson.build
@@ -6,10 +6,6 @@ enums = gnome.mkenums('tracker-enum-types',
h_template: 'tracker-enum-types.h.template',
)
-tracker_common_parser_sha1_header = configure_file(
- output: 'tracker-parser-sha1.h',
- command: ['generate-tracker-parser-sha1-header.sh'])
-
tracker_common_enum_header = enums[1]
tracker_common_sources = [
@@ -26,7 +22,6 @@ tracker_common_sources = [
'tracker-parser-utils.c',
'tracker-language.c',
enums[0], enums[1],
- tracker_common_parser_sha1_header,
]
if unicode_library_name == 'icu'
@@ -63,7 +58,7 @@ commoninc = include_directories('.')
#
# Upstream issue: https://github.com/mesonbuild/meson/issues/671
tracker_common_dep = declare_dependency(
- sources: [tracker_common_enum_header, tracker_common_parser_sha1_header],
+ sources: [tracker_common_enum_header],
link_with: libtracker_common,
dependencies: tracker_common_dependencies,
include_directories: [configinc, srcinc, commoninc],
diff --git a/src/libtracker-common/tracker-parser.h b/src/libtracker-common/tracker-parser.h
index 1de905b4f..90c8facc3 100644
--- a/src/libtracker-common/tracker-parser.h
+++ b/src/libtracker-common/tracker-parser.h
@@ -25,6 +25,13 @@
#include <libtracker-common/tracker-language.h>
+/* This version MUST be bumped on any change to any tracker-parser-*
+ * file. Given the parser output gets both stored in disk and performed
+ * at runtime, the former must be rebuilt for those to match perfectly
+ * to avoid returning meaningless results on FTS searches.
+ */
+#define TRACKER_PARSER_VERSION 1
+
G_BEGIN_DECLS
typedef struct TrackerParser TrackerParser;
diff --git a/src/libtracker-control/meson.build b/src/libtracker-control/meson.build
index 80060ecc6..022ac030e 100644
--- a/src/libtracker-control/meson.build
+++ b/src/libtracker-control/meson.build
@@ -4,7 +4,7 @@ headers = ['tracker-control.h', 'tracker-miner-manager.h']
libtracker_control = library('tracker-control-' + tracker_api_version,
sources,
- tracker_common_enum_header, tracker_common_parser_sha1_header,
+ tracker_common_enum_header,
c_args: tracker_c_args,
install: true,
install_rpath: tracker_internal_libs_dir,
diff --git a/src/libtracker-data/meson.build b/src/libtracker-data/meson.build
index a60f96e67..42323d26d 100644
--- a/src/libtracker-data/meson.build
+++ b/src/libtracker-data/meson.build
@@ -10,7 +10,7 @@ libtracker_data_vala = static_library('tracker-sparql-query',
'tracker-turtle-reader.vala',
'../libtracker-common/libtracker-common.vapi',
'../libtracker-data/libtracker-data.vapi',
- tracker_common_enum_header, tracker_common_parser_sha1_header,
+ tracker_common_enum_header,
c_args: tracker_c_args,
vala_args: [
'--debug',
@@ -57,7 +57,7 @@ libtracker_data = library('tracker-data',
'tracker-ontology.c',
'tracker-ontologies.c',
'tracker-property.c',
- tracker_common_enum_header, tracker_common_parser_sha1_header,
+ tracker_common_enum_header,
tracker_data_enums[0],
tracker_data_enums[1],
tracker_gresources[0],
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index efb0fa2fb..33e178f4f 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -34,7 +34,7 @@
#include <glib/gstdio.h>
#include <libtracker-common/tracker-common.h>
-#include <libtracker-common/tracker-parser-sha1.h>
+#include <libtracker-common/tracker-parser.h>
#if HAVE_TRACKER_FTS
#include <libtracker-fts/tracker-fts.h>
@@ -69,7 +69,10 @@
#define IN_USE_FILENAME ".meta.isrunning"
-#define PARSER_SHA1_FILENAME "parser-sha1.txt"
+#define PARSER_VERSION_FILENAME "parser-version.txt"
+
+#define TOSTR(x) #x
+#define TRACKER_PARSER_VERSION_STRING TOSTR(TRACKER_PARSER_VERSION)
typedef enum {
TRACKER_DB_VERSION_UNKNOWN, /* Unknown */
@@ -1121,10 +1124,10 @@ tracker_db_manager_has_enough_space (TrackerDBManager *db_manager)
}
inline static gchar *
-get_parser_sha1_filename (TrackerDBManager *db_manager)
+get_parser_version_filename (TrackerDBManager *db_manager)
{
return g_build_filename (db_manager->data_dir,
- PARSER_SHA1_FILENAME,
+ PARSER_VERSION_FILENAME,
NULL);
}
@@ -1132,14 +1135,14 @@ get_parser_sha1_filename (TrackerDBManager *db_manager)
gboolean
tracker_db_manager_get_tokenizer_changed (TrackerDBManager *db_manager)
{
- gchar *filename, *sha1;
+ gchar *filename, *version;
gboolean changed = TRUE;
- filename = get_parser_sha1_filename (db_manager);
+ filename = get_parser_version_filename (db_manager);
- if (g_file_get_contents (filename, &sha1, NULL, NULL)) {
- changed = strcmp (sha1, TRACKER_PARSER_SHA1) != 0;
- g_free (sha1);
+ if (g_file_get_contents (filename, &version, NULL, NULL)) {
+ changed = strcmp (version, TRACKER_PARSER_VERSION_STRING) != 0;
+ g_free (version);
}
g_free (filename);
@@ -1153,9 +1156,9 @@ tracker_db_manager_tokenizer_update (TrackerDBManager *db_manager)
GError *error = NULL;
gchar *filename;
- filename = get_parser_sha1_filename (db_manager);
+ filename = get_parser_version_filename (db_manager);
- if (!g_file_set_contents (filename, TRACKER_PARSER_SHA1, -1, &error)) {
+ if (!g_file_set_contents (filename, TRACKER_PARSER_VERSION_STRING, -1, &error)) {
g_warning ("The file '%s' could not be rewritten by Tracker and "
"should be deleted manually. Not doing so will result "
"in Tracker rebuilding its FTS tokens on every startup. "
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]