ajack       2004/02/23 07:43:06

  Modified:    .        gump.xml
               python/gump/utils __init__.py
               python/gump/test resulting.py
               python/gump/output nag.py
               python/gump/model project.py
               python/gump/document forrest.py
  Added:       .        gumpy.py
               tracker  apache-jira.xml
  Log:
  1) Calc/Display project summary percentages

  2) Some tracker stuff

  3) Initial (not very functional) tweaking to gumpy.py
  
  Revision  Changes    Path
  1.5       +2 -1      jakarta-gump/gump.xml
  
  Index: gump.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/gump.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- gump.xml  20 Feb 2004 16:36:06 -0000      1.4
  +++ gump.xml  23 Feb 2004 15:43:06 -0000      1.5
  @@ -1,6 +1,7 @@
   <?xml version="1.0" ?>
   
  -<workspace basedir="/data/gump" 
  +<workspace name="gump" 
  +                basedir="/data/gump" 
              jardir="/data/gump/jars/latest"
              pkgdir="/data/package"
              sync="rsync -r -a --delete" version="0.3">
  
  
  
  1.1                  jakarta-gump/gumpy.py
  
  Index: gumpy.py
  ===================================================================
  #!/usr/bin/env python

  #

  # $Header:  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) 2004 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 [EMAIL PROTECTED]

  #

  # 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/>.

  

  

  """

    This is the commandline entrypoint into Python Gump,

    used *primarily* by nightly cron jobs.

    

    It updates Gump (from CVS) to ensure it (itself) is 

    latest, does some environment twiddling, and runs the

    main gump/integration.py. Bit more twiddling with 

    outputs afterwards...

  

  """

  

  import os.path

  import os

  import sys

  import socket

  import time

  

  

  LINE=' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - GUMP'

  

  def runCommand(command,args='',dir=None,outputFile=None):

      """ Run a command, and check the result... """

      

      #    

      originalCWD=None

      if dir:     

          originalCWD=os.getcwd()

          cwdpath=os.path.abspath(dir)

          try:

              log.write('Executing with CWD: [' + dir + ']\n')    

              if not os.path.exists(cwdpath): os.makedirs(dir)

              os.chdir(cwdpath)

          except Exception, details :

              # Log the problem and re-raise

              log.write('Failed to create/change CWD [' + cwdpath + ']. Details: ' + 
str(details) + '\n')

              return 0

                

      try:

          

          #

          if not outputFile:

              outputFile='out.tmp'

          

          fullCommand = command + ' ' + args + ' >' + outputFile + ' 2>&1'    

          log.write('Execute : ' + fullCommand + '\n')

         

          #

          # Execute Command & Calculate Exit Code

          #

          systemReturn=os.system(fullCommand)

          

          if not os.name == 'dos' and not os.name == 'nt':

              waitcode=systemReturn

          

              #

              # The return code (from system = from wait) is (on Unix):

              #

              # a 16 bit number

              # top byte        =       exit status

              # low byte        =       signal that killed it

              #

              exit_code=(((waitcode & 0xFF00) >> 8) & 0xFF)

          

          else:

              exit_code=systemReturn

      

          if os.path.exists(outputFile):

              if os.path.getsize(outputFile) > 0:

                  catFile(log,outputFile)            

              os.remove(outputFile)

          

          log.write('Exit Code : ' + `exit_code`)

      

      finally:

          if originalCWD: os.chdir(originalCWD)

        

      return exit_code

  

  def catFile(output,file,title=None):

      """ Cat a file to a stream... """

      if title:

          output.write(LINE + '\n')    

          output.write(title + '\n\n')

          

      input=open(file,'r')

      line = input.readline()

      while line:

          output.write(line)

          # Next...

          line = input.readline()

          

  # Enable a log

  logFile='gumpy.log'

  log=open(logFile,'w')

  

  result=0

          

  try:

  

      try:

          

          # Process Environment

          hostname = socket.gethostname()

  

          log.write('- GUMP run on host   : ' + hostname + '\n')

          log.write('- GUMP run @         : ' + time.strftime('%d %b %y %H:%M:%S', 
time.gmtime()) + '\n')

          log.write('- GUMP run by Python : ' + `sys.version` + '\n')

          log.write('- GUMP run on OS     : ' + `os.name` + '\n')

          log.write('- GUMP run in env    : \n')

          

          for envkey in os.environ.keys():

              envval=os.environ[envkey]

              log.write('   ' + envkey + ' -> [' + envval + ']\n')

          

          workspaceName = hostname + '.xml'

          if os.environ.has_key('GUMP_WORKSPACE'):        

              workspaceName = os.environ['GUMP_WORKSPACE'] + '.xml'

              

          projectsExpr='*'

          if os.environ.has_key('GUMP_PROJECTS'):        

              projectsExpr = os.environ['GUMP_PROJECTS']            

  

  

          #

          # Add Gump to Python Path...

          #

          pythonPath=''

          if os.environ.has_key('PYTHONPATH'):

              pythonPath=os.environ['PYTHONPATH']

              pythonPath+=os.pathsep

          pythonPath+=str(os.path.abspath(os.path.join(os.getcwd(),'python')))

          log.write(' - GUMP PYTHONPATH  :  ' + pythonPath + '\n')

          os.environ['PYTHONPATH']=pythonPath

  

          #

          # Update Gump from CVS

          #     

          cvsExit = 0

          if not os.environ.has_key('GUMP_NO_CVS_UPDATE'):

              cvsExit = runCommand('cvs -q update -dP')

          else:

              log.write('CVS update skipped per environment setting.\n')

          if cvsExit:

              result=1

              

          # :TODO: Is this a CVS thing, or a Gump historical thing?

          #

          if os.path.exists('.timestamp'): 

              os.remove('.timestamp')            

      

          if not result:

              #

              #

              # Process command line

              #

              args=''

              for arg in sys.argv[1:]:

                  if args: args += ' '

                  args += arg    

          

              iargs = '-w ' + workspaceName + ' ' + projectsExpr + args

    

              #

              # Run the main Gump...

              #    

              integrationExit = runCommand('python gump/integrate.py', iargs, 'python')

              if integrationExit:

                  result=1

  

              # Copy outputs (especially forrest) into log...

  

  

      except KeyboardInterrupt:    

          log.write('Terminated by user interrupt...\n')

          result = 1

      

  finally:

      # Close the log

      log.close()

      

      if 1 or result:

          # Cat log if failed...

          catFile(sys.stdout, logFile, 'The Gump log...')

  

  # bye!

  sys.exit(result)
  
  
  1.19      +4 -4      jakarta-gump/python/gump/utils/__init__.py
  
  Index: __init__.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/utils/__init__.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- __init__.py       4 Feb 2004 01:43:02 -0000       1.18
  +++ __init__.py       23 Feb 2004 15:43:06 -0000      1.19
  @@ -178,7 +178,7 @@
       print  
       print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
       print
  -    print "Copyright (C) 2003 Apache Software Foundation. All rights reserved."
  +    print "Copyright (C) 2003/2004 Apache Software Foundation. All rights reserved."
       print "See the Apache Software License 1.1 for more details."
       print "http://www.apache.org/";
       print
  
  
  
  1.2       +1 -1      jakarta-gump/python/gump/test/resulting.py
  
  Index: resulting.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/resulting.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- resulting.py      17 Feb 2004 21:54:21 -0000      1.1
  +++ resulting.py      23 Feb 2004 15:43:06 -0000      1.2
  @@ -125,7 +125,7 @@
           

           self.checkWorkspaceResult(wsr)

                   

  -        wsr.dump()

  +        #wsr.dump()

           

       def testServers(self):

       

  
  
  
  1.14      +13 -11    jakarta-gump/python/gump/output/nag.py
  
  Index: nag.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/output/nag.py,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- nag.py    17 Feb 2004 21:54:21 -0000      1.13
  +++ nag.py    23 Feb 2004 15:43:06 -0000      1.14
  @@ -282,16 +282,18 @@
           #
           toaddrs=[ toaddr ]
       
  -        #
  -        # Form the user visable part ...
  -        #
  -        email=EmailMessage( toaddrs, \
  -                            fromaddr, \
  -                            subject, \
  -                            content)       
  -                            
           try:
               
  +            #
  +            # Form the user visable part ...
  +            #
  +            email=EmailMessage( toaddrs, \
  +                                fromaddr, \
  +                                subject, \
  +                                content)       
  +              
  +            log.info('Send Nag e-mail to: ' + str(toaddr) + ' from: ' + 
str(fromaddr) + ' subject: ' + str(subject))
  +                        
               #print 
'-------------------------------------------------------------------'
               #print 'To:' + `toaddr`
               #print 'From:' + `fromaddr`
  
  
  
  1.52      +35 -4     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.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- project.py        17 Feb 2004 21:54:20 -0000      1.51
  +++ project.py        23 Feb 2004 15:43:06 -0000      1.52
  @@ -1334,7 +1334,12 @@
                                                   
   class ProjectSummary:
       """ Contains an overview """
  -    def 
__init__(self,projects=0,successes=0,failures=0,prereqs=0,noworks=0,packages=0,others=0,statepairs=None):
  +    def __init__(self,       \
  +                    projects=0,successes=0,failures=0,       \
  +                    prereqs=0,noworks=0,packages=0,  \
  +                    others=0,statepairs=None):
  +                        
  +        # Counters
           self.projects=projects
           self.successes=successes
           self.failures=failures
  @@ -1344,8 +1349,19 @@
           self.others=others
           self.statepairs=statepairs
           
  +        # Percentages
  +        self.successesPercentage=0
  +        self.failuresPercentage=0
  +        self.prereqsPercentage=0
  +        self.noworksPercentage=0
  +        self.packagesPercentage=0
  +        self.othersPercentage=0
  +        
  +        #
           if not self.statepairs: self.statepairs=[]
           
  +        self.calculatePercentages()
  +        
       def addState(self,state):            
           # Stand up and be counted
           if state.isSuccess():
  @@ -1369,6 +1385,8 @@
           if not state.isUnset() and not state in self.statepairs: \
               self.statepairs.append(state)
           
  +        self.calculatePercentages()
  +        
       def addSummary(self,summary):
                    
           self.projects += summary.projects
  @@ -1385,3 +1403,16 @@
               if not pair.isUnset() and not pair in self.statepairs: \
                   self.statepairs.append(pair)
                   
  +        self.calculatePercentages()
  +        
  +    def calculatePercentages(self):
  +    
  +        if self.projects > 0:            
  +            self.successesPercentage=round((self.successes/self.projects)*100,2)
  +            self.failuresPercentage=round((self.failures/self.projects)*100,2)
  +            self.prereqsPercentage=round((self.prereqs/self.projects)*100,2)
  +            self.noworksPercentage=round((self.noworks/self.projects)*100,2)
  +            self.packagesPercentage=round((self.packages/self.projects)*100,2)
  +            self.othersPercentage=round((self.others/self.projects)*100,2)
  +            
  +            self.overalPercentage=(round(((self.successes + 
self.packages)/self.projects)*100),2)
  
  
  
  1.1                  jakarta-gump/tracker/apache-jira.xml
  
  Index: apache-jira.xml
  ===================================================================
  <?xml version="1.0" encoding="ISO-8859-1"?>
  
  <tracker name="apache-jira" type="jira" status="up">
    <attribution>Apache</attribution>
    <title>Apache JIRA</title>
    <url>http://issues.apache.org/jira</url>
  </tracker>
  
  
  
  1.76      +9 -6      jakarta-gump/python/gump/document/forrest.py
  
  Index: forrest.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/document/forrest.py,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- forrest.py        17 Feb 2004 21:54:21 -0000      1.75
  +++ forrest.py        23 Feb 2004 15:43:06 -0000      1.76
  @@ -1418,9 +1418,12 @@
           
summaryTable=summarySection.createTable(['Projects','Successes','Failures','Prereqs',  
      \
               'No Works','Packages'])
           
  -        summaryTable.createRow([ `summary.projects`, `summary.successes`, \
  -                                `summary.failures`,  `summary.prereqs`, \
  -                                `summary.noworks`, `summary.packages`] )
  +        summaryTable.createRow([ `summary.projects`, \
  +                                `summary.successes` + ' (' + 
`summary.successesPercentage` + '%)', \
  +                                `summary.failures` + ' (' + 
`summary.failuresPercentage` + '%)',     \
  +                                `summary.prereqs` + ' (' + 
`summary.prereqsPercentage` + '%)', \
  +                                `summary.noworks` + ' (' + 
`summary.noworksPercentage` + '%)', \
  +                                `summary.packages` + ' (' + 
`summary.packagesPercentage` + '%)'] )
           
         
       def documentWorkList(self,xdocNode,workable,description='Work'):
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to