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 2003/11/04 17:15:03 UTC

cvs commit: jakarta-gump/python/gump integrate.py launcher.py build.py logic.py document.py conf.py

ajack       2003/11/04 08:15:03

  Modified:    python/gump integrate.py launcher.py build.py logic.py
                        document.py conf.py
  Log:
  1) Try two at jumping to work not project/module/ws if failed
  2) Try two at projects.html
  
  Note: Some re-work moving to GumpSet (more OO) so needs testing in live environment.
  
  Revision  Changes    Path
  1.13      +2 -2      jakarta-gump/python/gump/integrate.py
  
  Index: integrate.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/integrate.py,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- integrate.py	3 Nov 2003 19:42:44 -0000	1.12
  +++ integrate.py	4 Nov 2003 16:15:03 -0000	1.13
  @@ -49,7 +49,7 @@
       #
       # Store for later
       #
  -    context.gumpset=getGumpSetForProjectExpression(expr)
  +    context.gumpset=GumpSet(expr)
       
       
   def integrate(workspace,expr='*',context=GumpContext()):
  @@ -82,7 +82,7 @@
     
           # Build HTML Result (via Forrest)
           if not context.noForrest:
  -            document(workspace,context,1,modules,sequence)
  +            document(workspace,context,modules,sequence)
     
           #
           # Nag about failures -- only if we are allowed to
  
  
  
  1.34      +6 -6      jakarta-gump/python/gump/launcher.py
  
  Index: launcher.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/launcher.py,v
  retrieving revision 1.33
  retrieving revision 1.34
  diff -u -r1.33 -r1.34
  --- launcher.py	3 Nov 2003 19:42:45 -0000	1.33
  +++ launcher.py	4 Nov 2003 16:15:03 -0000	1.34
  @@ -252,7 +252,7 @@
           if self.elapsed:
             overview += indent+"Elapsed: " + str(self.elapsed)
           if self.signal:
  -          overview += indent+"Signal: " + str(self.signal)
  +          overview += indent+"Termination Signal: " + str(self.signal)
           if self.exit_code:
             overview += indent+"ExitCode: " + str(self.exit_code)
           
  @@ -409,8 +409,10 @@
           result.signal=(waitcode & 0xFF)
           result.exit_code=(((waitcode & 0xFF00) >> 8) & 0xFF)
           
  +        log.debug('Command . [' + str(waitcode)+ '] [' + str(result.signal) + '/' + str(result.exit_code) + '].')
  +            
           #
  -        # Assume timed out if this is not running...
  +        # Assume timed out if signal terminated
           #
           if result.signal > 0:
               result.status=CMD_STATUS_TIMED_OUT
  @@ -418,7 +420,7 @@
           # Process Outputs (exit_code and stderr/stdout)
           elif result.exit_code > 0:    
               result.status=CMD_STATUS_FAILED
  -            log.error('Failed to launch/execute command. [' + execString + ']. ExitCode: ' + str(result.exit_code))
  +            log.error('Command failed. [' + execString + ']. ExitCode: ' + str(result.exit_code))
           else:
               result.status=CMD_STATUS_SUCCESS
       
  @@ -426,9 +428,7 @@
           # Stop it (if still running)
           #
           timer.cancel()            
  -                  
  -    
  -                
  +                    
         except Exception, details :
           log.error('Failed to launch command. Details: ' + str(details))
           
  
  
  
  1.32      +4 -4      jakarta-gump/python/gump/build.py
  
  Index: build.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/build.py,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- build.py	3 Nov 2003 22:06:06 -0000	1.31
  +++ build.py	4 Nov 2003 16:15:03 -0000	1.32
  @@ -255,7 +255,7 @@
                       else:
                           pctxt.status=STATUS_SUCCESS  
       
  -            if not pctxt.status == STATUS_SUCCESS:
  +            if not pctxt.okToPerformWork():
                   log.warn('Failed to build project [' + pctxt.name + ']')
               
   
  
  
  
  1.44      +25 -9     jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- logic.py	3 Nov 2003 19:42:45 -0000	1.43
  +++ logic.py	4 Nov 2003 16:15:03 -0000	1.44
  @@ -101,7 +101,7 @@
           if not projects:
               self.projects=getProjectsForProjectExpression(pexpr)
           else:
  -            self.projects = projects
  +            self.projects=projects
           
           #
           # Project Build Sequence
  @@ -119,18 +119,34 @@
           else:
               self.modules=modules
               
  +        print self.projectexpression
  +        print self.projects
  +        print self.modules
  +        print self.sequence
  +        
  +    # No Projects
  +    def isEmpty(self):
  +        return not self.projects
  +        
  +    # All Projects
  +    def isFull(self):
  +        return isAllProjects(self.projectexpression)
  +        
  +    def getModules(self):
  +        return self.modules
  +        
  +    def getProjects(self):
  +        return self.projects
  +        
  +    def getSequence(self):
  +        return self.sequence        
  +        
       
   ###############################################################################
   # Functions
   ###############################################################################
   def isAllProjects(pexpr):
       return pexpr=='all' or pexpr=='*'
  -    
  -def isFullGumpSet(set):
  -    return isAllProjects(set.projectexpression)
  -        
  -def getGumpSetForProjectExpression(expr):
  -  return GumpSet(expr)
   
   def getModuleNamesForProjectExpression(expr):
     return getModuleNamesForProjectList(getProjectsForProjectExpression(expr))
  @@ -375,7 +391,7 @@
       return cmd
       
   def getDeleteCommand(workspace,context,module,project,delete,index=0):
  -    basedir=os.path.abspath(os.path.join(module.srcdir or dir.base,script.basedir or ''))
  +    basedir=os.path.abspath(module.srcdir or dir.base)
         
       cmd=Cmd('echo rm','delete_'+module.name+'_'+project.name+'_'+str(index+1),\
               basedir)
  @@ -396,7 +412,7 @@
       return cmd
       
   def getMkDirCommand(workspace,context,module,project,mkdir,index=0):
  -    basedir=os.path.abspath(os.path.join(module.srcdir or dir.base,script.basedir or ''))
  +    basedir=os.path.abspath(module.srcdir or dir.base)
         
       cmd=Cmd('echo mkdir','mkdir_'+module.name+'_'+project.name+'_'+str(index+1),\
               basedir)
  
  
  
  1.105     +68 -53    jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.104
  retrieving revision 1.105
  diff -u -r1.104 -r1.105
  --- document.py	3 Nov 2003 21:03:49 -0000	1.104
  +++ document.py	4 Nov 2003 16:15:03 -0000	1.105
  @@ -79,12 +79,15 @@
   from gump.statistics import StatisticsDB,ProjectStatistics,StatisticsGuru
   from gump.logic import getPackagedProjectContexts, getBuildSequenceForProjects,\
        getProjectsForProjectExpression, getModuleNamesForProjectList, \
  -     isFullGumpSet, getClasspathLists, AnnotatedPath, hasBuildCommand
  +    getClasspathLists, AnnotatedPath, hasBuildCommand
   
  -def documentText(workspace,context,moduleList=None,projectList=None):    
  -    documentTextToFile(sys.stdout,workspace,context,moduleList,projectList)
  +def documentText(workspace,context):    
  +    documentTextToFile(sys.stdout,workspace,context)
       
  -def documentTextToFile(f,workspace,context,moduleList,projectList):    
  +def documentTextToFile(f,workspace,context):    
  +    
  +    moduleList=context.gumpset.getModules()
  +    projectList=context.gumpset.getSequence()
       
       f.write("Workspace Status : " + stateName(context.status) + "\n")
       f.write("Workspace Secs : " + str(context.elapsedSecs()) + "\n")
  @@ -125,20 +128,20 @@
                           f.write("    Work Cwd  : " + work.command.cwd + "\n")
                       f.write("    Work Exit : " + str(work.result.exit_code) + "\n")
   
  -def document(workspace,context,full=None,moduleList=None,projectList=None):
  +def document(workspace,context):
       
       log.debug('--- Documenting Results')
   
  -    seedForrest(workspace,context)
  +    moduleList=context.gumpset.getModules()
  +    projectList=context.gumpset.getSequence()
       
  -    # Testing...
  -    #documentText(workspace,context,moduleList,projectList)
  +    seedForrest(workspace,context)
       
       db=StatisticsDB()
     
       documentWorkspace(workspace,context,db,moduleList,projectList)
       
  -    if full or 1: # Testing
  +    if context.gumpset.isFull():
           documentStatistics(workspace,context,db,moduleList,projectList)
           documentXRef(workspace,context)
   
  @@ -242,7 +245,7 @@
   #
   # Model Pieces
   #      
  -def documentWorkspace(workspace,context,db,moduleList=None,projectList=None):
  +def documentWorkspace(workspace,context,db,moduleList,projectList):
       
       wdir=getWorkspaceDir(workspace)
       
  @@ -274,7 +277,7 @@
       endTableXDoc(x)
       endSectionXDoc(x)                
       
  -    if not isFullGumpSet(context.gumpset):
  +    if not context.gumpset.isFull():
           note="""This output does not represent the a complete workspace,
           but a partial one.         
           Only projects, and their dependents, matching this regular expression """ + \
  @@ -444,37 +447,36 @@
       #
       # Projects.xml
       #
  -    if projectList:
  -        x=startXDoc(getWorkspaceDocument(workspace,wdir,'projects'))      
  -        headerXDoc(x,'All Projects')
  +    x=startXDoc(getWorkspaceDocument(workspace,wdir,'projects'))      
  +    headerXDoc(x,'All Projects')
       
  -        documentSummary(x,context.getProjectSummary())
  +    documentSummary(x,context.getProjectSummary())
       
  -        startSectionXDoc(x,'All Project')
  -        startTableXDoc(x)
  -        x.write('     <tr>')        
  -        x.write('      <th>Name</th><th>Project State</th><th>Elapsed Time</th>')
  -        x.write('     </tr>')
  -        pcount=0
  -        for project in projectList:
  -            pctxt=context.getProjectContextForProject(project)
  -            pname=pctxt.name
  -            pcount+=1
  +    startSectionXDoc(x,'All Project')
  +    startTableXDoc(x)
  +    x.write('     <tr>')        
  +    x.write('      <th>Name</th><th>Project State</th><th>Elapsed Time</th>')
  +    x.write('     </tr>')
  +    pcount=0
  +    for project in projectList:
  +        pctxt=context.getProjectContextForProject(project)
  +        pname=pctxt.name
  +        pcount+=1
   
  -            x.write('     <tr><!-- %s -->\n' % (pname))        
  -            x.write('      <td><link href=\'%s\'>%s</link></td><td>%s</td>\n' % \
  +        x.write('     <tr><!-- %s -->\n' % (pname))        
  +        x.write('      <td><link href=\'%s\'>%s</link></td><td>%s</td>\n' % \
                         (	getProjectRelativeUrl(pname),	\
                           pname,	\
                           getStateIcon(pctxt)))    
  -            x.write('      <td>%s</td>\n' % elapsedTimeToString(pctxt.elapsedTime()))    
  -            x.write('     </tr>\n\n')
  +        x.write('      <td>%s</td>\n' % elapsedTimeToString(pctxt.elapsedTime()))    
  +        x.write('     </tr>\n\n')
               
  -        if not pcount: x.write('	<tr><td>None</td></tr>')
  -        endTableXDoc(x)
  -        endSectionXDoc(x)    
  +    if not pcount: x.write('	<tr><td>None</td></tr>')
  +    endTableXDoc(x)
  +    endSectionXDoc(x)    
   
  -        footerXDoc(x)
  -        endXDoc(x)
  +    footerXDoc(x)
  +    endXDoc(x)
       
       #
       # ----------------------------------------------------------------------
  @@ -544,13 +546,11 @@
           if moduleList and not mctxt.module in moduleList: continue    
           documentModule(workspace,context,wdir,mctxt.name,mctxt,db,projectList)
           
  -        
       # Document context
  -    
       x=startXDoc(getWorkspaceContextDocument(workspace,wdir))
       headerXDoc(x,'Context')    
       x.write('<source>\n')
  -    documentTextToFile(x,workspace,context,moduleList,projectList)    
  +    documentTextToFile(x,workspace,context)    
       x.write('</source>\n')   
       footerXDoc(x)
       endXDoc(x)
  @@ -574,7 +574,7 @@
       href=getContextStateLink(context,0,icon)
       return href
       
  -def documentModule(workspace,context,wdir,modulename,modulecontext,db,projectList=None):
  +def documentModule(workspace,context,wdir,modulename,modulecontext,db,projectList):
       mdir=getModuleDir(workspace,modulename,wdir)
       
       if not Module.list.has_key(modulename): return
  @@ -1061,7 +1061,7 @@
   #
   # Statistics Pages
   #           
  -def documentStatistics(workspace,context,db,moduleList=None,projectList=None):
  +def documentStatistics(workspace,context,db,moduleList,projectList):
       
       stats=StatisticsGuru(workspace,context,db)
       
  @@ -1087,7 +1087,7 @@
       documentModulesByFOGFactor(stats, sdir, moduleList)
       
   
  -def documentModulesByElapsed(stats,sdir,moduleList=None):
  +def documentModulesByElapsed(stats,sdir,moduleList):
       x=startXDoc(os.path.join(sdir,'elapsed.xml'))
       headerXDoc(x, 'Modules By Elapsed Time')
       
  @@ -1101,7 +1101,7 @@
       footerXDoc(x)
       endXDoc(x)
   
  -def documentModulesByProjects(stats,sdir,moduleList=None):
  +def documentModulesByProjects(stats,sdir,moduleList):
       x=startXDoc(os.path.join(sdir,'projects.xml'))
       headerXDoc(x, 'Modules By Project Count')
       
  @@ -1125,7 +1125,7 @@
       footerXDoc(x)
       endXDoc(x)
    
  -def documentModulesByDependencies(stats,sdir,moduleList=None):
  +def documentModulesByDependencies(stats,sdir,moduleList):
       x=startXDoc(os.path.join(sdir,'dependencies.xml'))
       headerXDoc(x, 'Modules By Dependency Count')
       
  @@ -1150,7 +1150,7 @@
       
    
    
  -def documentModulesByDependees(stats,sdir,moduleList=None):
  +def documentModulesByDependees(stats,sdir,moduleList):
       x=startXDoc(os.path.join(sdir,'dependees.xml'))
       headerXDoc(x, 'Modules By Dependee Count')
       
  @@ -1173,7 +1173,7 @@
       footerXDoc(x)
       endXDoc(x)
       
  -def documentModulesByFOGFactor(stats,sdir,moduleList=None):
  +def documentModulesByFOGFactor(stats,sdir,moduleList):
       x=startXDoc(os.path.join(sdir,'fogfactor.xml'))
       headerXDoc(x, 'Modules By FOG Factor')
       
  @@ -1202,7 +1202,7 @@
   #
   # XRef Pages
   #           
  -def documentXRef(workspace,context,moduleList=None,projectList=None):
  +def documentXRef(workspace,context,moduleList,projectList):
       
       xdir=getXRefDir(workspace)
       x=startXDoc(getXRefDocument(workspace,xdir))
  @@ -1335,6 +1335,14 @@
       url += getContextUrl(context,0)
       return url
           
  +def getContextDirUrl(context,depth=1):
  +    if isinstance(context,GumpContext):
  +        url=getWorkspaceDirRelativeUrl(depth)
  +    elif isinstance(context,ModuleContext):
  +        url=getModuleDirRelativeUrl(context.name,depth)
  +    else:        
  +        url=getModuleDirProjectRelativeUrl(context.parent.name,depth)
  +    return url
           
   def getContextUrl(context,depth=1,state=0):
       url=None
  @@ -1346,7 +1354,8 @@
           for work in context.worklist:
               if not url:
                   if not work.status==STATUS_SUCCESS:
  -                    url=getWorkRelativeUrl(work.type,work.command.name)
  +                    url=getContextDirRelativeUrl(context,depth) 
  +                    url+=getWorkRelativeUrl(work.type,work.command.name)
           
       #
       # Otherwise return link to context...
  @@ -1392,7 +1401,10 @@
       return xdoc
   
   def getWorkspaceRelativeUrl(depth=0):
  -    return getUp(depth)+'index.html'
  +    return getWorkspaceDirRelativeUrl(depth)+'index.html'
  +    
  +def getWorkspaceDirRelativeUrl(depth=0):
  +    return getUp(depth)+'/'
       
   def getWorkspaceRelativeUrlFromModule():
       return getWorkspaceRelativeUrl(1)
  @@ -1401,7 +1413,10 @@
       return getWorkspaceRelativeUrl(1)
       
   def getModuleRelativeUrl(name,depth=0):
  -    return getUp(depth)+gumpSafeName(name)+'/index.html'
  +    return getModuleDirRelativeUrl(name,depth)+'index.html'
  +    
  +def getModuleDirRelativeUrl(name,depth=0):
  +    return getUp(depth)+gumpSafeName(name)+'/'
       
   def getModuleRelativeUrlFromModule(name,depth=1):
       return getModuleRelativeUrl(name,depth)
  @@ -1595,7 +1610,7 @@
     #set verbosity to show all messages of severity >= default.logLevel
     log.setLevel(default.logLevel)
     
  -  args = handleArgv(sys.argv,0)
  +  args = handleArgv(sys.argv)
     ws=args[0]
     ps=args[1]
   
  @@ -1613,8 +1628,8 @@
     #
     # Store for later
     #
  -  from gump.logic import getGumpSetForProjectExpression
  -  context.gumpset=getGumpSetForProjectExpression(ps)
  -  
  +  from gump.logic import GumpSet
  +  context.gumpset=GumpSet(ps)
  +    
     # Document
  -  document(workspace, context, 1);
  +  document(workspace, context);
  
  
  
  1.36      +12 -5     jakarta-gump/python/gump/conf.py
  
  Index: conf.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/conf.py,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- conf.py	3 Nov 2003 19:42:45 -0000	1.35
  +++ conf.py	4 Nov 2003 16:15:03 -0000	1.36
  @@ -197,9 +197,16 @@
         print " No project specified, please supply a project expressions or 'all'."
         print " Project wildcards are accepted, e.g. \"jakarta-*\"."
         sys.exit(1)
  -     
  +    
     # Allow extras...
     args += argv
  -     
  +  
  +  # 
  +  for arg in args:
  +      if arg in ['-d','--debug']: 
  +          log.setLevel(logging.DEBUG ) 
  +      if arg in ['-v','--verbose']: 
  +          log.setLevel(logging.VERBOSE )  
  +    
     return args