You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2010/09/03 13:05:04 UTC

svn commit: r992265 - in /gump/live: ./ python/gump/actor/mysql/ python/gump/actor/stats/mysql/ python/gump/core/language/ python/gump/core/run/ python/gump/core/runner/ python/gump/core/update/ python/gump/util/

Author: bodewig
Date: Fri Sep  3 11:05:04 2010
New Revision: 992265

URL: http://svn.apache.org/viewvc?rev=992265&view=rev
Log:
merge DB related fixes from trunk - commit explicitly and only one isHistorical method in options

Modified:
    gump/live/   (props changed)
    gump/live/python/gump/actor/mysql/databaser.py
    gump/live/python/gump/actor/stats/mysql/statsdb.py
    gump/live/python/gump/core/language/java.py   (props changed)
    gump/live/python/gump/core/run/options.py
    gump/live/python/gump/core/runner/runner.py
    gump/live/python/gump/core/update/bzr.py   (props changed)
    gump/live/python/gump/core/update/darcs.py   (props changed)
    gump/live/python/gump/core/update/hg.py   (props changed)
    gump/live/python/gump/util/mysql.py

Propchange: gump/live/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  3 11:05:04 2010
@@ -1 +1 @@
-/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923
+/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923,988801,988804,989112,990012-990114,991430,991577,991802

Modified: gump/live/python/gump/actor/mysql/databaser.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/actor/mysql/databaser.py?rev=992265&r1=992264&r2=992265&view=diff
==============================================================================
--- gump/live/python/gump/actor/mysql/databaser.py (original)
+++ gump/live/python/gump/actor/mysql/databaser.py Fri Sep  3 11:05:04 2010
@@ -10,7 +10,7 @@
 #     http://www.apache.org/licenses/LICENSE-2.0
 # 
 # Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
