[LNT] r311709 - Remove a bunch of database versioning code

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 14:56:33 PDT 2017


Author: matze
Date: Thu Aug 24 14:56:33 2017
New Revision: 311709

URL: http://llvm.org/viewvc/llvm-project?rev=311709&view=rev
Log:
Remove a bunch of database versioning code

There has been no other version than 0.4 for a long while and it is
unlikely to ever change again. Remove the code and get rid of some
complexity.

Modified:
    lnt/trunk/lnt/lnttool/create.py
    lnt/trunk/lnt/lnttool/viewcomparison.py
    lnt/trunk/lnt/server/config.py
    lnt/trunk/lnt/server/ui/decorators.py
    lnt/trunk/lnt/server/ui/views.py

Modified: lnt/trunk/lnt/lnttool/create.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/create.py?rev=311709&r1=311708&r2=311709&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/create.py (original)
+++ lnt/trunk/lnt/lnttool/create.py Thu Aug 24 14:56:33 2017
@@ -39,8 +39,7 @@ secret_key = %(secret_key)r
 # The list of available databases, and their properties. At a minimum, there
 # should be a 'default' entry for the default database.
 databases = {
-    'default' : { 'path' : %(default_db)r,
-                  'db_version' : %(default_db_version)r },
+    'default' : { 'path' : %(default_db)r },
     }
 
 # The LNT email configuration.
@@ -126,8 +125,6 @@ LNT configuration.
     init_logger(logging.INFO if show_sql else logging.WARNING,
                 show_sql=show_sql)
 
-    default_db_version = "0.4"
-
     basepath = os.path.abspath(instance_path)
     if os.path.exists(basepath):
         raise SystemExit("error: invalid path: %r already exists" % basepath)

