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/10/06 21:39:28 UTC

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

ajack       2003/10/06 12:39:28

  Modified:    python/gump integrate.py logic.py document.py
  Log:
  1) 30 minute timeout on *nix on launched commands (then pkill -P pid)
  2) Better classpath display (i.e. who contributed)
  
  Revision  Changes    Path
  1.5       +3 -2      jakarta-gump/python/gump/integrate.py
  
  Index: integrate.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/integrate.py,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- integrate.py	30 Sep 2003 21:11:23 -0000	1.4
  +++ integrate.py	6 Oct 2003 19:39:28 -0000	1.5
  @@ -82,8 +82,9 @@
     
           # Build HTML Result (via Forrest)
           if not context.noForrest:
  -            document(workspace,context,1,modules,sequence)
  -            #document(workspace,context,1)
  +            # Bugs, looses some (e.g. packages modules)
  +            #document(workspace,context,1,modules,sequence)
  +            document(workspace,context,1)
     
           # Nag about failures
           # nag(workspace,context)
  
  
  
  1.16      +55 -17    jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- logic.py	3 Oct 2003 21:16:32 -0000	1.15
  +++ logic.py	6 Oct 2003 19:39:28 -0000	1.16
  @@ -240,7 +240,7 @@
       buildfile = ant.buildfile or ''
       
       basedir = os.path.normpath(os.path.join(module.srcdir or dir.base,ant.basedir or ''))
  -    classpath=getClasspath(project,workspace)
  +    classpath=getClasspath(project,workspace,context)
       properties=getAntProperties(workspace,ant)
      
       cmd=Cmd(context.javaCommand,'build_'+module.name+'_'+project.name,\
  @@ -269,25 +269,48 @@
           scriptfullname += '.bat'
           
       scriptfile=os.path.normpath(os.path.join(basedir, scriptfullname))
  -    classpath=getClasspath(project,workspace)
  +    classpath=getClasspath(project,workspace,context)
   
       return Cmd(scriptfile,'buildscript_'+module.name+'_'+project.name,\
               basedir,{'CLASSPATH':classpath})
   
  +class AnnotatedPath:
  +    """Contains a Path plus optional 'contributor' """
  +    def __init__(self,path,context=None):
  +        self.path=path
  +        self.context=context
  +        
  +    def __repr__(self):
  +        return self.path
  +        
  +    def __str__(self):
  +        return self.path
  +        
  +    def __eq__(self,other):
  +        return self.path == other.path and self.context == other.context
  +                
  +    def __cmp__(self,other):
  +        cmp = self.path < other.path
  +        if not cmp: cmp = self.context < other.context
  +        return cmp
  +        
   #
   # 
   #    
  -def getOutputsList(project):
  +def getOutputsList(project, pctxt): 
       outputs=[]
       for i in range(0,len(project.jar)):
           # :TODO: Hack to avoid a crash, don't know why it is needed...
           if project.jar[i].path:
               jar=os.path.normpath(project.jar[i].path)
  -            outputs.append(jar)        
  +            outputs.append(AnnotatedPath(jar,pctxt))        
  +            
       return outputs
                      
  -def hasOutputs(project):
  -    return (len(getOutputsList(project)) > 0)
  +def hasOutputs(project,pctxt):
  +    return (len(getOutputsList(project,pctxt)) > 0)
  +
  +
       
   #
   # Maybe this is dodgy (it is inefficient) but we need some
  @@ -309,55 +332,70 @@
   # those dependencies which are failed
   #
   # BOOTCLASSPATH?
  -def getClasspathList(project,workspace):
  +def getClasspathList(project,workspace,context):
     """Get a TOTAL classpath for a project (including it's dependencies)"""
     
     # Start with the system classpath (later remove this)
     classpath=getSystemClasspathList()
   
  +  # Context for this project
  +  pctxt=context.getProjectContextForProject(project)
  +
     # Add this project's work directories
     srcdir=Module.list[project.module].srcdir
     for work in project.work:
  +      path=None
         if work.nested:
  -          classpath.append(os.path.normpath(os.path.join(srcdir,work.nested)))
  +          path=os.path.normpath(os.path.join(srcdir,work.nested))
         elif work.parent:
  -          classpath.append(os.path.normpath(os.path.join(workspace.basedir,work.parent)))
  +          path=os.path.normpath(os.path.join(workspace.basedir,work.parent))
         else:
             log.error("<work element without nested or parent attributes on " + project.name )
       
  +      if path:
  +          classpath.append(AnnotatedPath(path,pctxt))
  +          
     # Append dependent projects (including optional)
     if project.depend:
         for depend in project.depend:
  -          classpath += getProjectTreeOutputList(depend)  
  +          classpath += getProjectTreeOutputList(depend,context)  
     if project.option:    
         for option in project.option:
  -          classpath += getProjectTreeOutputList(option)
  +          classpath += getProjectTreeOutputList(option,context)
         
     return classpath
     
  -def getProjectTreeOutputList(project):      
  +def getProjectTreeOutputList(project,context):      
     """Get a classpath of outputs for a project (including it's dependencies)"""            
     classpath=[]
     
  +  if not Project.list.has_key(project):
  +      if project and project.name:
  +          log.error("Unknown project (in acquiring classpath) " + project.name )
  +      return classpath
  +      
  +  # Context for this project...
  +  pctxt=context.getProjectContextForProject(project)
  +  
     # Append JARS for this project
     for jar in project.jars():
  -      classpath.append(jar.path) 
  +      classpath.append(AnnotatedPath(jar.path,pctxt)) 
         
     # Append sub-projects outputs
     if project.depend:
         for depend in project.depend:
  -        classpath += getProjectTreeOutputList(depend)
  +        classpath += getProjectTreeOutputList(depend,context)
     
     # Append optional sub-project's output (that may not exist)
     if project.option:
         for option in project.option:
  -        classpath += getProjectTreeOutputList(option)
  +        classpath += getProjectTreeOutputList(option,context)
   
     return classpath
     
   # BOOTCLASSPATH?
  -def getClasspath(project,workspace):
  -  return os.pathsep.join(getClasspathList(project,workspace))
  +def getClasspath(project,workspace,context):
  +  return os.pathsep.join(getClasspathList(project,workspace,context))
   
     
   def getAntProperties(workspace,ant):
  
  
  
  1.64      +19 -10    jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- document.py	3 Oct 2003 21:51:31 -0000	1.63
  +++ document.py	6 Oct 2003 19:39:28 -0000	1.64
  @@ -79,7 +79,7 @@
   from gump.statistics import StatisticsDB,ProjectStatistics,StatisticsGuru
   from gump.logic import getPackagedProjectContexts, getBuildSequenceForProjects,\
        getProjectsForProjectExpression, getModuleNamesForProjectList, \
  -     isFullGumpSet, getClasspathList
  +     isFullGumpSet, getClasspathList, AnnotatedPath
   
   def documentText(workspace,context,moduleFilterList=None,projectFilterList=None):    
       documentTextToFile(sys.stdout,workspace,context,moduleFilterList,projectFilterList)
  @@ -372,8 +372,12 @@
       mcount=0
       for mctxt in context:
           mname=mctxt.name
  -        if not Module.list.has_key(mname): continue        
  -        if moduleFilterList and not mctxt.module in moduleFilterList: continue
  +        if not Module.list.has_key(mname): 
  +            log.info("Unknown module : " + mname)
  +            continue        
  +        if moduleFilterList and not mctxt.module in moduleFilterList: 
  +            log.info("Module filtered out: " + mname)
  +            continue
           mcount+=1
   
           x.write('     <tr><!-- %s -->\n' % (mname))        
  @@ -585,7 +589,7 @@
       # Document Projects
       for pctxt in modulecontext:
           if projectFilterList and not pctxt.project in projectFilterList: continue      
  -        documentProject(workspace,modulename,mdir,pctxt.name,pctxt,db)
  +        documentProject(workspace,context,modulename,mdir,pctxt.name,pctxt,db)
      
       # Document the module XML
   #    x=startXDoc(getModuleXMLDocument(workspace,modulename,mdir))
  @@ -598,7 +602,7 @@
   #    footerXDoc(x)
   #    endXDoc(x)
       
  -def documentProject(workspace,modulename,mdir,projectname,projectcontext,db): 
  +def documentProject(workspace,context,modulename,mdir,projectname,projectcontext,db): 
       module=Module.list[modulename]
       project=Project.list[projectname]
       x=startXDoc(getProjectDocument(workspace,modulename,projectname,mdir))
  @@ -654,12 +658,17 @@
   
       startSectionXDoc(x,'Classpath')
       startTableXDoc(x)
  -    x.write('      <tr><th>Path Entry</th></tr>')       
  -    classpath=getClasspathList(project,workspace)
  +    x.write('      <tr><th>Path Entry</th><th>Contributor</th></tr>')       
  +    classpath=getClasspathList(project,workspace,context)
       paths=0
  -    for path in classpath:
  -        startTableRowXDoc(x)    
  -        insertTableDataXDoc(x,path)
  +    for path in classpath: 
  +        if isinstance(path,AnnotatedPath):
  +            pcontext=path.context
  +        else:
  +            pcontext=context
  +        startTableRowXDoc(x)
  +        insertTableDataXDoc(x, path)
  +        insertTableDataXDoc(x, getContextLink(pcontext))
           endTableRowXDoc(x)
           paths+=1
       if not paths: