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/document text.py
Date Thu, 05 Feb 2004 05:43:56 GMT
ajack       2004/02/04 21:43:56

  Modified:    python/gump/test/resources/full1 module2.xml module3.xml
               python/gump/model project.py ant.py
               python/gump engine.py check.py
               python/gump/document text.py
  Log:
  1) Attempt to make property dependency handling as w/ "traditional"
  2) Added 'check' (a start) to load/display a workspace.
  3) Some work on display workspace as 'text' (not xdocs/forrest)
  4) Added a test (or sample metadata) for above.
  
  Revision  Changes    Path
  1.11      +1 -1      jakarta-gump/python/gump/test/resources/full1/module2.xml
  
  Index: module2.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/resources/full1/module2.xml,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- module2.xml	28 Jan 2004 22:54:50 -0000	1.10
  +++ module2.xml	5 Feb 2004 05:43:56 -0000	1.11
  @@ -16,7 +16,7 @@
         <depend property="project1.jar" project="project1"/>
       </ant>
   
  -    <depend project="project1" inherit="runtime"/>
  +    <option project="project1" inherit="runtime"/>
   
       <home nested="dist"/>
       <mkdir dir="mkdir2"/>
  
  
  
  1.8       +5 -1      jakarta-gump/python/gump/test/resources/full1/module3.xml
  
  Index: module3.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/resources/full1/module3.xml,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- module3.xml	23 Jan 2004 23:32:26 -0000	1.7
  +++ module3.xml	5 Feb 2004 05:43:56 -0000	1.8
  @@ -10,7 +10,11 @@
     <project name="project3">
       <package>org.apache.project3</package>
   
  -    <ant target="gump"/>
  +    <ant target="gump" debug="true">      
  +      <depend property="project1.jar" project="project1"/>
  +    </ant>
  +
  +    <option project="project1" />
   
       <depend project="project2" runtime="true"/>
   
  
  
  
  1.31      +37 -17    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.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- project.py	30 Jan 2004 17:22:58 -0000	1.30
  +++ project.py	5 Feb 2004 05:43:56 -0000	1.31
  @@ -485,38 +485,51 @@
               report=JunitReport(self.xml.junitreport,self)
               self.reports.append(report)
   
  +        # Build Dependencies Map [including depends from <ant|maven/<property/<depend
  +        if not packaged:
  +            (badDepends, badOptions) = self.importDependencies(workspace)             
          
  +
           # Expand <ant <depends/<properties...
           if self.ant: self.ant.expand(self,workspace)
           if self.maven: self.maven.expand(self,workspace)
   
  -        # Build Dependencies Map [including depends from <ant|maven/<property/<depend
           if not packaged:
  -            (badDepends, badOptions) = self.buildDependenciesMap(workspace)
  -        
               # Complete dependencies so properties can reference the,
  +            # completed metadata within a dependent project
               for dependency in self.getDependencies():
                   dependency.getProject().complete(workspace)
  +
  +            self.buildDependenciesMap(workspace)                        
           
  -            # complete properties
  -            if self.ant: self.ant.complete(self,workspace)
  -            if self.maven: self.maven.complete(self,workspace)
  -    
  +        # complete properties
  +        if self.ant: 
  +            self.ant.complete(self,workspace)
  +            transferAnnotations(self.ant, self)  
  +            
  +        if self.maven: 
  +            self.maven.complete(self,workspace)
  +            transferAnnotations(self.maven, self)              
  +            
  +        if not packaged:    
               #
               # TODO -- move these back?
               #
               if badDepends or badOptions: 
                   for xmldepend in badDepends:
                       self.changeState(STATE_FAILED,REASON_CONFIG_FAILED)
  -                    self.addError("Bad Dependency. Project: " + xmldepend.project + " unknown
to *this* workspace")
  +                    self.addError("Bad Dependency. Project: " \
  +                            + xmldepend.project + " unknown to *this* workspace")
   
                   for xmloption in badOptions:                
  -                    self.addWarning("Bad *Optional* Dependency. Project: " + xmloption.project
+ " unknown to *this* workspace")
  +                    self.addWarning("Bad *Optional* Dependency. Project: " \
  +                            + xmloption.project + " unknown to *this* workspace")
           else:
               self.addInfo("This is a packaged project, location: " + str(self.home))   
    
                                       
           # Copy over any XML errors/warnings
           transferAnnotations(self.xml, self)  
  -                
  +        
  +        # Done, don't redo
           self.setComplete(1)
   
       def  checkPackage(self):
  @@ -536,7 +549,7 @@
               if outputsOk:
                   self.changeState(STATE_COMPLETE,REASON_PACKAGE)
               else:
  -                # Just in case it was so bad it thougt it had no
  +                # Just in case it was so bad it thought it had no
                   # jars to check
                   self.changeState(STATE_FAILED,REASON_PACKAGE_BAD)
                   
  @@ -547,7 +560,7 @@
                   listDirectoryAsWork(self,self.getHomeDirectory(),	\
                       'list_package_'+self.getName())                                   
        
           
  -    def buildDependenciesMap(self,workspace):        
  +    def importDependencies(self,workspace):        
           badDepends=[]
           # Walk the XML parts converting
           for xmldepend in self.xml.depend:
  @@ -577,6 +590,10 @@
                   self.addDependency(dependency)                    
               else:
                   badOptions.append(xmloption)
  +
  +        return (badDepends, badOptions)
  +        
  +    def buildDependenciesMap(self,workspace):        
           
           #
           # Provide backwards links  [Note: ant|maven might have added some
  @@ -588,7 +605,6 @@
               # Add us as a dependee on them
               dependProject.addDependee(dependency)  
                           
  -        return (badDepends, badOptions)
                                   
       def addDependency(self,dependency):
           #
  @@ -615,10 +631,14 @@
       # 
       def hasFullDependencyOnNamedProject(self,name):
           for dependency in self.depends:
  -            if dependency.getProject().getName()==name: return 1
  +            if dependency.getProject().getName()==name: 
  +                return 1
  +                
   # :TODO:        
   #           and not dependency.noclasspath: return 1
   #:TODO: noclasspath????
  +
  +        return 0
                 
       # determine if this project is a prereq of any project on the todo list
       def hasDirectDependencyOn(self,project):
  
  
  
  1.14      +9 -5      jakarta-gump/python/gump/model/ant.py
  
  Index: ant.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/model/ant.py,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- ant.py	23 Jan 2004 23:32:26 -0000	1.13
  +++ ant.py	5 Feb 2004 05:43:56 -0000	1.14
  @@ -92,8 +92,8 @@
       # entry that does NOT require referencing another project
       #
       def expand(self,project,workspace):
  -        self.expandProperties(project,workspace)
           self.expandDependencies(project,workspace)
  +        self.expandProperties(project,workspace)
           
       def expandProperties(self,project,workspace):
           #
  @@ -116,7 +116,11 @@
           # If the property is not as simple as srcdir
           if property.reference=="srcdir": return
           # If it isn't already a classpath dependency
  -        if project.hasFullDependencyOnNamedProject(property.project): return
  +        if project.hasFullDependencyOnNamedProject(property.project): 
  +            self.addInfo('Dependency on ' + property.project + \
  +                    ' exists, no need to add for property ' + \
  +                        property.name + '.')
  +            return
               
           # If there are IDs specified
           ids=''
  
  
  
  1.52      +43 -1     jakarta-gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- engine.py	30 Jan 2004 17:22:57 -0000	1.51
  +++ engine.py	5 Feb 2004 05:43:56 -0000	1.52
  @@ -162,6 +162,35 @@
           
           return result
   
  +       
  +    def check(self,run):    
  +  
  +        #
  +        # Prepare the context
  +        #
  +        self.preprocess(run, 0)
  +  
  +        #
  +        # Check the metadata
  +        #
  +        self.checkWorkspace(run)
  +                 
  +        #   
  +        # Build HTML Result (via Forrest or ...)
  +        #
  +        documenter=run.getOptions().getDocumenter()
  +        if documenter :
  +            documenter.document(run)
  +
  +        # Return an exit code based off success
  +        # :TODO: Move onto run
  +        if run.getWorkspace().isSuccess():
  +            result = SUCCESS 
  +        else: 
  +            result = FAILED
  +        
  +        return result
  +
   
       """
       
  @@ -571,4 +600,17 @@
               
               
           db.sync()
  -            
  +                
  +    """
  +    
  +        ******************************************************************
  +        
  +           CHECK WORKSPACE
  +        
  +        ******************************************************************
  +    
  +    """
  +    
  +    def checkWorkspace(self,run): pass
  +    
  +        
  \ No newline at end of file
  
  
  
  1.36      +7 -157    jakarta-gump/python/gump/check.py
  
  Index: check.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/check.py,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- check.py	11 Dec 2003 18:56:26 -0000	1.35
  +++ check.py	5 Feb 2004 05:43:56 -0000	1.36
  @@ -88,159 +88,6 @@
   # Functions
   ###############################################################################
   
  -def check(workspace,run,display=1):
  -  """dump all dependencies to build a project to the output"""
  -
  -  projects=getProjectsForProjectExpression(expr)
  -  
  -  missing=[]
  -  optionalMissing=[]
  -  optionalOnlyMissing=[]
  -  
  -  # for each project
  -  for project in projects:
  -    printed_header=0;    
  -    projectmissing = 0
  -   
  -    # for each dependency in current project
  -    for depend in project.depend:
  -      # if the dependency is not present in the projects, it's missing
  -      if depend.project not in Project.list:
  -        projectmissing+=1
  -        message="  Missing dependency: " + depend.project + " on project " + project.name
  -        
  -        if display:
  -            if not printed_header: 
  -              printHeader(project)
  -              printed_header=1            
  -            print message
  -        
  -        # Store message into context...
  -        context.addWarning(message)
  -        if depend.project not in missing:
  -          missing.append(depend.project)  
  -            
  -    for depend in project.option:
  -      # if the dependency is not present in the projects, it's missing
  -      if depend.project not in Project.list:
  -        projectmissing+=1
  -        message="  Missing optional dependency: " + depend.project + " on project " + project.name
  -
  -        if display:
  -            if not printed_header: 
  -              printHeader(project)
  -              printed_header=1    
  -            print message
  -        context.addWarning(message)
  -        if depend.project not in optionalMissing:
  -          optionalMissing.append(depend.project)
  -            
  -    if display and projectmissing>0:
  -        print "  total errors: " , projectmissing
  -
  -  if display:
  -      if len(optionalMissing)>0:     
  -        print
  -        print " ***** MISSING OPTIONAL *ONLY* PROJECTS THAT ARE REFERENCED ***** "
  -        print
  -        for missed in optionalMissing:
  -          if missed not in missing:
  -            optionalOnlyMissing.append(missed)
  -            print "  " + missed
  -              
  -      if len(missing)>0:
  -        print
  -        print " ***** MISSING PROJECTS THAT ARE REFERENCED ***** "
  -        print
  -        for missed in missing:
  -          print "  " + missed
  -
  -  # Comment out for now ...
  -  # 'cos loading a new workspace overwrites
  -  # the loaded one..
  -  
  -  #try:
  -  #  peekInGlobalProfile(missing);
  -  #except:
  -  #  print
  -  #  print " ***** In Global Profile... ***** "  
  -  #  print
  -  #  print "  Cannot load the global Gump profile, you have to install %\n  the jars by
hand."  
  -  #  print 
  -  #  traceback.print_exc()    
  -  #  print
  -    
  -  if display:  
  -      print
  -      print " ***** WORKSPACE RESULT ***** "  
  -      print
  -      
  -  if len(missing)>0:
  -    context.addError("Some projects that were referenced are missing in the workspace.")
   
  -    if display:
  -      print
  -      print "  - ERROR - Some projects that were referenced are missing in the workspace.
"  
  -      print "    See the above messages for more detailed info."
  -  elif display:
  -    print "  -  OK - All projects that are referenced are present in the workspace."  
  -
  -  if len(optionalOnlyMissing)>0:
  -    context.addWarning("Some projects that were referenced as optional are missing in the
workspace.");
  -    if display:
  -        print  
  -        print "  - WARNING - Some projects that were referenced as optional only are "
  -        print "    missing in the workspace. "  
  -        print "    See the above messages for more detailed info."
  -  elif display:
  -    print "  -  OK - All OPTIONAL projects that are referenced are present in the workspace."
 
  -    print " ***** RESULT ***** "
  -    
  -  return 0
  -  
  -def printHeader(project):
  -    print " *****************************************************"       
  -    print " Project: " + project.name
  -    
  -    
  -# Comment out for now ...
  -# 'cos loading a new workspace overwrites
  -# the loaded one..
  -#def peekInGlobalProfile(missing):
  -#   
  -#  print  
  -#  print "  *****************************************************"     
  -#  print "  **** Loading global Gump workspace to find info"
  -#  print "       about missing projects.   Please wait...   *****"
  -#  print "  *****************************************************"    
  -#  print
  -#
  -#  workspace=load(default.globalws)
  -#  
  -#  for missed in missing:
  -#    print  
  -#    print      
  -#    print "  **** Project: " + missed
  -#    print
  -#    if missed in Project.list:
  -#      currentproject = Project.list[missed]
  -#      currentmodule = Module.list[currentproject.module]
  -#      print "  ",currentmodule.description
  -#      print
  -#      if not currentproject.url.href == currentmodule.url.href:
  -#            print "   project url: " , currentproject.url.href
  -#      print "   module  url: " , currentmodule.url.href
  -#      print "   module  cvs: " , currentmodule.cvsroot()
  -#      if currentmodule.redistributable:
  -#        print  
  -#        print "   NOTE: You can also get it in the Gump jar repository." 
  -#        print "         See http://jakarta.apache,org/gump/ for details."
  -#        
  -#    else:
  -#      print "   Gump doesn't know about it. Or it's wrong, or you have to "
  -#      print "   install the artifacts of " + missed +" manually."
  -#            
  -
  -
   # static void main()
   if __name__=='__main__':
   
  @@ -259,7 +106,10 @@
       # The Run Details...
       run=GumpRun(workspace,ps,options)
       
  -
  +    #
  +    #    Perform this check run...
  +    #
  +    result = GumpEngine().check(run)
   
       #
       log.info('Gump Integration complete. Exit code:' + str(result))
  
  
  
  1.6       +61 -8     jakarta-gump/python/gump/document/text.py
  
  Index: text.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document/text.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- text.py	9 Jan 2004 19:57:20 -0000	1.5
  +++ text.py	5 Feb 2004 05:43:56 -0000	1.6
  @@ -105,21 +105,35 @@
           
           indent += ' '
           for module in workspace.getModules():
  -            if not gumpSet.inModules(module): continue        
  +            if not gumpSet.inModules(module): continue       
               output.write(indent + "Module [" + module.getName() + "] State: " + module.getStateDescription()
+ "\n")
               output.write(indent + "Projects: " + str(len(module.getProjects())) + "\n")
   
               self.documentAnnotations(indent,module)
  -            
  +                    
               for project in module.getProjects():
                   if not gumpSet.inSequence(project): continue
               
  -                output.write(indent + "Project [" + project.getName() 	\
  +                self.documentProject(indent,project)
  +                
  +    def documentProject(self, indent, project):
  +        indent += ' '
  +        output=self.output    
  +        output.write(indent + "Project [" + project.getName() 	\
                       + "] State: " + project.getStateDescription() + "\n")
  -                self.documentAnnotations(indent,project)
  -                self.documentWork(indent,project)
  +        
  +        
  +        self.documentDependenciesList(indent, "Project Dependees",		\
  +                project.getDependees(), 1, project)
  +            
  +        self.documentDependenciesList(indent, "Project Dependencies",	\
  +                project.getDependencies(), 0, project)
  +        
  +        self.documentAnnotations(indent,project)
  +        self.documentWork(indent,project)
   
       def documentWork(self, indent, workable):
  +        indent += ' '
           output=self.output    
           output.write(indent+"Work [" + str(len(workable.worklist)) \
                   + "] [" + str(workable.getElapsedSecs()) + "] secs."  + "\n")
  @@ -137,7 +151,46 @@
           
   
       def documentAnnotations(self, indent, annotatable): 
  +        indent += ' '
           output=self.output       
           for note in annotatable.getAnnotations():
               output.write(indent+" - " + str(note) + "\n")
  +        
  +        
  +    def documentDependenciesList(self,indent,title,dependencies,dependees,referencingObject):
  +      if dependencies:
  +            indent += ' '    
  +            output=self.output       
  +            output.write(indent+title+'\n')            
  +            indent += ' '    
  +            for depend in dependencies:
  +                
  +                # Project/Owner
  +                if not dependees:
  +                    project=depend.getProject()
  +                else:
  +                    project=depend.getOwnerProject()
  +                output.write(indent+project.getName())
  +
  +                # Type
  +                type=''
  +                if depend.isRuntime():
  +                    if type: type += ' '    
  +                    type+='Runtime'              
  +                if depend.isOptional():
  +                    if type: type += ' '
  +                    type+='Optional'                
  +                output.write('   '+type)
  +                
  +                # Inheritence
  +                output.write('   '+depend.getInheritenceDescription())
  +                
  +                # Ids
  +                ids = depend.getIds() or 'All'
  +                output.write('   '+ids)
  +                
  +                # State Icon
  +                output.write('   '+referencingObject.getStateDescription()+'\n')
  +                
  +                self.documentAnnotations(indent,depend)                    
           
  
  
  

Mime
View raw message