gump-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject cvs commit: jakarta-gump/python/gump/output statistics.py
Date Thu, 20 Nov 2003 00:57:40 GMT
ajack       2003/11/19 16:57:40

  Modified:    python/gump/model module.py project.py
               python/gump engine.py
               python/gump/utils launcher.py
               python/gump/output statistics.py
  Log:
  Introduce 'last modified' (from seeing if we got CVS updates)
  
  Revision  Changes    Path
  1.6       +20 -1     jakarta-gump/python/gump/model/module.py
  
  Index: module.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/module.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- module.py	19 Nov 2003 15:42:16 -0000	1.5
  +++ module.py	20 Nov 2003 00:57:39 -0000	1.6
  @@ -148,6 +148,8 @@
       	self.projects={}
       	
       	self.repository=None
  +    	
  +    	self.modified=0
   
       # provide default elements when not defined in xml
       def complete(self,workspace):
  @@ -250,7 +252,17 @@
               fogFactors=1 # 0/1 is better than 0/0
               
           return round(fogFactor/fogFactors,2)
  -         
  +    
  +    def getLastModified(self):
  +        moduleLastModified=-1
  +        for project in self.getProjects():
  +            projectLastModified = project.getLastModified()
  +            if projectLastModified > moduleLastModified:
  +                moduleLastModified=projectLastModified
  +               
  +        return moduleLastModified
  +                
  +    
       # Get a summary of states for each project
       def getProjectSummary(self,summary=None):  
       
  @@ -330,6 +342,13 @@
       
       def isCVS(self):
           return hasattr(self,'cvs') and self.cvs
  +        
  +    # Where the contents (at the repository) modified?
  +    def isModified(self):
  +        return self.modified
  +        
  +    def setModified(self,modified):
  +        self.modified=modified
       
       def hasRepository(self):
           return self.repository
  
  
  
  1.9       +3 -0      jakarta-gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/project.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- project.py	19 Nov 2003 23:58:27 -0000	1.8
  +++ project.py	20 Nov 2003 00:57:39 -0000	1.9
  @@ -307,6 +307,9 @@
       def getFOGFactor(self):
           return self.getStats().getFOGFactor()
           
  +    def getLastModified(self):
  +        return self.getStats().getLastModified()
  +        
       def propagateErrorStateChange(self,state,reason,cause,message):
           
           #
  
  
  
  1.7       +3 -0      jakarta-gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- engine.py	19 Nov 2003 20:12:06 -0000	1.6
  +++ engine.py	20 Nov 2003 00:57:39 -0000	1.7
  @@ -295,6 +295,9 @@
                       module.changeState(STATE_FAILED,REASON_UPDATE_FAILED)
                   else:
                       module.changeState(STATE_SUCCESS)
  +                    
  +                    # Were the contents of the repository modified?                   
                    
  +                    module.setModified(cmdResult.hasOutput())
                   
       def syncWorkDirs( self, run ):
           """copy the raw module (project) materials from source to work dir 
  
  
  
  1.2       +8 -1      jakarta-gump/python/gump/utils/launcher.py
  
  Index: launcher.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/utils/launcher.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- launcher.py	17 Nov 2003 22:10:55 -0000	1.1
  +++ launcher.py	20 Nov 2003 00:57:40 -0000	1.2
  @@ -266,7 +266,14 @@
               tail = "No output\n"
               
           return tail
  -          
  +    
  +    def hasOutput(self):
  +        if self.output: return 1
  +        return 0
  +        
  +    def getOutput(self):
  +        return self.output
  +        
       def dump(self,indent):
           print self.overview(indent)
   
  
  
  
  1.6       +34 -0     jakarta-gump/python/gump/output/statistics.py
  
  Index: statistics.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/output/statistics.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- statistics.py	19 Nov 2003 20:09:44 -0000	1.5
  +++ statistics.py	20 Nov 2003 00:57:40 -0000	1.6
  @@ -89,6 +89,9 @@
       def getFOGFactor(self):
           return (self.successes - self.failures - self.prereqs)
           
  +    def getLastModified(self):
  +        return (self.lastModified)
  +        
       def nameKey(self):
           return self.projectname + '-pname'
           
  @@ -107,6 +110,9 @@
       def lastKey(self):
           return self.projectname + '-last'
           
  +    def lastModifiedKey(self):
  +        return self.projectname + '-last-modified'
  +        
       def currentStateKey(self):
           return self.projectname + '-current-state'
           
  @@ -133,6 +139,12 @@
                   s.prereqs  += 1
                   
           #
  +        # Track code updates/changes
  +        # 
  +        if project.getModule().isModified():
  +            self.lastModified=time.time()
  +            
  +        #
           # Deal with states & changes...
           #
           lastCurrentState=self.currentState
  @@ -170,6 +182,7 @@
           s.prereqs=self.getInt(s.prereqsKey())
           s.first=self.getDate(s.firstKey())
           s.last=self.getDate(s.lastKey())
  +        s.lastModified=self.getDate(s.lastKey())
           s.currentState=stateForName(self.get(s.currentStateKey()))
           s.previousState=stateForName(self.get(s.previousStateKey()))
           s.sequenceInState=self.getInt(s.sequenceInStateKey())
  @@ -182,6 +195,7 @@
           self.putInt(s.prereqsKey(), s.prereqs)
           self.putDate(s.firstKey(), s.first)
           self.putDate(s.lastKey(), s.last)
  +        self.putDate(s.lastKey(), s.lastModified)
           self.put(s.currentStateKey(), stateName(s.currentState))
           self.put(s.previousStateKey(), stateName(s.previousState))
           self.putInt(s.sequenceInStateKey(), s.sequenceInState)
  @@ -211,6 +225,10 @@
               del self.db[s.lastKey()]
           except:
               """ Hopefully means it wasn't there... """
  +         try:
  +            del self.db[s.lastModifiedKey()]
  +        except:
  +            """ Hopefully means it wasn't there... """
           try:
               del self.db[s.currentStateKey()]
           except:
  @@ -359,6 +377,20 @@
       if not c: c=cmp(module1,module2)
       return c             
               
  +def sortByFOGFactor(module1,module2):
  +    fog1=module1.getFOGFactor()
  +    fog2=module2.getFOGFactor()
  +    c= int(round(fog2 - fog1,0))                  
  +    if not c: c=cmp(module1,module2)
  +    return c             
  +            
  +def sortByLastModified(module1,module2):
  +    fog1=module1.getLastModified()
  +    fog2=module2.getLastModified()
  +    c= int(round(fog2 - fog1,0))                  
  +    if not c: c=cmp(module1,module2)
  +    return c             
  +            
   class StatisticsGuru:
       """ Know it all ... """
       
  @@ -372,3 +404,5 @@
           self.modulesByTotalDependencies=createOrderedList(workspace.getModules(),sortByDependencyCount)
           self.modulesByTotalDependees=createOrderedList(workspace.getModules(),sortByDependeeCount)
           self.modulesByFOGFactor=createOrderedList(workspace.getModules(),sortByFOGFactor)
  +        self.modulesByLastModified=createOrderedList(workspace.getModules(),sortByLastModified)
  +        
  \ No newline at end of file
  
  
  

Mime
View raw message