gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: gump/python/gump engine.py
Date Sun, 07 Mar 2004 22:22:36 GMT
ajack       2004/03/07 14:22:36

  Modified:    python/gump/model project.py object.py
               python/gump/document forrest.py
               python/gump/utils tools.py file.py
               python/gump engine.py
  Log:
  Minor tweaks...
  
  Revision  Changes    Path
  1.61      +15 -11    gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/project.py,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- project.py	5 Mar 2004 23:42:22 -0000	1.60
  +++ project.py	7 Mar 2004 22:22:35 -0000	1.61
  @@ -283,7 +283,7 @@
           return self.getModule().getMetadataViewUrl()
                           
       def getViewUrl(self):
  -        # :TODO: if a basedir the offset?
  +        # :TODO: if a basedir then offset?
           return self.getModule().getViewUrl()
               
       def addJar(self,jar):
  @@ -855,8 +855,10 @@
           #
           # Allow ant-level debugging...
           #
  -        if debug: cmd.addParameter('-debug')  
  -        if verbose: cmd.addParameter('-verbose')  
  +        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.
  @@ -934,8 +936,10 @@
           #
           # Allow maven-level debugging...
           #
  -        if debug: cmd.addParameter('--debug')  
  -        if verbose: cmd.addParameter('--exception') 
  +        if self.getWorkspace().isDebug() or self.isDebug() or debug: 
  +            cmd.addParameter('--debug')  
  +        if self.getWorkspace().isVerbose()  or self.isVerbose() or verbose: 
  +            cmd.addParameter('--exception') 
           
           #
           # Suppress downloads
  @@ -994,11 +998,11 @@
               cmd.addPrefixedParameter('-X','bootclasspath/p',bootclasspath,':')
                       
           #
  -        # Allow ant-level debugging...
  +        # Allow script-level debugging...
           #
  -        if self.getWorkspace().isDebug() or debug:
  +        if self.getWorkspace().isDebug() or self.isDebug() or debug:
               cmd.addParameter('-debug')  
  -        if self.getWorkspace().isVerbose() or verbose:
  +        if self.getWorkspace().isVerbose()  or self.isVerbose() or verbose:
               cmd.addParameter('-verbose')  
           
           return cmd
  
  
  
  1.20      +14 -5     gump/python/gump/model/object.py
  
  Index: object.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/object.py,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- object.py	1 Mar 2004 18:58:00 -0000	1.19
  +++ object.py	7 Mar 2004 22:22:35 -0000	1.20
  @@ -168,6 +168,9 @@
           # The XML model
       	self.xml=xml
       	
  +    	self.debug=None
  +    	self.verbose=None
  +    	
       	self.completionPerformed=0
       	
       def isComplete(self):
  @@ -176,11 +179,17 @@
       def setComplete(self,complete):
          self.completionPerformed=complete
          
  +    def setDebug(self,debug):
  +        self.debug=debug
  +       
       def isDebug(self):
  -        return self.xml.debug
  +        return self.debug or self.xml.debug
           
  +    def setVerbose(self,verbose):
  +        self.verbose=verbose
  +       
       def isVerbose(self):
  -        return self.xml.verbose      
  +        return self.verbose or self.xml.verbose      
           
       def dump(self, indent=0, output=sys.stdout):
           """ Display the contents of this object """
  
  
  
  1.93      +8 -5      gump/python/gump/document/forrest.py
  
  Index: forrest.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/document/forrest.py,v
  retrieving revision 1.92
  retrieving revision 1.93
  diff -u -r1.92 -r1.93
  --- forrest.py	5 Mar 2004 23:42:22 -0000	1.92
  +++ forrest.py	7 Mar 2004 22:22:35 -0000	1.93
  @@ -504,7 +504,8 @@
           
           projectsSection=document.createSection('Projects with issues...')
           projectsTable=projectsSection.createTable(['Name','Affected',	\
  -                    'Duration\nin state','Project State','Elapsed'])
  +                    'Dependencies',	\
  +                    'Duration\nin state','Project State'])
           pcount=0
           for project in sortedProjectList:
               if not gumpSet.inSequence(project): continue       
  @@ -531,10 +532,12 @@
               self.insertLink(project,workspace,projectRow.createData())   
                           
               projectRow.createData(affected)
  +            
  +            projectRow.createData( project.getFullDependencyCount())
  +            
               projectRow.createData(seq)
               
               self.insertStateIcon(project,workspace,projectRow.createData())
  -            projectRow.createData(secsToElapsedString(project.getElapsedSecs())) 
                   
           if not pcount: 
               projectsTable.createLine('None')    
  
  
  
  1.15      +30 -19    gump/python/gump/utils/tools.py
  
  Index: tools.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/utils/tools.py,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- tools.py	1 Mar 2004 18:58:00 -0000	1.14
  +++ tools.py	7 Mar 2004 22:22:35 -0000	1.15
  @@ -66,6 +66,7 @@
   import types, StringIO
   
   from gump import log
  +from gump.utils.note import *
   from gump.utils.work import *
   from gump.utils.file import *
   from gump.utils.launcher import *
  @@ -89,8 +90,14 @@
       return ok
       
   def catDirectoryContentsAsWork(workable,directory,name=None):
  +    
  +    # Chances are a workable is also annotatable...
  +    annotatable=None
  +    if isinstance(workable,Annotatable):
  +        annotatable=workable
  +        
       try:
  -        if os.path.exists(directory) and  os.path.isdir(directory):
  +        if os.path.exists(directory) and os.path.isdir(directory):
               for fileName in os.listdir(directory):
                   baseName=name    
                   file=os.path.abspath(os.path.join(directory,fileName))                
  @@ -100,12 +107,11 @@
                       else:
                           workName=fileName
                       catFileAsWork(workable,	file, workName)
  +        elif annotatable:
  +                annotatable.addWarning('No directory [' + str(directory) + ']')
       except:
  -        try:
  -            workable.addWarning('No such directory [' + str(directory) + ']')
  -        except:
  -            pass
  -    
  +        if annotatable:
  +            annotatable.addWarning('Failed to display directory contents [' + str(directory)
+ ']')    
           
   def catFileAsWork(workable,file,name=None):
       ok=0
  @@ -142,6 +148,12 @@
       return reference.exists() and reference.isDirectory()
       
   def catDirectoryContentsToFileHolder(holder,directory,type=FILE_TYPE_MISC,name=None):
  +    
  +    # Chances are a holder is also annotatable...
  +    annotatable=None
  +    if isinstance(holder,Annotatable):
  +        annotatable=holder
  +        
       try:
           listDirectoryToFileHolder(holder,directory,type,name)
           
  @@ -149,17 +161,16 @@
               for fileName in os.listdir(directory):
                   baseName=name    
                   file=os.path.abspath(os.path.join(directory,fileName))                
  -                if os.path.exists(file) and os.path.isfile(file):
  -                    if baseName: 
  -                        workName=baseName+'_'+fileName
  -                    else:
  -                        workName=fileName
  -                    catFileToFileHolder(holder,	file, type, workName)
  +                if baseName: 
  +                    workName=baseName+'_'+fileName
  +                else:
  +                    workName=fileName
  +                catFileToFileHolder(holder,	file, type, workName)
  +        elif annotatable:
  +                annotatable.addWarning('No directory [' + str(directory) + ']')
       except:
  -        try:
  -            holder.addWarning('No such directory [' + str(directory) + ']')
  -        except:
  -            pass
  +        if annotatable:
  +            annotatable.addError('Failed to display directory [' + str(directory) + ']')
       
           
   def catFileToFileHolder(holder,file,type=FILE_TYPE_MISC,name=None):
  
  
  
  1.5       +7 -5      gump/python/gump/utils/file.py
  
  Index: file.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/utils/file.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- file.py	4 Mar 2004 17:26:09 -0000	1.4
  +++ file.py	7 Mar 2004 22:22:35 -0000	1.5
  @@ -72,14 +72,16 @@
                  
   FILE_TYPE_MISC=1
   FILE_TYPE_CONFIG=2
  -FILE_TYPE_PACKAGE=3
  -FILE_TYPE_OUTPUT=4
  -FILE_TYPE_REPORT=5
  -FILE_TYPE_REPO=6
  -FILE_TYPE_LOG=7
  +FILE_TYPE_SOURCE=3
  +FILE_TYPE_PACKAGE=4
  +FILE_TYPE_OUTPUT=5
  +FILE_TYPE_REPORT=6
  +FILE_TYPE_REPO=7
  +FILE_TYPE_LOG=8
   
   fileTypeDescriptions = { 	FILE_TYPE_MISC : "Miscellaneous",
                   FILE_TYPE_CONFIG : "Config",
  +                FILE_TYPE_PACKAGE : "Source",
                   FILE_TYPE_PACKAGE : "Package",
                   FILE_TYPE_OUTPUT : "Output",
                   FILE_TYPE_REPORT : "Report",
  
  
  
  1.74      +77 -10    gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/engine.py,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- engine.py	4 Mar 2004 17:26:10 -0000	1.73
  +++ engine.py	7 Mar 2004 22:22:35 -0000	1.74
  @@ -419,15 +419,30 @@
           
               log.debug(' ------ Project: #[' + `projectNo` + '] of [' + `projectCount` +
'] : ' + project.getName())
           
  -            if project.isPackaged(): continue
  +            if project.isPackaged():             
  +                self.performPackageProcessing( run, project, stats)
  +                continue
               
  +            # Extract stats (in case we want to do conditional processing)            
  +            stats=project.getStats()
  +                
               # Do this even if not ok
  -            self.performPreBuild( run, project )
  +            self.performPreBuild( run, project, stats )
   
               wasBuilt=0
               if project.okToPerformWork():        
                   log.debug(' ------ Building: [' + `projectNo` + '] ' + project.getName())
   
  +                # Turn on --verbose or --debug if failing ...
  +                if not STATE_SUCCESS == stats.currentState:
  +                    if stats.sequenceInState > 5:
  +                        project.setDebug(1)
  +                    else:
  +                        project.setVerbose(1)
  +
  +                #
  +                # Get the appropriate build command...
  +                #
                   cmd=project.getBuildCommand()
   
                   if cmd:
  @@ -450,13 +465,12 @@
                           project.changeState(STATE_SUCCESS)
                       
               # Do this even if not ok
  -            self.performPostBuild( run, project, repository, wasBuilt )
  +            self.performPostBuild( run, project, repository, wasBuilt, stats )
       
               if project.isFailed():
                   log.warn('Failed to build project #[' + `projectNo` + '] [' + project.getName()
+ '], state:' \
                           + project.getStateDescription())
  -                        
  -                        
  +                                                
               projectNo+=1
   
   
  @@ -523,7 +537,7 @@
               project.addError('   <mkdir without \'dir\' attribute.')
               raise RuntimeError('Bad <mkdir, missing \'dir\' attribute')
                  
  -    def performPreBuild( self, run, project ):
  +    def performPreBuild( self, run, project, stats ):
           """ Perform pre-build Actions """
          
           log.debug(' ------ Performing pre-Build Actions (mkdir/delete) for : '+ project.getName())
  @@ -578,8 +592,7 @@
           if not project.okToPerformWork():
               log.warn('Failed to perform prebuild on project [' + project.getName() + ']')
   
  -
  -    def performPostBuild(self, run, project, repository, wasBuilt):
  +    def performPostBuild(self, run, project, repository, wasBuilt, stats):
           """Perform Post-Build Actions"""
        
           log.debug(' ------ Performing post-Build Actions (check jars) for : '+ project.getName())
  @@ -596,7 +609,7 @@
                       jarPath=os.path.abspath(jar.getPath())
                       # Add to list of outputs, in case we
                       # fail to find, and need to go list 
  -                    # directoiries
  +                    # directories
                       outputs.append(jarPath)
                       if not os.path.exists(jarPath):
                           project.changeState(STATE_FAILED,REASON_MISSING_OUTPUTS)
  @@ -674,7 +687,11 @@
                           project.addError("See Directory Listing Work for Missing Outputs")
               else:
                   project.changeState(STATE_SUCCESS)
  -         
  +        else:
  +            # List source directory (when failed) in case it helps debugging...
  +            listDirectoryToFileHolder(project,project.getModule().getSourceDirectory(),
\
  +                                        FILE_TYPE_SOURCE, 'list_source_'+project.getName())
          
  +                                        
           #   
           # Display report output, even if failed...
           #
  @@ -701,6 +718,56 @@
                   log.warning('Display Maven Log Failed', exc_info=1)    
                   # Not worth crapping out over...
               
  +                        
  +    def performPackageProcessing(self, run, project, stats):
  +        """Perform Package Processing Actions"""
  +     
  +        log.debug(' ------ Performing Package Processing for : '+ project.getName())
  +
  +        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
  +                # fail to find, and need to go list 
  +                # directories
  +                outputs.append(jarPath)
  +                
  +            # If we have a <license name='...
  +            if project.hasLicense():
  +                licensePath=os.path.abspath(	\
  +                                os.path.join( project.getModule().getSourceDirectory(),
\
  +                                                project.getLicense() ) )
  +                                          
  +                # Add to list of outputs, in case we
  +                # fail to find, and need to go list 
  +                # directories
  +                outputs.append(licensePath)
  +                                                            
  +                #
  +                # List all directories that should've contained
  +                # outputs, to see what is there.
  +                #
  +                dirs=[]
  +                dircnt=0
  +                listed=0
  +                for output in outputs:
  +                    dir=os.path.dirname(output)
  +                    if not dir in dirs:                        
  +                        dircnt += 1            
  +                        if os.path.exists(dir):
  +                            listDirectoryToFileHolder(project,dir,\
  +                                FILE_TYPE_PACKAGE,
  +                                'list_'+project.getName()+'_dir'+str(dircnt)+'_'+os.path.basename(dir))
  +                            dirs.append(dir)
  +                            listed += 1
  +                        else:
  +                            project.addError("No such directory (where package output is
expected) : " + dir)                                
                   
       """
       
  
  
  

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


Mime
View raw message