[tracker/wip/carlosg/graphs-through-with: 14/15] build: Make "safe" sqlite checks fail hard



commit ec4b446e7a3b80490106d1f9ef08a3b820e4f0e2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Tue Dec 10 13:13:10 2019 +0100

    build: Make "safe" sqlite checks fail hard
    
    Nobody reads configure script summaries, make it sure they will by
    spewing a build error. Make this overridable though, so people and
    distributors at least make a conscious choice to shoot themselves
    in the foot.

 meson.build       | 38 ++++++++++++++++----------------------
 meson_options.txt |  2 ++
 2 files changed, 18 insertions(+), 22 deletions(-)
---
diff --git a/meson.build b/meson.build
index cd9cc0df4..77b2ddb69 100644
--- a/meson.build
+++ b/meson.build
@@ -328,19 +328,22 @@ subdir('tests')
 
 subdir('po')
 
-# Make sure we're not using versions of SQLite which cause problems.
-#
-# Avoid versions:
-sqlite_safe = true
-if sqlite.version().version_compare('>= 3.7.10') and sqlite.version().version_compare('<= 3.7.13')
-  # See https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
-  sqlite_safe = false
-elif sqlite.version().version_compare('3.8.1')
-  # See https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
-  sqlite_safe = false
-elif sqlite.version().version_compare('3.8.4.2')
-  # See https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
-  sqlite_safe = false
+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'))
+    endif
 endif
 
 meson.add_install_script('meson_integration_commands.sh', glib_compile_schemas.path(), gsettings_schema_dir)
@@ -361,12 +364,3 @@ summary = [
 ]
 
 message('\n'.join(summary))
-
-if not sqlite_safe
-  message('''WARNING:
-        SQLite3 version @0@ is not safe. For detail
-        3.7.10 - 3.7.13: https://mail.gnome.org/archives/tracker-list/2012-October/msg00028.html
-        3.8.1:           https://mail.gnome.org/archives/tracker-list/2013-November/msg00021.html
-        3.8.4.2:         https://mail.gnome.org/archives/tracker-list/2014-April/msg00001.html
-  ''').format(sqlite.version())
-endif
diff --git a/meson_options.txt b/meson_options.txt
index 509b3479f..19c8d2fff 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,8 @@ option('journal', type: 'boolean', value: true,
        description: 'Enable database journal backup mechanism')
 option('man', type: 'boolean', value: true,
        description: 'Install man pages')
+option('override_sqlite_version_check', type: 'boolean', value: false,
+       description: 'Override checks for broken sqlite versions')
 
 option('network_manager', type: 'feature', value: 'auto',
        description: 'Connection detection through NetworkManager')


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