Modified: lnt/trunk/lnt/lnttool/viewcomparison.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/lnttool/viewcomparison.py?rev=311709&r1=311708&r2=311709&view=diff
==============================================================================
--- lnt/trunk/lnt/lnttool/viewcomparison.py (original)
+++ lnt/trunk/lnt/lnttool/viewcomparison.py Thu Aug 24 14:56:33 2017
@@ -68,7 +68,7 @@ def action_view_comparison(report_a, rep
         url = 'http://%s:%d' % (hostname, port)
         db_path = os.path.join(tmpdir, 'data.db')
         db_info = lnt.server.config.DBInfo(
-            'sqlite:///%s' % (db_path,), '0.4', None,
+            'sqlite:///%s' % (db_path,), None,
             lnt.server.config.EmailConfig(False, '', '', []), "0")
         # _(self, name, zorgURL, dbDir, tempDir,
         # profileDir, secretKey, databases, blacklist):

Modified: lnt/trunk/lnt/server/config.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/config.py?rev=311709&r1=311708&r2=311709&view=diff
==============================================================================
--- lnt/trunk/lnt/server/config.py (original)
+++ lnt/trunk/lnt/server/config.py Thu Aug 24 14:56:33 2017
@@ -62,24 +62,24 @@ class DBInfo:
 
         baseline_revision = config_data.get('baseline_revision',
                                             default_baseline_revision)
+        db_version = config_data.get('db_version', '0.4')
+        if db_version != '0.4':
+            raise NotImplementedError("unable to load version %r database" % (
+                                      db_version))
 
         return DBInfo(dbPath,
-                      str(config_data.get('db_version', '0.4')),
                       config_data.get('shadow_import', None),
                       email_config,
                       baseline_revision)
 
     @staticmethod
     def dummy_instance():
-        return DBInfo("sqlite:///:memory:", "0.4", None,
+        return DBInfo("sqlite:///:memory:", None,
                       EmailConfig(False, '', '', []), 0)
 
-    def __init__(self, path,
-                 db_version, shadow_import, email_config,
-                 baseline_revision):
+    def __init__(self, path, shadow_import, email_config, baseline_revision):
         self.config = None
         self.path = path
-        self.db_version = db_version
         self.shadow_import = shadow_import
         self.email_config = email_config
         self.baseline_revision = baseline_revision
@@ -187,13 +187,8 @@ class Config:
         if db_entry is None:
             return None
 
-        # Instantiate the appropriate database version.
-        if db_entry.db_version == '0.4':
-            return lnt.server.db.v4db.V4DB(db_entry.path, self,
-                                           db_entry.baseline_revision)
-
-        raise NotImplementedError("unable to load version %r database" % (
-            db_entry.db_version))
+        return lnt.server.db.v4db.V4DB(db_entry.path, self,
+                                       db_entry.baseline_revision)
 
     def get_database_names(self):
         return self.databases.keys()

Modified: lnt/trunk/lnt/server/ui/decorators.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/decorators.py?rev=311709&r1=311708&r2=311709&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/decorators.py (original)
+++ lnt/trunk/lnt/server/ui/decorators.py Thu Aug 24 14:56:33 2017
@@ -8,7 +8,7 @@ frontend = flask.Blueprint("lnt", __name
 
 
 # Decorator for implementing per-database routes.
-def db_route(rule, only_v3=True, **options):
+def db_route(rule, **options):
     """
     LNT specific route for endpoints which always refer to some database
     object.
@@ -24,12 +24,6 @@ def db_route(rule, only_v3=True, **optio
             if g.db_info is None:
                 abort(404)
 
-            # Disable non-v0.3 database support, if requested.
-            if only_v3 and g.db_info.db_version != '0.3':
-                return render_template("error.html", message="""\
-UI support for database with version %r is not yet implemented.""" % (
-                        g.db_info.db_version))
-
             # Compute result.
             result = f(**args)
 

Modified: lnt/trunk/lnt/server/ui/views.py
URL: http://llvm.org/viewvc/llvm-project/lnt/trunk/lnt/server/ui/views.py?rev=311709&r1=311708&r2=311709&view=diff
==============================================================================
--- lnt/trunk/lnt/server/ui/views.py (original)
+++ lnt/trunk/lnt/server/ui/views.py Thu Aug 24 14:56:33 2017
@@ -90,7 +90,7 @@ def select_db():
 # Per-Database Routes
 
 
- at db_route('/', only_v3=False)
+ at db_route('/')
 def index():
     return render_template("index.html")
 
@@ -158,7 +158,7 @@ def _do_submit():
     return response
 
 
- at db_route('/submitRun', only_v3=False, methods=('GET', 'POST'))
+ at db_route('/submitRun', methods=('GET', 'POST'))
 def submit_run():
     """Compatibility url that hardcodes testsuite to 'nts'"""
     if request.method == 'GET':
@@ -416,15 +416,8 @@ def v4_text_report(id):
 
 
 # Compatilibity route for old run pages.
- at db_route("/simple/<tag>/<int:id>/", only_v3=False)
+ at db_route("/simple/<tag>/<int:id>/")
 def simple_run(tag, id):
-    # Attempt to find a V4 run which declares that it matches this simple run
-    # ID. We do this so we can preserve some URL compatibility for old
-    # databases.
-    if g.db_info.db_version != '0.4':
-        return render_template("error.html", message="""\
-Invalid URL for version %r database.""" % (g.db_info.db_version,))
-
     # Get the expected test suite.
     db = request.get_db()
     ts = db.testsuite[tag]
@@ -441,7 +434,7 @@ Invalid URL for version %r database."""
 
     # Otherwise, report an error.
     return render_template("error.html", message="""\
-Unable to find a v0.4 run for this ID. Please use the native v0.4 URL interface
+Unable to find a run for this ID. Please use the native v4 URL interface
 (instead of the /simple/... URL schema).""")
 
 
@@ -1340,7 +1333,7 @@ def get_summary_config_path():
                         'summary_report_config.json')
 
 
- at db_route("/summary_report/edit", only_v3=False, methods=('GET', 'POST'))
+ at db_route("/summary_report/edit", methods=('GET', 'POST'))
 def v4_summary_report_ui():
     # If this is a POST request, update the saved config.
     if request.method == 'POST':
@@ -1390,7 +1383,7 @@ def v4_summary_report_ui():
                            all_orders=all_orders)
 
 
- at db_route("/summary_report", only_v3=False)
+ at db_route("/summary_report")
 def v4_summary_report():
     # Load the summary report configuration.
     config_path = get_summary_config_path()




More information about the llvm-commits mailing list