[tracker/wip/sam/test-sqlite: 42/44] Move SQLite known-bad versions list into a separate file




commit 0e272595a0885de7525526c7a1be8af281e79c42
Author: Sam Thursfield <sam thursfield codethink co uk>
Date:   Mon Jun 21 19:27:45 2021 +0200

    Move SQLite known-bad versions list into a separate file
    
    So it can be parsed by unit tests.

 meson.build                | 52 +++++++++++++++++++++++++---------------------
 sqlite3_versions_known_bad | 22 ++++++++++++++++++++
 2 files changed, 50 insertions(+), 24 deletions(-)
---
diff --git a/meson.build b/meson.build
index 8b4e41387..446ab6baf 100644
--- a/meson.build
+++ b/meson.build
@@ -125,6 +125,34 @@ endif
 
 add_project_arguments(debug_cflags, language: 'c')
 
+
+####################################################################
+# SQLite
+####################################################################
+
+sqlite3_versions_known_bad = configuration_data()
+# FIXME: use fs.read() once we can depend on Meson 0.57 everywhere.
+text = run_command('cat', 'sqlite3_versions_known_bad').stdout().strip()
+foreach line : text.split('\n')
+  parts = line.split(' ')
+  if parts.length() == 2
+    version = parts[0]
+    link = parts[1]
+    sqlite3_versions_known_bad.set(version, link)
+  endif
+endforeach
+
+if sqlite3_versions_known_bad.has(sqlite.version())
+  if get_option('override_sqlite_version_check')
+    warn('SQlite3 version @0@ is known bad. Ignoring due to -Doverride_sqlite_version_check=true'.format(
+      sqlite.version()))
+  else
+    link = sqlite3_versions_known_bad.get(sqlite.version())
+    error('SQLite3 version is unsafe (@0@).\nSee @1@ for details.\nYou can bypass this check with 
-Doverride_sqlite_version_check=true'.format(
+      sqlite.version(), link))
+  endif
+endif
+
 ##################################################################
 # Check for libtracker-common, make sure libstemmer exists
 ##################################################################
@@ -352,30 +380,6 @@ subdir('examples')
 
 subdir('po')
 
-if not get_option('override_sqlite_version_check')
-    template = 'SQLite3 version is unsafe (@0@).\nSee @1@ for details.\nYou can bypass this check with 
-Doverride_sqlite_version_check=true'
-
-    # Make sure we're not using versions of SQLite which cause problems.
-    #
-    # Avoid versions:
-    if sqlite.version().version_compare('>= 3.7.10') and sqlite.version().version_compare('<= 3.7.13')
-        error(template.format('>=3.7.10, <= 3.7.13',
-                              'https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html'))
-    elif sqlite.version().version_compare('3.8.1')
-        error(template.format('3.8.1',
-                              'https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html'))
-    elif sqlite.version().version_compare('3.8.4.2')
-        error(template.format('3.8.4.2',
-                              'https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html'))
-    elif sqlite.version().version_compare('>= 3.24.0') and sqlite.version().version_compare('<= 3.28.0')
-        error(template.format('>=3.24.0, <= 3.28.0',
-                              'https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713'))
-    elif sqlite.version().version_compare('>= 3.35.0') and sqlite.version().version_compare('<= 3.35.1')
-        error(template.format('>=3.35.0, <= 3.35.1',
-                              'https://mail.gnome.org/archives/distributor-list/2021-March/msg00000.html'))
-    endif
-endif
-
 summary = [
   '\nBuild Configuration:',
   '    Prefix:                                 ' + get_option('prefix'),
diff --git a/sqlite3_versions_known_bad b/sqlite3_versions_known_bad
new file mode 100644
index 000000000..083c6b073
--- /dev/null
+++ b/sqlite3_versions_known_bad
@@ -0,0 +1,22 @@
+3.35.1 https://mail.gnome.org/archives/distributor-list/2021-March/msg00000.html
+3.35.0 https://mail.gnome.org/archives/distributor-list/2021-March/msg00000.html
+
+3.28.0 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.27.2 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.27.1 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.27.0 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.26.0 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.25.3 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.25.2 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.25.1 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.25.0 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+3.24.0 https://gitlab.gnome.org/GNOME/tracker/merge_requests/160#note_664713
+
+3.8.4.2 https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
+
+3.8.1 https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
+
+3.7.13 https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
+3.7.12 https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
+3.7.11 https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
+3.7.10 https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]