+# distributed under the License is distributed on an "AS IS" BASIS, 
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
@@ -19,104 +19,110 @@
     Stash in Database
 """
 
-import time
-import os
-import sys
-
 import MySQLdb
 import MySQLdb.cursors
 
-from gump import log
-from gump.core.run.gumprun import *
 import gump.core.run.actor
 
 class Databaser(gump.core.run.actor.AbstractRunActor):
-    
-    def __init__(self,run):              
-        gump.core.run.actor.AbstractRunActor.__init__(self,run)    
-        self.dbInfo=self.workspace.getDatabaseInformation()
-        
-    def processOtherEvent(self,event):   
+
+    def __init__(self, run):
+        gump.core.run.actor.AbstractRunActor.__init__(self, run)
+        self.dbInfo = self.workspace.getDatabaseInformation()
+
+    def processOtherEvent(self, event):
         pass
-                      
+
     def processWorkspace(self):
         """
         Add information about the workspace to the database 
         """
         pass
-    
-    def processModule(self,module):    
+
+    def processModule(self, module):
         """
         Add information about the module to the database
         """
-        conn=None
-        helper=None
+        conn = None
+        helper = None
         try:
-            conn=self.getConnected()
-            helper=gump.util.mysql.DbHelper(conn,self.dbInfo.getDatabase())
-            
+            conn = self.getConnected()
+            helper = gump.util.mysql.DbHelper(conn, self.dbInfo.getDatabase())
+
             # Prepare the data
             settings = {}
-            
-            settings['run_id'] = "'" + self.run.getRunHexGuid() + "'"  
-            settings['module_name']="'" + module.getName() + "'"
-            settings['state']=module.getState()
-            settings['reason']=module.getReason()
-            
+
+            settings['run_id'] = "'" + self.run.getRunHexGuid() + "'"
+            settings['module_name'] = "'" + module.getName() + "'"
+            settings['state'] = module.getState()
+            settings['reason'] = module.getReason()
+
             if module.hasCause():
-                settings['cause']="'" + module.getCause().getName() + "'"
-                
+                settings['cause'] = "'" + module.getCause().getName() + "'"
+
             if module.hasTimes():
-                settings['start']="'" + module.getStart().getTimestamp().strftime('%Y-%m-%d %H:%M:%S') + "'"
-                settings['end']="'" + module.getEnd().getTimestamp().strftime('%Y-%m-%d %H:%M:%S') + "'"
-            
-            helper.insert('gump_module_run',settings)
-            
+                settings['start'] = "'" + _format(module.getStart())  + "'"
+                settings['end'] = "'" + _format(module.getEnd()) + "'"
+
+            helper.insert('gump_module_run', settings)
+            helper.commit()
+
         finally:
-            if conn: conn.close()
-    
-    def processProject(self,project):    
+            if helper:
+                helper.close()
+            elif conn:
+                conn.close()
+
+    def processProject(self, project):
         """
         Add information about the project to the database 
         """
-        conn=None
-        helper=None
+        conn = None
+        helper = None
         try:
-            conn=self.getConnected()
-            helper=gump.util.mysql.DbHelper(conn,self.dbInfo.getDatabase())
-            
+            conn = self.getConnected()
+            helper = gump.util.mysql.DbHelper(conn, self.dbInfo.getDatabase())
+
             # Prepare the data
             settings = {}
-            
+
             settings['run_id'] = "'" + self.run.getRunHexGuid() + "'"
-            settings['project_name']="'" + project.getName() + "'"
-            settings['state']=project.getState()
-            settings['reason']=project.getReason()
-            
+            settings['project_name'] = "'" + project.getName() + "'"
+            settings['state'] = project.getState()
+            settings['reason'] = project.getReason()
+
             if project.hasCause():
-                settings['cause']="'" + project.getCause().getName() + "'"
-                
+                settings['cause'] = "'" + project.getCause().getName() + "'"
+
             if project.hasTimes():
-                settings['start']="'" + project.getStart().getTimestamp().strftime('%Y-%m-%d %H:%M:%S') + "'"
-                settings['end']="'" + project.getEnd().getTimestamp().strftime('%Y-%m-%d %H:%M:%S') + "'"
-            
-            helper.insert('gump_project_run',settings)
-            
+                settings['start'] = "'" + _format(project.getStart()) + "'"
+                settings['end'] = "'" + _format(project.getEnd()) + "'"
+
+            helper.insert('gump_project_run', settings)
+            helper.commit()
+
         finally:
-            if conn: conn.close()
-        
-        
+            if helper:
+                helper.close()
+            elif conn:
+                conn.close()
+
+
     def getConnected(self):
         """
         Get a database connection.
         """
-                
+
         return MySQLdb.Connect(
-                    host=self.dbInfo.getHost(), 
-                    user=self.dbInfo.getUser(),
-                    passwd=self.dbInfo.getPasswd(), 
-                    db=self.dbInfo.getDatabase(),
-                    compress=1,
-                    cursorclass=MySQLdb.cursors.DictCursor)
-        
-           
+                    host = self.dbInfo.getHost(), 
+                    user = self.dbInfo.getUser(), 
+                    passwd = self.dbInfo.getPasswd(), 
+                    db = self.dbInfo.getDatabase(), 
+                    compress = 1, 
+                    cursorclass = MySQLdb.cursors.DictCursor)
+
+def _format(timestamp):
+    """
+    Formats a timestamp
+    """
+    return timestamp.getTimestamp().strftime('%Y-%m-%d %H:%M:%S')

Modified: gump/live/python/gump/actor/stats/mysql/statsdb.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/actor/stats/mysql/statsdb.py?rev=992265&r1=992264&r2=992265&view=diff
==============================================================================
--- gump/live/python/gump/actor/stats/mysql/statsdb.py (original)
+++ gump/live/python/gump/actor/stats/mysql/statsdb.py Fri Sep  3 11:05:04 2010
@@ -190,17 +190,22 @@ class StatisticsDB:
             for (key, value) in extras.items():
                 settings[key] = value
 
+        def setter(helper):
+            helper.set(table_name, column_name, stats.name, settings)
+            helper.commit()
+
         # Perform the update (we've ensured a row exists).
-        self._with_reconnect_on_error(\
-            lambda helper:
-                helper.set(table_name, column_name, stats.name, settings))
+        self._with_reconnect_on_error(setter)
 
     def _delStats(self, table_name, column_name, stats):
         """ Perform an SQL DELETE """
+
+        def deleter(helper):
+            helper.delete(table_name, column_name, stats.name)
+            helper.commit()
+
         # Perform the delete
-        self._with_reconnect_on_error(\
-            lambda helper:
-                helper.delete(table_name, column_name, stats.name))
+        self._with_reconnect_on_error(deleter)
 
     def _getBaseStats(self, stats, settings):
         """
@@ -244,7 +249,7 @@ class StatisticsDB:
                         #print "SET ATTR : " + `value` 
                         settings[column] = "'" +\
                             value.strftime('%Y-%m-%d %H:%M:%S') + "'"
-                    elif isinstance(value,types.StringTypes):
+                    elif isinstance(value, types.StringTypes):
                         settings[column] = "'" + str(value) + "'"
                     else:
                         settings[column] = str(value)

Propchange: gump/live/python/gump/core/language/java.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  3 11:05:04 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/language/java.py:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923
+/gump/trunk/python/gump/core/language/java.py:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923,988801,988804,989112,990012-990114,991430,991577,991802

Modified: gump/live/python/gump/core/run/options.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/run/options.py?rev=992265&r1=992264&r2=992265&view=diff
==============================================================================
--- gump/live/python/gump/core/run/options.py (original)
+++ gump/live/python/gump/core/run/options.py Fri Sep  3 11:05:04 2010
@@ -11,7 +11,7 @@
 #     http://www.apache.org/licenses/LICENSE-2.0
 # 
 # Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
+# distributed under the License is distributed on an "AS IS" BASIS, 
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
@@ -22,60 +22,51 @@
  
 """
 
-import os.path
-import os
-import sys
-import fnmatch
-
-from gump import log
-from gump.core.config import dir, default, basicConfig
-from gump.core.run.gumpenv import GumpEnvironment
-
-import gump.util
-import gump.util.work
-import gump.util.note
-
-from gump.core.model.workspace import Workspace
-from gump.core.model.module import Module
-from gump.core.model.project import Project
-from gump.core.model.depend import  ProjectDependency
-from gump.core.model.state import *
-    
 ###############################################################################
 # Init
 ###############################################################################
 
 # Overall objectives
-OBJECTIVE_UNSET=0
-OBJECTIVE_UPDATE=0x01
-OBJECTIVE_BUILD=0x02
-OBJECTIVE_CHECK=0x04
-OBJECTIVE_DOCUMENT=0x08
+OBJECTIVE_UNSET = 0
+OBJECTIVE_UPDATE = 0x01
+OBJECTIVE_BUILD = 0x02
+OBJECTIVE_CHECK = 0x04
+OBJECTIVE_DOCUMENT = 0x08
 
-OBJECTIVE_REDO=OBJECTIVE_UPDATE | OBJECTIVE_BUILD
-OBJECTIVE_INTEGRATE=OBJECTIVE_UPDATE | OBJECTIVE_BUILD | \
+OBJECTIVE_REDO = OBJECTIVE_UPDATE | OBJECTIVE_BUILD
+OBJECTIVE_INTEGRATE = OBJECTIVE_UPDATE | OBJECTIVE_BUILD | \
                         OBJECTIVE_DOCUMENT
-OBJECTIVE_OFFLINE=OBJECTIVE_BUILD | OBJECTIVE_DOCUMENT
+OBJECTIVE_OFFLINE = OBJECTIVE_BUILD | OBJECTIVE_DOCUMENT
+
+# Features
+FEATURE_UNSET = 0
+FEATURE_STATISTICS = 0x01
+FEATURE_RESULTS = 0x02
+FEATURE_NOTIFY = 0x04
+FEATURE_DIAGRAM = 0x08
+FEATURE_SYNDICATE = 0x10
+FEATURE_DESCRIBE = 0x20
+FEATURE_PUBLISH = 0x40
+FEATURE_DOCUMENT = 0x80
+FEATURE_HISTORICAL = 0x100
+
+FEATURE_DEFAULT = FEATURE_STATISTICS \
+    | FEATURE_SYNDICATE \
+    | FEATURE_DESCRIBE \
+    | FEATURE_DOCUMENT \
+    | FEATURE_NOTIFY
+
+FEATURE_ALL = FEATURE_STATISTICS \
+    | FEATURE_RESULTS \
+    | FEATURE_NOTIFY \
+    | FEATURE_DIAGRAM \
+    | FEATURE_SYNDICATE \
+    | FEATURE_DESCRIBE \
+    | FEATURE_PUBLISH \
+    | FEATURE_DOCUMENT
+
+FEATURE_OFFICIAL = FEATURE_ALL
 
-# Features            
-FEATURE_UNSET=0
-FEATURE_STATISTICS=0x01
-FEATURE_RESULTS=0x02
-FEATURE_NOTIFY=0x04
-FEATURE_DIAGRAM=0x08
-FEATURE_SYNDICATE=0x10
-FEATURE_DESCRIBE=0x20
-FEATURE_PUBLISH=0x40
-FEATURE_DOCUMENT=0x80
-FEATURE_HISTORICAL=0x80
-
-FEATURE_DEFAULT=FEATURE_STATISTICS|FEATURE_SYNDICATE|FEATURE_DESCRIBE|FEATURE_DOCUMENT|FEATURE_NOTIFY
-            
-FEATURE_ALL=FEATURE_STATISTICS|FEATURE_RESULTS|FEATURE_NOTIFY|FEATURE_DIAGRAM|    \
-                FEATURE_SYNDICATE|FEATURE_DESCRIBE|FEATURE_PUBLISH|FEATURE_DOCUMENT
-            
-FEATURE_OFFICIAL=FEATURE_ALL
-            
 
 ###############################################################################
 # Classes
@@ -83,185 +74,188 @@ FEATURE_OFFICIAL=FEATURE_ALL
 
 class GumpRunOptions:
     """
-    
+
     GumpRunOptions are the 'switches' that dictate the code path
-    
+
     """
     def __init__(self):
  
-        self.debug=False	
-        self.verbose=False	
-        self.cache=True	# Defaults to CACHE
-        self.quick=True	# Defaults to QUICK
-        self.dated=False	# Defaults to NOT dated.
-        self.optimize=False	# Do the least ammount of work...
-        self.official=False	# Do a full run (with publishing e-mail)
-        self.historical=False # Historical Database
-        
+        self.debug = False
+        self.verbose = False
+        self.cache = True # Defaults to CACHE
+        self.quick = True # Defaults to QUICK
+        self.dated = False        # Defaults to NOT dated.
+        self.optimize = False     # Do the least ammount of work...
+        self.official = False     # Do a full run (with publishing e-mail)
+
         # Default is XDOCS/XHTML, but can also force text with --text 
-        self.text=False        
-        
+        self.text = False
+
         # Defautl for XDOCS is XHTML
-        self.xdocs=False
-        
-        self.objectives=OBJECTIVE_INTEGRATE
-        self.features=FEATURE_DEFAULT
-        
+        self.xdocs = False
+
+        self.objectives = OBJECTIVE_INTEGRATE
+        self.features = FEATURE_DEFAULT
+
+        self.resolver = None
+
     def isDated(self):
         return self.dated
-        
-    def setDated(self,dated):
-        self.dated=dated        
-        
-    def isHistorical(self):
-        return self.historical
-        
-    def setHistorical(self,historical):
-        self.historical=historical
-        
+
+    def setDated(self, dated):
+        self.dated = dated
+
+    def setHistorical(self, historical):
+        if historical:
+            self.enableFeature(FEATURE_HISTORICAL)
+        else:
+            self.disableFeature(FEATURE_HISTORICAL)
+
     def isOfficial(self):
         """
         Is an official run requested?
         """
         return self.official
-        
-    def setOfficial(self,official):
+
+    def setOfficial(self, official):
         """
         An official run
         """
-        self.official=official
-        self.features=FEATURE_OFFICIAL
-        
+        self.official = official
+        self.features = FEATURE_OFFICIAL
+
     def isQuick(self):
         """
         Is a 'quick' (not complete, i.e. list not sequence) run requested?
         """
         return self.quick
-        
-    def setQuick(self,quick):
+
+    def setQuick(self, quick):
         """
         Set a 'quick' (not complete, i.e. list not sequence) run request
-        """    
-        self.quick=quick
-        
+        """
+        self.quick = quick
+
     def isText(self):
         """
         Is Text documentation generation requested?
         """
         return self.text
-        
-    def setText(self,text):
-        self.text=text
-        
+
+    def setText(self, text):
+        self.text = text
+
     def isXDocs(self):
         """
         Is XDOC documentation generation requested?
         """
         return self.xdocs
-        
-    def setXDocs(self,xdocs):
+
+    def setXDocs(self, xdocs):
         """
         Set XDOC documentation generation
         """
-        self.xdocs=xdocs
-        
+        self.xdocs = xdocs
+
     def isCache(self):
         """
         Is metadata caching requested?
         """
         return self.cache
-        
-    def setCache(self,cache):
+
+    def setCache(self, cache):
         """
         Perform metadata caching
         """
-        self.cache=cache
-        
+        self.cache = cache
+
     def isDebug(self):
         """
         Is a debug run requested?
         """
         return self.debug
-        
-    def setDebug(self,debug):
-        self.debug=debug
-        
+
+    def setDebug(self, debug):
+        self.debug = debug
+
     def isVerbose(self):
         return self.verbose
-        
-    def setVerbose(self,verbose):
+
+    def setVerbose(self, verbose):
         """
         A verbose run
         """
-        self.verbose=verbose
+        self.verbose = verbose
 
-    def setResolver(self,resolver):
+    def setResolver(self, resolver):
         """
         The File/URL resolver (from Gump objects)
         """
-        self.resolver=resolver        
+        self.resolver = resolver
 
     def getResolver(self):
         return self.resolver
-        
+
     # Objectives...
-    def setObjectives(self,objectives):
+    def setObjectives(self, objectives):
         """
         Set the objectives
         """
-        self.objectives=objectives
-        
+        self.objectives = objectives
+
     def getObjectives(self):
         return self.objectives
-        
-    def _testObjectiveIsSet(self,objective):
+
+    def _testObjectiveIsSet(self, objective):
         """
         Helper to test a single objective
         """
-        if (self.objectives & objective): return True
+        if (self.objectives & objective):
+            return True
         return False
-        
+
     # Features...
-    def setFeatures(self,features):
+    def setFeatures(self, features):
         """
         Set the features
         """
-        self.features=features
-        
+        self.features = features
+
     def getFeatures(self):
         return self.features
-        
-    def disableFeature(self,feature):        
+
+    def disableFeature(self, feature):
         """
         Disable a specific feature (or bitwise or of features)
-        """    
+        """
         self.features = (self.features ^ feature)
-        
-    def enableFeature(self,feature):
+
+    def enableFeature(self, feature):
         """
         Enable a specific feature (or bitwise or of features)
         """
         self.features = (self.features | feature)
-        
-    def _testFeatureIsSet(self,feature):
+
+    def _testFeatureIsSet(self, feature):
         """
         A utility method to see if a feature is set.
         """
-        if (self.features & feature): return True
+        if (self.features & feature):
+            return True
         return False
-        
+
     def isUpdate(self):
         """
         Are Updates (CVS|SVN|...) to be performed?
         """
-        return self._testObjectiveIsSet(OBJECTIVE_UPDATE)        
-        
+        return self._testObjectiveIsSet(OBJECTIVE_UPDATE)
+
     def isBuild(self):
         """
         Are Builds (Ant|...) to be performed?
         """
         return self._testObjectiveIsSet(OBJECTIVE_BUILD)
-              
+
     def isCheck(self): 
         """
         Is this really jsut a 'check' or things?
@@ -290,10 +284,8 @@ class GumpRunOptions:
         """
         Is documentation to be created for this run?
         """
-        
-    def isDocument(self):
         return  self._testObjectiveIsSet(OBJECTIVE_DOCUMENT) and \
-                self._testFeatureIsSet(FEATURE_DOCUMENT)
+            self._testFeatureIsSet(FEATURE_DOCUMENT)
 
     def isSyndicate(self):
         """

Modified: gump/live/python/gump/core/runner/runner.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/runner/runner.py?rev=992265&r1=992264&r2=992265&view=diff
==============================================================================
--- gump/live/python/gump/core/runner/runner.py (original)
+++ gump/live/python/gump/core/runner/runner.py Fri Sep  3 11:05:04 2010
@@ -41,9 +41,9 @@ from gump.actor.mvnrepoproxy.proxycontro
 class GumpRunner(RunSpecific):
     """
     Base class for other runners that initializes several helper objects.
-    
+
     the lifecycle for this class is as follows:
-    
+
         runner.initialize() # set up environment
         runner.perform()    # delegates to subclass to perform actual work
         runner.finalize()   # do some cleanup work
@@ -51,119 +51,119 @@ class GumpRunner(RunSpecific):
 
     def __init__(self, run, log=None):
         RunSpecific.__init__(self, run)
-        
+
         if not log: from gump import log
         self.log = log
-        
-        # Main players (soon we ought make them into actors, like the others).         
+
+        # Main players (soon we ought make them into actors, like the others).
         self.updater = GumpUpdater(run)
         self.builder = GumpBuilder(run)
