[llvm-commits] [zorg] r99157 - in /zorg/trunk/lnt/lnt: lnttool/__init__.py viewer/Config.py

Daniel Dunbar daniel at zuster.org
Sun Mar 21 17:55:34 PDT 2010


Author: ddunbar
Date: Sun Mar 21 19:55:34 2010
New Revision: 99157

URL: http://llvm.org/viewvc/llvm-project?rev=99157&view=rev
Log:
LNT: Add a separate database directory path, to allow easily rerooting databases, changing dir permissions, etc.

Modified:
    zorg/trunk/lnt/lnt/lnttool/__init__.py
    zorg/trunk/lnt/lnt/viewer/Config.py

Modified: zorg/trunk/lnt/lnt/lnttool/__init__.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/lnttool/__init__.py?rev=99157&r1=99156&r2=99157&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/__init__.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/__init__.py Sun Mar 21 19:55:34 2010
@@ -27,6 +27,10 @@
 # the web app runs as.
 tmp_dir = %(tmp_dir)r
 
+# Database directory, for easily rerooting the entire set of database. Database
+# paths are resolved relative to the config path + this path.
+db_dir = %(db_dir)r
+
 # The list of available databases, and their properties. At a minimum, there
 # should be a 'default' entry for the default database.
 databases = {
@@ -95,7 +99,7 @@
 
 
 def action_create(path='', name='LNT', config='lnt.cfg', wsgi='lnt.wsgi',
-                  tmp_dir='tmp', default_db='lnt.db',
+                  tmp_dir='lnt_tmp', db_dir='data', default_db='lnt.db',
                   hostname=platform.uname()[1], hostsuffix='perf'):
     """Create an LLVM nightly test installation"""
 
@@ -112,12 +116,15 @@
     import lnt
     zorg_dir = os.path.dirname(lnt.__file__)
 
+    db_dir_path = os.path.join(basepath, db_dir)
     cfg_path = os.path.join(basepath, config)
-    db_path = os.path.join(basepath, default_db)
+    db_path = os.path.join(db_dir_path, default_db)
     tmp_path = os.path.join(basepath, tmp_dir)
     wsgi_path = os.path.join(basepath, wsgi)
 
     os.mkdir(path)
+    os.mkdir(db_dir_path)
+    os.mkdir(tmp_path)
 
     cfg_version = kConfigVersion
     cfg_file = open(cfg_path, 'w')
@@ -128,8 +135,6 @@
     wsgi_file.write(kWSGITemplate % locals())
     wsgi_file.close()
 
-    os.mkdir(tmp_path)
-
     from lnt.viewer import PerfDB
     db = PerfDB.PerfDB('sqlite:///' + db_path)
     db.commit()
@@ -138,6 +143,7 @@
     print '  configuration file: %s' % cfg_path
     print '  WSGI app          : %s' % wsgi_path
     print '  database file     : %s' % db_path
+    print '  temporary dir     : %s' % tmp_path
     print '  host URL          : %s' % hosturl
     print
     print 'You can execute:'

Modified: zorg/trunk/lnt/lnt/viewer/Config.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/Config.py?rev=99157&r1=99156&r2=99157&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/Config.py (original)
+++ zorg/trunk/lnt/lnt/viewer/Config.py Sun Mar 21 19:55:34 2010
@@ -46,20 +46,24 @@
 
         zorgDir = os.path.join(baseDir, data['zorg'])
 
+        dbDir = data.get('db_dir', '.')
+        dbDirPath = os.path.join(baseDir, dbDir)
+
         # FIXME: Remove this default.
         tempDir = data.get('tmp_dir', 'viewer/resources/graphs')
 
         return Config(data.get('name', 'LNT'), zorgDir, data['zorgURL'],
-                      os.path.join(baseDir, tempDir),
-                      dict([(k,DBInfo.fromData(baseDir, v))
+                      dbDir, os.path.join(baseDir, tempDir),
+                      dict([(k,DBInfo.fromData(dbDirPath, v))
                                      for k,v in data['databases'].items()]),
                       ntEmailEnabled, ntEmailHost, ntEmailFrom, ntEmailTo)
 
-    def __init__(self, name, zorgDir, zorgURL, tempDir, databases,
+    def __init__(self, name, zorgDir, zorgURL, dbDir, tempDir, databases,
                  ntEmailEnabled, ntEmailHost, ntEmailFrom, ntEmailTo):
         self.name = name
         self.zorgDir = zorgDir
         self.zorgURL = zorgURL
+        self.dbDir = dbDir
         self.tempDir = tempDir
         while self.zorgURL.endswith('/'):
             self.zorgURL = zorgURL[:-1]





More information about the llvm-commits mailing list