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 update.py context.py build.py logic.py check.py document.py
Date Tue, 23 Sep 2003 15:13:09 GMT
ajack       2003/09/23 08:13:09

  Modified:    python/gump update.py context.py build.py logic.py check.py
                        document.py
  Log:
  1) I beleive I've found/fix why "Cause" wasn't showing correctly.
  2) I beleive I've corrected "checking dependencies on pakcages" (not needed)
  3) I've attempted to check a module as "only packages" to not do a CVS update
  4) Added links to packaged projects (so forrest finds the documentation)
  5) Tweaked the java compiler check (said java missing, was the compiler class).
  
  Revision  Changes    Path
  1.9       +7 -6      jakarta-gump/python/gump/update.py
  
  Index: update.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/update.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- update.py	5 Sep 2003 05:20:42 -0000	1.8
  +++ update.py	23 Sep 2003 15:13:08 -0000	1.9
  @@ -188,7 +188,7 @@
               # Update Context w/ Results  
             if not cmdResult.status==CMD_STATUS_SUCCESS:              
                 log.error('Failed to update module: ' + module.name)        
  -              mctxt.propagateState(STATUS_FAILED,REASON_UPDATE_FAILED)
  +              mctxt.propagateErrorState(STATUS_FAILED,REASON_UPDATE_FAILED)
             else:
                 mctxt.status=STATUS_SUCCESS
                   
  @@ -196,9 +196,10 @@
           
             log.error('Failed to update module: ' + module.name + ' : ' + str(detail))
           
  -          mctxt.propagateState(STATUS_FAILED,REASON_UPDATE_FAILED)  
  +          mctxt.propagateErrorState(STATUS_FAILED,REASON_UPDATE_FAILED)  
       else:
  -        mctxt.propagateState(mctxt.status,mctxt.reason)
  +        # :TODO: Redundant?
  +        mctxt.propagateErrorState(mctxt.status,mctxt.reason)
           
   if __name__=='__main__':
   
  
  
  
  1.6       +30 -11    jakarta-gump/python/gump/context.py
  
  Index: context.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/context.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- context.py	11 Sep 2003 17:06:31 -0000	1.5
  +++ context.py	23 Sep 2003 15:13:08 -0000	1.6
  @@ -306,8 +306,10 @@
           self.annotations=[]
           self.worklist=WorkList()
           
  +    # Same if same type, and same name
  +    # i.e project context X is not equals to module context X
       def __eq__(self,other):
  -        return self.name == other.name
  +        return self.__class__ == other.__class__ and self.name == other.name
           
       def __cmp__(self,other):
           return self.name < other.name
  @@ -350,17 +352,22 @@
               ctxt.aggregateStates(states)
           return states;
               
  -    def propagateState(self,state,reason=REASON_UNSET,cause=None):
  +    def propagateErrorState(self,state,reason=REASON_UNSET,cause=None):
           #
           # If no-one else to point the finger at ...
           # ... step up.
           #
           if not cause: cause = self
               
  +        #
  +        # Do NOT over-write a pre-determined condition
  +        #
           if stateUnsetOrOk(self.status):
  +            # Modify self
               self.setState(state,reason,cause)
  -            for (cname,ctxt) in self.subcontexts.iteritems():
  -                ctxt.propagateState(state,reason,cause)        
  +            # .. then push this error down
  +            for ctxt in self:
  +                ctxt.propagateErrorState(state,reason,cause)        
           
       def elapsedSecs(self):
           elapsedSecs=self.worklist.elapsedSecs()
  @@ -489,20 +496,32 @@
           return fogFactor
               
           return round(fogFactor/fogFactors,2)
  -    def propagateState(self,state,reason=REASON_UNSET,cause=None):
  +        
  +    def propagateErrorState(self,state,reason=REASON_UNSET,cause=None): 
  +        #
  +        # If no-one else to point the finger at ...
  +        # ... step up.
  +        #
  +        if not cause: cause = self
  +                        
  +        # Do NOT over-write a preexisting condition
           if stateUnsetOrOk(self.status):
  -            Context.propagateState(self,state,reason,cause)
  +            # Call the superclass behaviour
  +            Context.propagateErrorState(self,state,reason,cause)
               
  -            message = lower(stateName(state)) + " with " + lower(reasonString(reason))
           
  +            #
  +            #
  +            #
  +            message = "failed with: " + lower(stateName(state)) \
  +                + " with reason: " + lower(reasonString(reason))            
               self.addError(capitalize(message))
               
               #
  -            # Mark as failed...
  +            # Mark depend*ee*s as failed for this cause...
               #
               for dependeeContext in self.dependees:
  -                if stateUnsetOrOk(dependeeContext.status):
  -                    dependeeContext.addError("Dependency " + self.name + " " + message)
  -                dependeeContext.propagateState(STATUS_PREREQ_FAILURE,reason,cause)
  +                dependeeContext.addError("Dependency " + self.name + " " + message)
  +                dependeeContext.propagateErrorState(STATUS_PREREQ_FAILURE,reason,cause)
                   
               #
               # At least notify these folks
  
  
  
  1.11      +12 -8     jakarta-gump/python/gump/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- build.py	10 Sep 2003 21:43:54 -0000	1.10
  +++ build.py	23 Sep 2003 15:13:08 -0000	1.11
  @@ -177,11 +177,13 @@
   
           # Update Context w/ Results  
           if not cmdResult.status==CMD_STATUS_SUCCESS:
  -            mctxt.propagateState(STATUS_FAILED,REASON_SYNC_FAILED)
  +            mctxt.propagateErrorState(STATUS_FAILED,REASON_SYNC_FAILED)
           else:
               mctxt.status=STATUS_SUCCESS
       else:
  -        mctxt.propagateState(mctxt.status,mctxt.reason)
  +        # :TODO: Is the redundanct, ought it not have already be published?
  +        # Does this account for the confusion?
  +        mctxt.propagateErrorState(mctxt.status,mctxt.reason)
   
   def buildProjects( workspace, sequence, context=GumpContext() ):
     """actually perform the build of the specified project and its deps"""
  @@ -215,20 +217,22 @@
               
               # Update Context w/ Results  
               if not cmdResult.status==CMD_STATUS_SUCCESS:
  -                pctxt.propagateState(STATUS_FAILED,REASON_BUILD_FAILED)
  +                pctxt.propagateErrorState(STATUS_FAILED,REASON_BUILD_FAILED)
               else:
                   outputsOk=1
                   for i in range(0,len(project.jar)):
                       jar=os.path.normpath(project.jar[i].path)
                       if jar:
                           if not os.path.exists(jar):
  -                            pctxt.propagateState(STATUS_FAILED,REASON_MISSING_OUTPUTS)
  +                            pctxt.propagateErrorState(STATUS_FAILED,REASON_MISSING_OUTPUTS)
                               outputsOk=0
                               pctxt.addError("Missing Output: " + str(jar))
   
                   if outputsOk: pctxt.status=STATUS_SUCCESS  
       else:
  -        pctxt.propagateState(pctxt.status,pctxt.reason)
  +        # :TODO: Redundant? 
  +        #
  +        pctxt.propagateErrorState(pctxt.status,pctxt.reason)
   
   # static void main()
   if __name__=='__main__':
  
  
  
  1.2       +59 -34    jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- logic.py	29 Aug 2003 00:20:22 -0000	1.1
  +++ logic.py	23 Sep 2003 15:13:08 -0000	1.2
  @@ -171,12 +171,12 @@
     projects.sort()
     return projects
     
  -def getPackagedProjects():
  +def getPackagedProjectContexts(context):
     """ Return a list of projects installed as packages """
     projects=[]
     for project in Project.list.values():
       if isPackaged(project):
  -        projects.append(project)
  +        projects.append(context.getProjectContextForProject(project))
     return projects
           
           
  @@ -328,45 +328,70 @@
   
   def preprocessContext(workspace,context=GumpContext()):
   
  +    #
  +    # Check each project...
  +    #
       for project in Project.list.values():
                           
           projectOk=1
           pctxt = context.getProjectContextForProject(project)
           
  -        # Check Dependencies Exists:
  -        for depend in project.depend:
  -            if not Project.list.has_key(depend.project):
  -                pctxt.propagateState(STATUS_FAILED,REASON_CONFIG_FAILED)
  -                projectOk=0
  -                pctxt.addError("Bad Dependency. Project: " + depend.project + " unknown
to *this* workspace")
  -                log.error("Missing Dependency [" + depend.project + "] on [" + pctxt.name
+ "]")
  -        
  -        # Check Dependencies Exists:
  -        for option in project.option:
  -            if not Project.list.has_key(option.project):
  -                pctxt.addWarning("Bad Dependency. Project: " + option.project + " unknown
to *this* workspace")
  -                log.warn("Missing Dependency [" + option.project + "] on [" + pctxt.name
+ "]")
  -        
  -        if projectOk:
  -            if isPackaged(project):
  +        # If so far so good, check packages
  +        if isPackaged(project):
               
  -                #
  -                # Check the package was installed correctly...
  -                #
  -                outputsOk=1
  -                for i in range(0,len(project.jar)):
  -                    jarpath=project.jar[i].path
  -                    if jarpath:
  -                        if not os.path.exists(jarpath):
  -                            pctxt.propagateState(STATUS_FAILED,REASON_PACKAGE_BAD)
  -                            outputsOk=0
  -                            pctxt.addError("Missing Output: " + str(jarpath))
  -                            log.error("Missing Jar [" + str(jarpath) + "] on *packaged*
[" + pctxt.name + "]")
  +            #
  +            # Check the package was installed correctly...
  +            #
  +            outputsOk=1
  +            for i in range(0,len(project.jar)):
  +                jarpath=project.jar[i].path
  +                if jarpath:
  +                    if not os.path.exists(jarpath):
  +                        pctxt.propagateErrorState(STATUS_FAILED,REASON_PACKAGE_BAD)
  +                        outputsOk=0
  +                        projectOk=0
  +                        pctxt.addError("Missing Packaged Jar: " + str(jarpath))
  +                        log.error("Missing Jar [" + str(jarpath) + "] on *packaged* ["
+ pctxt.name + "]")
       
  -                if outputsOk:
  -                    pctxt.state=STATUS_COMPLETE
  -                    pctxt.reason=REASON_PACKAGE      
  +            if outputsOk:
  +                pctxt.state=STATUS_COMPLETE
  +                pctxt.reason=REASON_PACKAGE
  +        else:         
  +            # Check Dependencies Exists:
  +            for depend in project.depend:
  +                if not Project.list.has_key(depend.project):
  +                    pctxt.propagateErrorState(STATUS_FAILED,REASON_CONFIG_FAILED)
  +                    projectOk=0
  +                    pctxt.addError("Bad Dependency. Project: " + depend.project + " unknown
to *this* workspace")
  +                    log.error("Missing Dependency [" + depend.project + "] on [" + pctxt.name
+ "]")
  +        
  +            # Check Dependencies Exists:
  +            for option in project.option:
  +                if not Project.list.has_key(option.project):
  +                    pctxt.addWarning("Bad Dependency. Project: " + option.project + " unknown
to *this* workspace")
  +                    log.warn("Missing Dependency [" + option.project + "] on [" + pctxt.name
+ "]")        
       
  +    #
  +    # Check each module...
  +    #
  +    for module in Module.list.values():
  +        moduleOk=1
  +        mctxt = context.getModuleContextForModule(module)
  +        
  +        # A module which contains only packaged projects might as
  +        # well be considered complete, no need to update from CVS
  +        # since we won't be building.
  +        # :TODO: Ought we hack this as *any* not all???
  +        allPackaged=1
  +        for project in module.project:
  +            if not isPackaged(project):
  +                allPackaged=0  
  +                mctxt.addWarning("Incomplete \'Packaged\' Module. Project: " + project.name
+ " is not packaged")                  
  +                
  +        if allPackaged:
  +            mctxt.state=STATUS_COMPLETE
  +            mctxt.reason=REASON_PACKAGE
  +                        
   # static void main()
   if __name__=='__main__':
   
  @@ -385,7 +410,7 @@
     # get parsed workspace definition
     workspace=load(ws, context)
     
  -  projects=getPackagedProjects()
  +  projects=getPackagedProjectContexts(context)
     print "Packaged Projects : " + str(len(projects))
     for p in projects: print "Packaged Project " + str(p.name)
       
  
  
  
  1.18      +4 -4      jakarta-gump/python/gump/check.py
  
  Index: check.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/check.py,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- check.py	12 Sep 2003 12:10:54 -0000	1.17
  +++ check.py	23 Sep 2003 15:13:08 -0000	1.18
  @@ -134,7 +134,7 @@
       checkExecutable(workspace, context, 'env','',0)
       checkExecutable(workspace, context, context.javaCommand,'-version',exitOnError)
       checkExecutable(workspace, context, 'javac','-help',exitOnError)
  -    checkExecutable(workspace, context, 'java','com.sun.tools.javac.Main -help',exitOnError,'check_java_compiler')
   
  +    checkExecutable(workspace, context, 'java com.sun.tools.javac.Main','-help',exitOnError,'check_java_compiler')
   
       checkExecutable(workspace, context, 'cvs','--version',exitOnError)
       if not context.noForrest and not checkExecutable(workspace, context, 'forrest','-projecthelp',0):

           context.noForrest=1
  
  
  
  1.22      +6 -5      jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- document.py	23 Sep 2003 00:23:27 -0000	1.21
  +++ document.py	23 Sep 2003 15:13:08 -0000	1.22
  @@ -77,7 +77,7 @@
   from gump.context import *
   from gump.model import *
   from gump.statistics import StatisticsDB,ProjectStatistics,StatisticsGuru
  -from gump.logic import getPackagedProjects, getBuildSequenceForProjects,\
  +from gump.logic import getPackagedProjectContexts, getBuildSequenceForProjects,\
        getProjectsForProjectExpression, getModuleNamesForProjectList, \
        isFullGumpSet
   
  @@ -313,13 +313,14 @@
       documentWorkList(x,workspace,context.worklist,'Workspace-level Work',wdir)
        
       startSectionXDoc(x,'Packaged Projects')
  -    packages=getPackagedProjects()
  +    packages=getPackagedProjectContexts(context)
       if packages:
           startTableXDoc(x)
           x.write('      <tr><th>Name</th><th>Location</th></tr>')
  -        for project in packages:
  -            x.write('     <tr><!-- %s -->' % (project.name))        
  -            x.write('      <td>%s</td><td>%s</td>' % (project.name,
project.home))    
  +        for pctxt in packages:
  +            x.write('     <tr><!-- %s -->' % (pctxt.name))        
  +            x.write('      <td>%s</td>' % getContextLink(pctxt))   
  +            x.write('      <td>%s</td>' % pctxt.project.home)    
               x.write('     </tr>')
           endTableXDoc(x)
       else:
  
  
  

Mime
View raw message