-        
+
         # A helper per language/type
         self.java = gump.core.language.java.JavaHelper(run)
         self.csharp = gump.core.language.csharp.CSharpHelper(run)
-        
+
         # Stash them for reference...
         run.setUpdater(self.updater)
         run.setBuilder(self.builder)
-            
-        run.addLanguageHelper(Project.JAVA_LANGUAGE,self.java)  
+
+        run.addLanguageHelper(Project.JAVA_LANGUAGE,self.java)
         run.addLanguageHelper(Project.CSHARP_LANGUAGE,self.csharp)
-        
+
     def initialize(self,exitOnError=True):
         """
         Set up all of the neccessary resources for the subclass implementation to use.
         Besides modifying the properties of this class, we also modify bits of the
         workspace and bits of the GumpRun instance.
-        
+
         TODO: currently this method must be called from the performRun() method of the
         subclass. Call it from perform() instead.
-        
+
         TODO: clean this up and have a clear responsibility split between the various
         parts we're modifying here...
         """
-        
+
         logResourceUtilization('Before initialize')
-        
+
         # Perform start-up logic 
         workspace = self.run.getWorkspace()
-                
+
         # Check out environment
         if not self.run.getOptions().isQuick():
-            logResourceUtilization('Before check environment')            
+            logResourceUtilization('Before check environment')
             self.run.getEnvironment().checkEnvironment(exitOnError)
             logResourceUtilization('After check environment')
-        
+
         # Now, force cetain things (like blanking CLASSPATH)
         self.run.getEnvironment().setEnvironment()
-        
+
         # Modify the log location on the fly, if --dated
         if self.run.getOptions().isDated():
-            workspace.setDatedDirectories()     
-                    
+            workspace.setDatedDirectories()
+
         # Check the workspace
         if not workspace.getVersion() >= setting.WS_VERSION:
             message='Workspace version ['+str(workspace.getVersion())+'] below preferred [' + setting.WS_VERSION + ']'
             workspace.addWarning(message)
-            self.log.warn(message)   
+            self.log.warn(message)
 
         if not workspace.getVersion() >= setting.WS_MINIMUM_VERSION:
             message='Workspace version ['+str(workspace.getVersion())+'] below minimum [' + setting.WS_MINIMUM_VERSION + ']'
             workspace.addError(message)
-            self.log.error(message)   
-            
-        # Write workspace to a 'merge' file        
+            self.log.error(message)
+
+        # Write workspace to a 'merge' file
         if not self.run.getOptions().isQuick():
             workspace.writeXmlToFile(default.merge)
             workspace.setMergeFile(default.merge)
-                 
+
         # :TODO: Put this somewhere else, and/or make it depend upon something...
         workspace.changeState(STATE_SUCCESS)
  
         # Initialize Actors
-        self.initializeActors()             
+        self.initializeActors()
  
         # Let's get going...
         self.run._dispatchEvent(InitializeRunEvent(self.run))
-    
+
     def initializeActors(self):
         """
         Populate the GumpRun instance with the various actors.
-        
+
         The actors handle all the "optional" behaviour like writing HTML or sending e-mail. One
         way to think of this method is where we configure the "glue" between all the different
         bits and pieces of the application.
-        
+
         TODO:
         """
-        
+
         # Stamp times
         self.run.registerActor(TimeKeeper(self.run))
-        
+
         # Update statistics
         self.run.registerActor(Statistician(self.run))
-        
+
         # Load/Generate results (if we are in a multi-server)
         # environment, where result sharing is important
         if self.run.getOptions().isResults() and \
             self.run.getWorkspace().hasMultiplePythonServers():
-            self.run.registerActor(Resulter(self.run))            
+            self.run.registerActor(Resulter(self.run))
 
         # Add Database storer
         if self.run.getOptions().isOfficial() and \
             self.run.getWorkspace().hasDatabaseInformation() and \
-            not self.run.getOptions().isHistorical():    
+            not self.run.getOptions().isHistorical():
             try:
                 import gump.actor.mysql.databaser
                 self.run.registerActor(gump.actor.mysql.databaser.Databaser(self.run))
             except Exception, details:
                 self.log.warning('Unable to register Database Actor :  %s ' % details,
                             exc_info=1)
