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/09/30 00:28:53 UTC

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

ajack       2003/09/29 15:28:53

  Modified:    python/gump logic.py check.py document.py
  Added:       python/gump repository.py
  Log:
  1) Preliminary work on repository (for outputs)
  2) Less verbose check
  3) Show "packaged modules" not just "packages projects"
  
  Revision  Changes    Path
  1.8       +9 -7      jakarta-gump/python/gump/logic.py
  
  Index: logic.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/logic.py,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- logic.py	29 Sep 2003 17:47:18 -0000	1.7
  +++ logic.py	29 Sep 2003 22:28:53 -0000	1.8
  @@ -419,19 +419,19 @@
           allPackaged=1
           for project in module.project:
               if not isPackaged(project):
  -                allPackaged=0  
  -                if packageCount:
  -                    if not hasOutputs(project):
  +                if not hasOutputs(project):
                           # 
                           # Honorary package (allow folks to only mark the main
                           # project in a module as a package, and those that do
                           # not product significant outputs (e.g. test projects)
                           # will be asssumed to be packages.
                           # 
  -                        pctxt=context.getProjectContextForProject(project)
  -                        pctxt.state=STATUS_COMPLETE
  -                        pctxt.reason=REASON_PACKAGE
  -                    else:
  +                    pctxt=context.getProjectContextForProject(project)
  +                    pctxt.state=STATUS_COMPLETE
  +                    pctxt.reason=REASON_PACKAGE
  +                else:    
  +                    allPackaged=0  
  +                    if packageCount:
                           mctxt.addWarning("Incomplete \'Packaged\' Module. Project: " + \
                                       project.name + " is not packaged")                  
               else:
  @@ -440,6 +440,8 @@
           if allPackaged:
               mctxt.state=STATUS_COMPLETE
               mctxt.reason=REASON_PACKAGE
  +            mctxt.addInfo("\'Packaged\' Module. (Packaged projects: " + \
  +                                    packageCount + '.)')   
                           
   # static void main()
   if __name__=='__main__':
  
  
  
  1.22      +5 -4      jakarta-gump/python/gump/check.py
  
  Index: check.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/check.py,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- check.py	29 Sep 2003 17:47:18 -0000	1.21
  +++ check.py	29 Sep 2003 22:28:53 -0000	1.22
  @@ -331,7 +331,8 @@
         currentmodule = Module.list[currentproject.module]
         print "  ",currentmodule.description
         print
  -      print "   project url: " , currentproject.url.href
  +      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:
  
  
  
  1.50      +36 -1     jakarta-gump/python/gump/document.py
  
  Index: document.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document.py,v
  retrieving revision 1.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- document.py	29 Sep 2003 19:18:30 -0000	1.49
  +++ document.py	29 Sep 2003 22:28:53 -0000	1.50
  @@ -355,7 +355,38 @@
       # x.write('<p><strong>RSS :</strong> <link href=\'index.rss\'>News Feed</link></p>')
       
       documentWorkList(x,workspace,context.worklist,'Workspace-level Work',wdir)
  -     
  +       
  +    startSectionXDoc(x,'Packaged Modules')
  +    startTableXDoc(x)
  +    x.write('     <tr>')        
  +    x.write('      <th>Name</th><th>Project State(s)</th><th>Elapsed Time</th>')
  +    x.write('     </tr>')
  +    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
  +        
  +        packaged=0
  +        #
  +        # Determine if there are todos, otherwise continue
  +        #
  +        if mctxt.status==STATUS_COMPLETE and mctxt.reason==REASON_PACKAGE:
  +            packaged=1
  +                
  +        if not packaged: continue
  +    
  +        mcount+=1
  +
  +        x.write('     <tr><!-- %s -->\n' % (mname))        
  +        x.write('      <td><link href=\'%s\'>%s</link></td><td>%s</td>\n' % \
  +          (getModuleRelativeUrl(mname),mname,getStateIcons(mctxt.aggregateStates())))    
  +        x.write('      <td>%s</td>\n' % elapsedTimeToString(mctxt.elapsedTime()))    
  +        x.write('     </tr>\n\n')
  +    if not mcount: x.write('	<tr><td>None</td></tr>')
  +    endTableXDoc(x)
  +    endSectionXDoc(x)
  +    
       startSectionXDoc(x,'Packaged Projects')
       packages=getPackagedProjectContexts(context)
       if packages:
  @@ -492,6 +523,8 @@
       startSectionXDoc(x,'Module Details')
       startListXDoc(x)
       addItemXDoc(x,"Status: " + stateName(modulecontext.status))
  +    if not modulecontext.reason == REASON_UNSET:
  +        addItemXDoc(x,"Reason: " + reasonString(modulecontext.reason))
       if modulecontext.cause and not modulecontext==modulecontext.cause:
            addItemXDoc(x, "Root Cause: ", getTypedContextLink(modulecontext.cause)) 
       if module.cvs.repository:
  @@ -558,6 +591,8 @@
       startSectionXDoc(x,'Details')
       startListXDoc(x)
       addItemXDoc(x,"Status: ", stateName(projectcontext.status))  
  +    if not projectcontext.reason == REASON_UNSET:
  +        addItemXDoc(x,"Reason: " + reasonString(projectcontext.reason))
       addItemXDoc(x,"Module: ", getContextLink(projectcontext.parent))
       if projectcontext.cause and not projectcontext==projectcontext.cause:
           addItemXDoc(x,"Root Cause: ", getTypedContextLink(projectcontext.cause))
  
  
  
  1.1                  jakarta-gump/python/gump/repository.py
  
  Index: repository.py
  ===================================================================
  #!/usr/bin/env python
  
  # $Header: /home/cvspublic/jakarta-gump/python/gump/conf.py,v 1.7 2003/05/10 18:20:36 nicolaken Exp $
  # $Revision: 1.7 $
  # $Date: 2003/05/10 18:20:36 $
  #
  # ====================================================================
  #
  # The Apache Software License, Version 1.1
  #
  # Copyright (c) 2003 The Apache Software Foundation.  All rights
  # reserved.
  #
  # Redistribution and use in source and binary forms, with or without
  # modification, are permitted provided that the following conditions
  # are met:
  #
  # 1. Redistributions of source code must retain the above copyright
  #    notice, this list of conditions and the following disclaimer.
  #
  # 2. Redistributions in binary form must reproduce the above copyright
  #    notice, this list of conditions and the following disclaimer in
  #    the documentation and/or other materials provided with the
  #    distribution.
  #
  # 3. The end-user documentation included with the redistribution, if
  #    any, must include the following acknowlegement:
  #       "This product includes software developed by the
  #        Apache Software Foundation (http://www.apache.org/)."
  #    Alternately, this acknowlegement may appear in the software itself,
  #    if and wherever such third-party acknowlegements normally appear.
  #
  # 4. The names "The Jakarta Project", "Alexandria", and "Apache Software
  #    Foundation" must not be used to endorse or promote products derived
  #    from this software without prior written permission. For written
  #    permission, please contact apache@apache.org.
  #
  # 5. Products derived from this software may not be called "Apache"
  #    nor may "Apache" appear in their names without prior written
  #    permission of the Apache Group.
  #
  # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  # OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  # DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  # ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  # OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  # SUCH DAMAGE.
  # ====================================================================
  #
  # This software consists of voluntary contributions made by many
  # individuals on behalf of the Apache Software Foundation.  For more
  # information on the Apache Software Foundation, please see
  # <http://www.apache.org/>.
  
  """
      A Repository 
  """
  class RepositoryEntry:
      """Contains epository Conten"""
      def __init__(self,state=STATUS_UNSET,reason=REASON_UNSET):
          self.state=state
          self.reason=reason
          
      def __repr__(self):
          return str(self)
          
      def __str__(self):
          result=stateName(self.state)
          if not self.reason == REASON_UNSET:
              result += ":" + reasonString(self.reason)
          return result
          
      def __eq__(self,other):
          return self.state == other.state and self.reason == other.reason
                  
      def __cmp__(self,other):
          cmp = self.state < other.state
          if not cmp: cmp = self.reason < other.reason
          return cmp
  
  class Repository:
      """Contains Repository Contents"""
      def __init__(self,root):
          self.root=root
          
      def __repr__(self):
          return str(self.root)
          
      def __str__(self):
          return 'Repository:' + str(self.root)
          
      def __eq__(self,other):
          return self.root == other.root
                  
      def __cmp__(self,other):
          cmp = self.root < other.root
          return cmp    
              
      def getRepositoryDir(self):
          rdir=os.path.abspath(os.path.normpath(self.root))
          if not os.path.exists(rdir): os.mkdir(rdir)
          return rdir  
      
      #
      # Repository format is:
      #
      #	../{group}/jars/{output files}
      #    
      def getGroupDir(self,group,rdir=None):
          if not rdir: rdir=getRepositoryRootDir(self)
          gdir=os.path.abspath(os.path.join(rdir,group))
          if not os.path.exists(gdir): os.mkdir(gdir)
          jdir=os.path.abspath(os.path.join(gdir,'jars'))
          if not os.path.exists(jdir): os.mkdir(jdir)
          return jdir  
  
  # static void main()
  if __name__=='__main__':
  
    # init logging
    logging.basicConfig()
  
    #set verbosity to show all messages of severity >= default.logLevel
    log.setLevel(default.logLevel)
    
    args = handleArgv(sys.argv,0)
    ws=args[0]
    ps=args[1]
  
    context=GumpContext()
    
        
    # get parsed workspace definition
    from gump import load
    workspace=load(ws, context)
  
    repo=Repository(workspace.jars)