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

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


Author: ddunbar
Date: Sun Mar 21 19:55:31 2010
New Revision: 99156

URL: http://llvm.org/viewvc/llvm-project?rev=99156&view=rev
Log:
LNT: Include temporary directory path in configuration.

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=99156&r1=99155&r2=99156&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/lnttool/__init__.py (original)
+++ zorg/trunk/lnt/lnt/lnttool/__init__.py Sun Mar 21 19:55:31 2010
@@ -23,6 +23,10 @@
 # Path to the LNT server.
 zorgURL = %(hosturl)r
 
+# Temporary directory, for use by the web app. This must be writable by the user
+# the web app runs as.
+tmp_dir = %(tmp_dir)r
+
 # The list of available databases, and their properties. At a minimum, there
 # should be a 'default' entry for the default database.
 databases = {
@@ -91,7 +95,7 @@
 
 
 def action_create(path='', name='LNT', config='lnt.cfg', wsgi='lnt.wsgi',
-                  default_db='lnt.db',
+                  tmp_dir='tmp', default_db='lnt.db',
                   hostname=platform.uname()[1], hostsuffix='perf'):
     """Create an LLVM nightly test installation"""
 
@@ -110,6 +114,7 @@
 
     cfg_path = os.path.join(basepath, config)
     db_path = os.path.join(basepath, default_db)
+    tmp_path = os.path.join(basepath, tmp_dir)
     wsgi_path = os.path.join(basepath, wsgi)
 
     os.mkdir(path)
@@ -123,6 +128,8 @@
     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,7 +145,9 @@
     print 'to test your installation with the builtin server.'
     print
     print 'For production use configure this application to run with any'
-    print 'WSGI capable web server.'
+    print 'WSGI capable web server. You may need to modify the permissions'
+    print 'on the database and temporary file directory to allow writing'
+    print 'by the web app.'
     print
 
 def main():

Modified: zorg/trunk/lnt/lnt/viewer/Config.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/lnt/lnt/viewer/Config.py?rev=99156&r1=99155&r2=99156&view=diff
==============================================================================
--- zorg/trunk/lnt/lnt/viewer/Config.py (original)
+++ zorg/trunk/lnt/lnt/viewer/Config.py Sun Mar 21 19:55:31 2010
@@ -8,7 +8,7 @@
     @staticmethod
     def fromData(baseDir, dict):
         dbPath = dict.get('path')
-        if not dbPath.startswith('mysql://'):
+        if '://' not in dbPath:
             dbPath = os.path.join(baseDir, dbPath)
         return DBInfo(dbPath,
                       bool(dict.get('showNightlytest')),
@@ -44,19 +44,23 @@
             ntEmailEnabled = False
             ntEmailHost = ntEmailFrom = ntEmailTo = ""
 
-        return Config(data.get('name', 'LNT'),
-                      os.path.join(baseDir, data['zorg']),
-                      data['zorgURL'],
+        zorgDir = os.path.join(baseDir, data['zorg'])
+
+        # 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))
-                            for k,v in data['databases'].items()]),
+                                     for k,v in data['databases'].items()]),
                       ntEmailEnabled, ntEmailHost, ntEmailFrom, ntEmailTo)
 
-    def __init__(self, name, zorgDir, zorgURL, databases,
+    def __init__(self, name, zorgDir, zorgURL, tempDir, databases,
                  ntEmailEnabled, ntEmailHost, ntEmailFrom, ntEmailTo):
         self.name = name
         self.zorgDir = zorgDir
         self.zorgURL = zorgURL
-        self.tempDir = os.path.join(zorgDir, 'viewer', 'resources', 'graphs')
+        self.tempDir = tempDir
         while self.zorgURL.endswith('/'):
             self.zorgURL = zorgURL[:-1]
         self.databases = databases





More information about the llvm-commits mailing list