-        
+
         # Add Historical Database storer -- ??? no such thing...
         if self.run.getOptions().isOfficial() and \
             self.run.getWorkspace().hasDatabaseInformation() and \
-            self.run.getOptions().isHistorical():       
+            self.run.getOptions().isHistorical():
             try:
                 import gump.actor.history.historical
                 self.run.registerActor(gump.actor.history.historical.Historical(self.run))
@@ -181,7 +181,7 @@ class GumpRunner(RunSpecific):
             # now create the Dynagumper using that database
             import gump.actor.mysql.dynagumper
             self.run.registerActor(gump.actor.mysql.dynagumper.Dynagumper(self.run,database))
-        
+
         # Document..
         # Use XDOCS if not overridden...
         xdocs=False
@@ -190,28 +190,28 @@ class GumpRunner(RunSpecific):
             documenter=TextDocumenter(self.run)
         else:
             xdocs=True
-            documenter=XDocDocumenter(	self.run,	\
+            documenter=XDocDocumenter(  self.run,       \
                                         self.run.getWorkspace().getBaseDirectory(), \
-                                        self.run.getWorkspace().getLogUrl())  
-        self.run.getOptions().setResolver(documenter.getResolver())                                                  
-        self.run.registerActor(documenter)    
-        
+                                        self.run.getWorkspace().getLogUrl())
+        self.run.getOptions().setResolver(documenter.getResolver())
+        self.run.registerActor(documenter)
+
         # Syndicate once documented
         if self.run.getOptions().isSyndicate():
-            self.run.registerActor(Syndicator(self.run))   
-            
+            self.run.registerActor(Syndicator(self.run))
+
         # Describe [once documented]
         if self.run.getOptions().isDescribe():
             try:
                 import gump.actor.rdf.describer
-                self.run.registerActor(gump.actor.rdf.describer.RDFDescriber(self.run))   
+                self.run.registerActor(gump.actor.rdf.describer.RDFDescriber(self.run))
             except Exception, details:
                 self.log.warning('Unable to register RDF Describer :  %s ' % details,
                             exc_info=1)
-            
+
         # Publish artifacts
         if self.run.getOptions().isPublish():
-            self.run.registerActor(RepositoryPublisher(self.run))   
+            self.run.registerActor(RepositoryPublisher(self.run))
 
         # Handle mvn repository proxy
         if not self.run.getEnvironment().noMvnRepoProxy:
@@ -219,32 +219,32 @@ class GumpRunner(RunSpecific):
 
         # Clear local mvn repository
         self.run.registerActor(LocalMvnRepositoryCleaner(self.run))
-                    
+
         # Synchonize
         if xdocs:
             self.run.registerActor(Synchronizer(self.run,documenter))
-        
+
         # Notify last
         if self.run.getOptions().isNotify() and self.run.getWorkspace().isNotify():
-            self.run.registerActor(Notifier(self.run))    
+            self.run.registerActor(Notifier(self.run))
         else:
             self.log.info('Not doing notifications [%s,%s]' \
                 % (self.run.getOptions().isNotify(), \
                     self.run.getWorkspace().isNotify() ) )
-        
-        # See what we have...            
+
+        # See what we have...
         self.run.logActors()
-        
-    def finalize(self):            
+
+    def finalize(self):
         # About to shutdown...
         self.run._dispatchEvent(FinalizeRunEvent(self.run))
-        
+
     def getUpdater(self):
         return self.updater
-        
+
     def getBuilder(self):
         return self.builder
-   
+
     def perform(self):
         """
         Does the actual gump work by delegating to the performRun(run) method of a subclass.
@@ -252,13 +252,13 @@ class GumpRunner(RunSpecific):
         if not hasattr(self,'performRun'):
             raise RuntimeError, \
                     'Class [' + `self.__class__` + '] needs a performRun(self,run)'
-        
+
         if not callable(self.performRun):
             raise RuntimeError, \
                     'Class [' + `self.__class__` + '] needs a callable performRun(self,run)'
-        
+
         self.log.debug('Perform run using [' + `self` + ']')
-        
+
         return self.performRun()
 
 def getRunner(run):

Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  3 11:05:04 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923
+/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923,988801,988804,989112,990012-990114,991430,991577,991802

Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  3 11:05:04 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923
+/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923,988801,988804,989112,990012-990114,991430,991577,991802

Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep  3 11:05:04 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923
+/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244,961577,961843,961859,961870,962395,962401,962981,962990,962993,963021-963048,965728-965730,980314,980756,981122,983105,986920-987098,987923,988801,988804,989112,990012-990114,991430,991577,991802

Modified: gump/live/python/gump/util/mysql.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/util/mysql.py?rev=992265&r1=992264&r2=992265&view=diff
==============================================================================
--- gump/live/python/gump/util/mysql.py (original)
+++ gump/live/python/gump/util/mysql.py Fri Sep  3 11:05:04 2010
@@ -45,13 +45,15 @@ class Database:
         """
         See PEP 249.
         """
-        pass
+        if self._conn:
+            self._conn.commit()
 
     def rollback(self):
         """
         See PEP 249.
         """
-        pass
+        if self._conn:
+            self._conn.rollback()
 
     def cursor(self):
         """
