You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@gump.apache.org by aj...@apache.org on 2004/05/21 02:09:45 UTC

cvs commit: gump/python/gump/core config.py gumpinit.py misc.py

ajack       2004/05/20 17:09:45

  Modified:    python/gump/runner Tag: MultiRunner tasks.py runner.py
               python/gump/build Tag: MultiRunner maven.py builder.py
               python/gump/core Tag: MultiRunner config.py gumpinit.py
  Removed:     python/gump/core Tag: MultiRunner misc.py
  Log:
  Test/Fix...
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.2.4   +184 -9    gump/python/gump/runner/Attic/tasks.py
  
  Index: tasks.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/runner/Attic/tasks.py,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- tasks.py	19 May 2004 16:02:01 -0000	1.1.2.3
  +++ tasks.py	21 May 2004 00:09:44 -0000	1.1.2.4
  @@ -39,6 +39,13 @@
   from gump.model.state import *
   
   
  +from gump.document.text.documenter import TextDocumenter
  +from gump.document.xdocs.documenter import XDocDocumenter
  +
  +from gump.results.resulter import gatherResults,generateResults
  +from gump.syndication.syndicator import syndicate
  +
  +
   ###############################################################################
   # Classes
   ###############################################################################
  @@ -71,21 +78,189 @@
           
       # A few proxies...
       
  -    def loadStatistics(self): self.misc.loadStatistics()
  -    def updateStatistics(self): self.misc.updateStatistics()
  -    
       def build(self): self.builder.build()
       def update(self): self.updater.update()
       
  -    def prepareDocumentation(self): self.misc.prepareDocumentation()
  -    def document(self): self.misc.document()
       
  -    def generateResults(self): self.misc.generateResults()
  -    def gatherResults(self): self.misc.gatherResults()
  +        
  +    """
  +    
  +        ******************************************************************
  +        
  +           CHECK WORKSPACE
  +        
  +        ******************************************************************
  +    
  +    """
  +    
  +    def checkWorkspace(self):
  +        """ Check a GumpRun's Projects """
  +        workspace=self.run.getWorkspace()
  +
  +        log.debug('--- Building work directories with sources')
  +        
  +        # :TODO: Check the workspace?
  +        
  +        self.checkModules()
  +        self.checkProjects()
  +        
  +    def checkModules(self):
  +        # Check all the modules
  +        list=self.run.getGumpSet().getModuleSequence()
  +        moduleCount=len(list)
  +        moduleNo=1
  +        for module in list:      
  +        
  +            log.info(' ------ Check Module: #[' + `moduleNo` + '] of [' + `moduleCount` + '] : ' + module.getName())
  +                        
  +            module.changeState(STATE_SUCCESS)        
  +            moduleNo+=1
  +
  +    def checkProjects(self):
  +        list=self.run.getGumpSet().getProjects()
  +        # Check all projects
  +                
  +        projectCount=len(list)
  +        projectNo=1
  +        for project in list:  
  +        
  +            log.info(' ------ Check Project: #[' + `projectNo` + '] of [' + `projectCount` + '] : ' + project.getName())
  +            
  +            # :TODO: Do some actualy checking...
  +        
  +            if project.okToPerformWork():        
  +                # For now, things are going good...
  +                project.changeState(STATE_SUCCESS)
  +        
  +            if not project.okToPerformWork():
  +                log.warn('Failed to check project #[' + `projectNo` + '] [' + project.getName() + '], state:' \
  +                        + project.getStateDescription())
  +            
  +            projectNo+=1
  +                                   
  +    """
  +    
  +        ******************************************************************
  +        
  +            THE DOCUMENTATION INTERFACE
  +        
  +        ******************************************************************
  +    
  +    """
  +
  +    def prepareDocumentation(self):
  +        
  +        logResourceUtilization('Before document preparation')
  +        
  +        # Prepare for documentation        
  +        #documenter=self.run.getOptions().getDocumenter()        
  +        #if documenter :
  +        #    documenter.prepare(self.run)            
  +            
  +    def document(self):
  +        
  +        #   
  +        # Build HTML Result (via Forrest or ...)
  +        #
  +        logResourceUtilization('Before document')
  +        
  +        #documenter=self.run.getOptions().getDocumenter()        
  +        #if documenter :
  +        #    documenter.document(self.run)
  +                              
  +                
  +    """
  +    
  +        ******************************************************************
  +        
  +           MISC STUFF
  +        
  +        ******************************************************************
  +    
  +    """
  +    
  +    def notify(self):
  +                
  +        #
  +        # Only an 'all' is an official build, for them:
  +        #
  +        #	Send Naggin E-mails
  +        #
  +        if self.run.getOptions().isOfficial() \
  +            and self.run.getGumpSet().isFull() \
  +            and self.run.getWorkspace().isNotify():
  +  
  +            log.info('Notify about failures... ')            
  +            
  +            #
  +            # Notify about failures
  +            #
  +            logResourceUtilization('Before notify')
  +            notify(self.run)  
  +        
  +    def gatherResults(self):
  +        #
  +        # Gather results.xml from other servers/workspaces
  +        #
  +        logResourceUtilization('Before gather results')
  +        gatherResults(self.run)
  +        
  +    def generateResults(self):
  +            
  +        logResourceUtilization('Before generate results')
  +        # Update Statistics/Results on full self.runs            
  +        if self.run.getGumpSet().isFull():
  +            
  +            #
  +            # Generate results.xml for this self.run, on this server/workspace
  +            #
  +            logResourceUtilization('Before generate results')
  +            generateResults(self.run)
  +            
  +        
  +    def syndicate(self):
  +        logResourceUtilization('Before syndicate')
  +        #
  +        # Provide a news feed (or few)
  +        #
  +        if self.run.getOptions().isOfficial():
  +            syndicate(self.run)
  +                
  +    def loadStatistics(self):   
  +        """ Load Statistics into the self.run (to get current values) """
  +        logResourceUtilization('Before load statistics')
  +        self.processStatistics(1)
  +         
  +    def updateStatistics(self):        
  +        """ Update Statistics into the self.run (to set current values) """
  +        logResourceUtilization('Before update statistics')
  +        self.processStatistics(0)
  +        
  +    def processStatistics(self,load):
  +    
  +        if load:
  +            log.debug('--- Loading Project Statistics')
  +        else:
  +            log.debug('--- Updating Project Statistics')
       
  -    def notify(self): self.misc.notify()
  +        from gump.stats.statsdb import StatisticsDB
  +        db=StatisticsDB()   
  +        
  +        workspace=self.run.getWorkspace()        
  +        
  +        if not load:
  +            #
  +            # Update stats (and stash onto projects)
  +            #
  +            db.updateStatistics(workspace)
  +            
  +            db.sync()
  +        else:
  +            #
  +            # Load stats (and stash onto projects)
  +            #    
  +            db.loadStatistics(workspace)            
       
  -    def syndicate(self): self.misc.syndicate()
       
       ###########################################
       
  
  
  
  1.1.2.3   +12 -7     gump/python/gump/runner/Attic/runner.py
  
  Index: runner.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/runner/Attic/runner.py,v
  retrieving revision 1.1.2.2
  retrieving revision 1.1.2.3
  diff -u -r1.1.2.2 -r1.1.2.3
  --- runner.py	18 May 2004 22:37:24 -0000	1.1.2.2
  +++ runner.py	21 May 2004 00:09:44 -0000	1.1.2.3
  @@ -24,12 +24,17 @@
   
   from gump import log
   
  -from gump.core.misc import *
   from gump.update.updater import *
   from gump.build.builder import *
   
  -from gump.syndication.syndicator import *
  -from gump.results.resulter import *
  +from gump.document.text.documenter import TextDocumenter
  +from gump.document.xdocs.documenter import XDocDocumenter
  +
  +from gump.stats.statistician import Statistician
  +from gump.repository.publisher import RepositoryPublisher
  +from gump.notify.notifier import Notifier
  +from gump.results.resulter import Resulter
  +from gump.syndication.syndicator import Syndicator
   
   ###############################################################################
   # Classes
  @@ -43,8 +48,8 @@
           #
           RunSpecific.__init__(self, run)
           
  -        # Main players
  -        self.misc=GumpMiscellaneous(run)            
  +        # Main players (soon we ought make
  +        # them into actors, like the others).         
           self.updater=GumpUpdater(run)
           self.builder=GumpBuilder(run)
           
  @@ -113,9 +118,9 @@
               documenter=XDocDocumenter(	self.run,	\
                                           self.run.getWorkspace().getBaseDirectory(), \
                                           self.run.getWorkspace().getLogUrl())  
  -        self.run.getOptions().setResolver(documenter.getResolver())
  -                                                              
  +        self.run.getOptions().setResolver(documenter.getResolver())                                                  
           self.run.registerActor(documenter)    
  +        
           self.run.registerActor(Syndicator(self.run))
           
       def setEndTime(self):
  
  
  
  No                   revision
  No                   revision
  1.1.2.10  +1 -1      gump/python/gump/build/Attic/maven.py
  
  Index: maven.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/maven.py,v
  retrieving revision 1.1.2.9
  retrieving revision 1.1.2.10
  diff -u -r1.1.2.9 -r1.1.2.10
  --- maven.py	20 May 2004 17:10:38 -0000	1.1.2.9
  +++ maven.py	21 May 2004 00:09:45 -0000	1.1.2.10
  @@ -66,7 +66,7 @@
               #
               # Get the appropriate build command...
               #
  -            cmd=project.getBuildCommand(self.run.getEnvironment().getJavaCommand())
  +            cmd=self.getMavenCommand(project)
   
               if cmd:
                   # Execute the command ....
  
  
  
  1.1.2.8   +7 -176    gump/python/gump/build/Attic/builder.py
  
  Index: builder.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/build/Attic/builder.py,v
  retrieving revision 1.1.2.7
  retrieving revision 1.1.2.8
  diff -u -r1.1.2.7 -r1.1.2.8
  --- builder.py	19 May 2004 22:26:55 -0000	1.1.2.7
  +++ builder.py	21 May 2004 00:09:45 -0000	1.1.2.8
  @@ -33,6 +33,7 @@
   
   from gump.utils import dump, display, getIndent, logResourceUtilization, \
                               invokeGarbageCollection
  +                            
   from gump.utils.note import Annotatable
   from gump.utils.work import *
   
  @@ -133,10 +134,11 @@
           stats=None
           if project.hasStats():
               stats=project.getStats()
  -            
  -        #if project.isPackaged():             
  -        #    self.performProjectPackageProcessing(project, stats)
  -        #    continue
  +        
  +        # Code this nicer, perhaps...    
  +        if project.isPackaged():             
  +            self.performProjectPackageProcessing(project, stats)
  +            return
                   
           # Do this even if not ok
           self.performPreBuild(project, stats)
  @@ -401,10 +403,7 @@
           if project.hasOutputs():                
               outputs = []
                       
  -            #
               # Ensure the jar output were all generated correctly.
  -            #
  -            outputsOk=1
               for jar in project.getJars():
                   jarPath=os.path.abspath(jar.getPath())
                   # Add to list of outputs, in case we
  @@ -441,7 +440,7 @@
               
   
       def  checkPackage(self,project):
  -        if self.okToPerformWork():
  +        if project.okToPerformWork():
               #
               # Check the package was installed correctly...
               #
  @@ -461,175 +460,7 @@
                   # jars to check
                   project.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
                   
  -                #
                   # List them, why not...
  -                #            
  -                from gump.utils.tools import listDirectoryToFileHolder
                   listDirectoryToFileHolder(project,project.getHomeDirectory(),	\
                       FILE_TYPE_PACKAGE, 'list_package_'+project.getName())                                            
           
  -
  -    def getBuildCommand(self,javaCommand='java'):
  -
  -        # get the ant element (if it exists)
  -        ant=self.xml.ant
  -
  -        # get the maven element (if it exists)
  -        maven=self.xml.maven
  -
  -        # get the script element (if it exists)
  -        script=self.xml.script
  -
  -        if not (script or ant or maven):
  -          #  log.debug('Not building ' + project.name + ' (no <ant/> or <maven/> or <script/> specified)')
  -          return None
  -
  -        if self.hasScript():
  -            return self.getScriptCommand()
  -        elif self.hasMaven() :
  -            return self.getMavenCommand()
  -        else:
  -            return self.getAntCommand(javaCommand)
  -        
  -    #
  -    # Build an ANT command for this project
  -    #        
  -    def getAntCommand(self,javaCommand='java'):
  -        
  -        ant=self.ant
  -        antxml=self.xml.ant
  -    
  -        # The ant target (or none == ant default target)
  -        target= antxml.target or ''
  -    
  -        # The ant build file (or none == build.xml)
  -        buildfile = antxml.buildfile or ''
  -    
  -        # Optional 'verbose' or 'debug'
  -        verbose=antxml.verbose
  -        debug=antxml.debug
  -    
  -        #
  -        # Where to run this:
  -        #
  -        basedir = ant.getBaseDirectory() or self.getBaseDirectory()
  -    
  -        #
  -        # Build a classpath (based upon dependencies)
  -        #
  -        (classpath,bootclasspath)=self.getClasspaths()
  -    
  -        #
  -        # Get properties
  -        #
  -        properties=self.getAntProperties()
  -   
  -        #
  -        # Get properties
  -        #
  -        sysproperties=self.getAntSysProperties()
  -   
  -        #
  -        # Get properties
  -        #
  -        jvmargs=self.getJVMArgs()
  -   
  -        #
  -        # Run java on apache Ant...
  -        #
  -        cmd=Cmd(javaCommand,'build_'+self.getModule().getName()+'_'+self.getName(),\
  -            basedir,{'CLASSPATH':classpath})
  -            
  -        # These are workspace + project system properties
  -        cmd.addNamedParameters(sysproperties)
  -        
  -        
  -        # :NOTE: Commented out since <sysproperty was implemented.
  -        #
  -        # Set this as a system property. Setting it here helps JDK1.4+
  -        # AWT implementations cope w/o an X11 server running (e.g. on
  -        # Linux)
  -        # cmd.addPrefixedParameter('-D','java.awt.headless','true','=')
  -    
  -    
  -        # :NOTE: Commented out since <sysproperty was implemented.
  -        #
  -        # This helps ant maintain VM information for sub-VMs it launches.
  -        #
  -        # cmd.addPrefixedParameter('-D','build.clonevm','true','=')
  -        
  -        #
  -        # Add BOOTCLASSPATH
  -        #
  -        if bootclasspath:
  -            cmd.addPrefixedParameter('-X','bootclasspath/p',bootclasspath,':')
  -            
  -        if jvmargs:
  -            cmd.addParameters(jvmargs)
  -            
  -        cmd.addParameter('org.apache.tools.ant.Main')  
  -    
  -        #
  -        # Allow ant-level debugging...
  -        #
  -        if self.getWorkspace().isDebug() or self.isDebug() or debug: 
  -            cmd.addParameter('-debug')  
  -        if self.getWorkspace().isVerbose()  or self.isVerbose() or verbose: 
  -            cmd.addParameter('-verbose')  
  -        
  -        #
  -        #	This sets the *defaults*, a workspace could override them.
  -        #        
  -        # :NOTE: Commented out since <property on workspace works.
  -        # cmd.addPrefixedParameter('-D','build.sysclasspath','only','=')
  -    
  -        mergeFile=self.getWorkspace().getMergeFile()
  -        if mergeFile:
  -            cmd.addPrefixedParameter('-D','gump.merge',str(mergeFile),'=')        
  -    
  -        # These are from the project and/or workspace
  -        # These are 'normal' properties.
  -        cmd.addNamedParameters(properties)
  -    
  -        # Pass the buildfile
  -        if buildfile: cmd.addParameter('-f',buildfile)
  -    
  -        # End with the target...
  -        if target: 
  -            for targetParam in target.split():
  -                cmd.addParameter(targetParam)
  -    
  -        return cmd
  -
  -                
  -
  -    def getJVMArgs(self):
  -        """Get JVM arguments for a project"""
  -        args=Parameters()
  -        
  -        if self.hasAnt():
  -            jvmargs=self.getAnt().xml.jvmarg
  -        elif self.hasMaven():
  -            jvmargs=self.getMaven().xml.jvmarg
  -                
  -        for jvmarg in jvmargs:
  -            if jvmarg.value:
  -                args.addParameter(jvmarg.value)
  -            else:
  -                log.error('Bogus JVM Argument w/ Value')            
  -        
  -        return args
  -  
  -    def getAntProperties(self):
  -        """Get properties for a project"""
  -        properties=Parameters()
  -        for property in self.getWorkspace().getProperties()+self.getAnt().getProperties():
  -            properties.addPrefixedNamedParameter('-D',property.name,property.value,'=')
  -        return properties
  -
  -    def getAntSysProperties(self):
  -        """Get sysproperties for a project"""
  -        properties=Parameters()
  -        for property in self.getWorkspace().getSysProperties()+self.getAnt().getSysProperties():
  -            properties.addPrefixedNamedParameter('-D',property.name,property.value,'=')
  -        return properties
  
  
  
  No                   revision
  No                   revision
  1.3.2.2   +2 -0      gump/python/gump/core/config.py
  
  Index: config.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/core/config.py,v
  retrieving revision 1.3.2.1
  retrieving revision 1.3.2.2
  diff -u -r1.3.2.1 -r1.3.2.2
  --- config.py	20 May 2004 17:10:37 -0000	1.3.2.1
  +++ config.py	21 May 2004 00:09:45 -0000	1.3.2.2
  @@ -60,6 +60,8 @@
       globalws   = os.path.abspath('%s/%s' % (dir.base, 'global-workspace.xml'))
       merge      = os.path.abspath('%s/%s' % (dir.work, 'merge.xml'))
       date       = time.strftime('%Y%m%d')
  +    datetime   = time.strftime('%Y%m%d %H:%M:%S')
  +    
       logLevel   = logging.INFO # logging.DEBUG
       classpath = (os.getenv('CLASSPATH') or '').split(os.pathsep)  
       
  
  
  
  1.2.2.3   +2 -2      gump/python/gump/core/gumpinit.py
  
  Index: gumpinit.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/core/gumpinit.py,v
  retrieving revision 1.2.2.2
  retrieving revision 1.2.2.3
  diff -u -r1.2.2.2 -r1.2.2.3
  --- gumpinit.py	19 May 2004 16:01:56 -0000	1.2.2.2
  +++ gumpinit.py	21 May 2004 00:09:45 -0000	1.2.2.3
  @@ -56,5 +56,5 @@
   
       default.ltime=time.localtime(default.time)
       default.date = time.strftime('%Y%m%d',default.ltime)
  -    default.datetime = time.strftime('%Y%m%d% %H:%M:%S',default.ltime)
  +    default.datetime = time.strftime('%Y%m%d %H:%M:%S',default.ltime)
       
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org