summaryrefslogtreecommitdiffstats
path: root/compatcheck
diff options
context:
space:
mode:
authorJINMEI Tatuya <jinmei@isc.org>2012-03-30 09:09:44 +0200
committerJINMEI Tatuya <jinmei@isc.org>2012-03-30 09:09:44 +0200
commit6cce379ad4e562fae0e899b2134f59f947d54f3e (patch)
treef514f0c67361b9acfe0d1d605d471006932c76ee /compatcheck
parent[324] added tests for different schema versions for sqlite3_ds. (diff)
downloadkea-6cce379ad4e562fae0e899b2134f59f947d54f3e.tar.xz
kea-6cce379ad4e562fae0e899b2134f59f947d54f3e.zip
[324] use the dbutil script for pre-compatibility checker.
sqlite3-difftbl-check.py is now unnecessary, so has been removed.
Diffstat (limited to 'compatcheck')
-rw-r--r--compatcheck/Makefile.am9
-rwxr-xr-xcompatcheck/sqlite3-difftbl-check.py.in60
2 files changed, 5 insertions, 64 deletions
diff --git a/compatcheck/Makefile.am b/compatcheck/Makefile.am
index 029578d0e5..38a1555097 100644
--- a/compatcheck/Makefile.am
+++ b/compatcheck/Makefile.am
@@ -1,8 +1,9 @@
-noinst_SCRIPTS = sqlite3-difftbl-check.py
-
# We're going to abuse install-data-local for a pre-install check.
# This is to be considered a short term hack and is expected to be removed
# in a near future version.
install-data-local:
- $(PYTHON) sqlite3-difftbl-check.py \
- $(localstatedir)/$(PACKAGE)/zone.sqlite3
+ $(SHELL) $(top_builddir)/src/bin/dbutil/run_dbutil.sh --check \
+ $(localstatedir)/$(PACKAGE)/zone.sqlite3 || \
+ (echo "\nSQLite3 DB file schema version is old. Please run: " \
+ "$(abs_top_builddir)/src/bin/dbutil/run_dbutil.sh --upgrade " \
+ "$(localstatedir)/$(PACKAGE)/zone.sqlite3"; exit 1)
diff --git a/compatcheck/sqlite3-difftbl-check.py.in b/compatcheck/sqlite3-difftbl-check.py.in
deleted file mode 100755
index a874b33de6..0000000000
--- a/compatcheck/sqlite3-difftbl-check.py.in
+++ /dev/null
@@ -1,60 +0,0 @@
-#!@PYTHON@
-
-# Copyright (C) 2011 Internet Systems Consortium.
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SYSTEMS CONSORTIUM
-# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
-# INTERNET SYSTEMS CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-import os, sqlite3, sys
-from optparse import OptionParser
-
-usage = 'usage: %prog [options] db_file'
-parser = OptionParser(usage=usage)
-parser.add_option("-u", "--upgrade", action="store_true",
- dest="upgrade", default=False,
- help="Upgrade the database file [default: %default]")
-(options, args) = parser.parse_args()
-if len(args) == 0:
- parser.error('missing argument')
-
-db_file = args[0]
-
-# If the file doesn't exist, there's nothing to do
-if not os.path.exists(db_file):
- sys.exit(0)
-
-conn = sqlite3.connect(db_file)
-cur = conn.cursor()
-try:
- # This can be anything that works iff the "diffs" table exists
- cur.execute('SELECT name FROM diffs DESC LIMIT 1')
-except sqlite3.OperationalError as ex:
- # If it fails with 'no such table', create a new one or fail with
- # warning depending on the --upgrade command line option.
- if str(ex) == 'no such table: diffs':
- if options.upgrade:
- cur.execute('CREATE TABLE diffs (id INTEGER PRIMARY KEY, ' +
- 'zone_id INTEGER NOT NULL, ' +
- 'version INTEGER NOT NULL, ' +
- 'operation INTEGER NOT NULL, ' +
- 'name TEXT NOT NULL COLLATE NOCASE, ' +
- 'rrtype TEXT NOT NULL COLLATE NOCASE, ' +
- 'ttl INTEGER NOT NULL, rdata TEXT NOT NULL)')
- else:
- sys.stdout.write('Found an older version of SQLite3 DB file: ' +
- db_file + '\n' + "Perform '" + os.getcwd() +
- "/sqlite3-difftbl-check.py --upgrade " +
- db_file + "'\n" +
- 'before continuing install.\n')
- sys.exit(1)
-conn.close()