@@ -109,10 +111,32 @@ class DbHelper:
         self.database = database
 
     def __del__(self):
+        self.close()
+
+    def close(self):
+        """
+        Closes the connection
+        """
         if self.conn:
             self.conn.close()
             self.conn = None
 
+    def commit(self):
+        """
+        Commits the work performed so far
+        """
+        if self.conn:
+            log.info('SQL committing')
+            self.conn.commit()
+
+    def rollback(self):
+        """
+        Rolls back the work performed so far
+        """
+        if self.conn:
+            log.info('SQL rolling back')
+            self.conn.rollback()
+
     def value(self, value):
         """
         Escape and Quote a Value
@@ -138,15 +162,18 @@ class DbHelper:
         return statement
 
     def select(self, table_name, column_name, entity_name, columns):
+        if not self.conn:
+            raise RuntimeError('connection is closed')
+
         statement = self.generateSelect(table_name, column_name, entity_name)
         settings = {}
         cursor = None
         try:
             try:
                 cursor = self.conn.cursor()
-                log.debug('SQL: ' + statement)
+                log.info('SQL: ' + statement)
                 affected = cursor.execute(statement)
-                log.debug('SQL affected: ' + `affected`)
+                log.info('SQL affected: ' + `affected`)
 
                 if affected > 0: # might be nothing in db yet
                     row = cursor.fetchall()[0] # Ought be only one...
@@ -204,15 +231,18 @@ class DbHelper:
         Take a dictionary of settings (column names/types) and 
         perform an insert.
         """
+        if not self.conn:
+            raise RuntimeError('connection is closed')
+
         statement = self.generateInsert(table_name, settings)
         affected = 0
         cursor = None
         try:
             try:
                 cursor = self.conn.cursor()
-                log.debug('SQL: ' + statement)
+                log.info('SQL: ' + statement)
                 affected = cursor.execute(statement)
-                log.debug('SQL Affected: ' + `affected`)
+                log.info('SQL Affected: ' + `affected`)
             except Exception, details:
                 if cursor:
                     self.logWarnings(cursor)
@@ -241,6 +271,9 @@ class DbHelper:
         Take a dictionary of settings (column names/types) and 
         perform an update. Note: The index is a single name.
         """
+        if not self.conn:
+            raise RuntimeError('connection is closed')
+
         statement = self.generateUpdate(table_name, column_name, entity_name,
                                         settings)
         affected = 0
@@ -248,9 +281,9 @@ class DbHelper:
         try:
             try:
                 cursor = self.conn.cursor()
-                log.debug('SQL: ' + statement)
+                log.info('SQL: ' + statement)
                 affected = cursor.execute(statement)
-                log.debug('SQL Affected: ' + `affected` + ':' + `result`)
+                log.info('SQL Affected: ' + `affected`)
             except Exception, details:
                 if cursor:
                     self.logWarnings(cursor)
@@ -276,15 +309,18 @@ class DbHelper:
         Perform an SQL DELETE 
         Index is single name
         """
+        if not self.conn:
+            raise RuntimeError('connection is closed')
+
         statement = self.generateDelete(table_name, column_name, entity_name)
         affected = 0
         cursor = None
         try:
             try:
                 cursor = self.conn.cursor()
-                log.debug('SQL: ' + statement)
+                log.info('SQL: ' + statement)
                 affected = cursor.execute(statement)
-                log.debug('SQL Affected: ' + `affected`)
+                log.info('SQL Affected: ' + `affected`)
             except Exception, details:
                 if cursor:
                     self.logWarnings(cursor)