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/model project.py
Date Fri, 13 Feb 2004 22:12:38 GMT
ajack       2004/02/13 14:12:38

  Modified:    python/gump engine.py integrate.py
               python/gump/test pyunit.py utils.py
               python/gump/net mailer.py
               python/gump/output nag.py repository.py
               python/gump/model project.py
  Log:
  1) Work on naggng (there were/are some mail failures).
  2) First crack at http://nagoya.apache.org/jira/secure/ViewIssue.jspa?key=GUMP-15
  
  Revision  Changes    Path
  1.56      +34 -3     jakarta-gump/python/gump/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/engine.py,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- engine.py	11 Feb 2004 23:35:54 -0000	1.55
  +++ engine.py	13 Feb 2004 22:12:37 -0000	1.56
  @@ -522,6 +522,9 @@
   
           if project.okToPerformWork():
               if project.hasOutputs():
  +                #
  +                # Ensure the output were all generated correctly.
  +                #
                   outputsOk=1
                   for jar in project.getJars():
                       jarPath=os.path.abspath(jar.getPath())
  @@ -531,17 +534,45 @@
                           project.addError("Missing Output: " + str(jarPath))
                               
                   if outputsOk: 
  +                    # Publish them all (if distributable)
  +                    # :TODO: check for distributable...
                       for jar in project.getJars():
                           jarPath=os.path.abspath(jar.getPath())
                           # Copy to repository
  -                        repository.publish( project.getModule().getName(), jarPath )
  -            
  +                        try:
  +                            repository.publish( project.getModule().getName(), jarPath
)           
  +                        except Exception, details:
  +                            message='Failed to publish [' + jarPath + '] to repository
: ' + str(details)
  +                            project.addError(message)
  +                            log.error(message)
  +                        
  +                    # If we have a <license name='...
  +                    if project.hasLicense():
  +                        licensePath=os.path.abspath(	\
  +                                        os.path.join( project.getModule().getSourceDirectory(),
\
  +                                                project.getLicense() ) )
  +                                                  
  +                        if not os.path.exists(licensePath):
  +                            project.changeState(STATE_FAILED,REASON_MISSING_OUTPUTS)
  +                            outputsOk=0
  +                            project.addError("Missing License Output: " + str(licensePath))
  +                        else                      
  +                            try:
  +                                repository.publish( project.getModule().getName(), licensePath
)            
  +                            except Exception, details:
  +                                message='Failed to publish license [' + licensePath + ']
to repository : ' + str(details)
  +                                project.addError(message)
  +                                log.error(message)                     
  +                    else:
  +                        project.addWarning('No license on project with outputs.')     
                                  
  +                                    
                       project.changeState(STATE_SUCCESS)
                       
                       # For 'fun' list repository
                       listDirectoryAsWork(project,repository.getGroupDir(project.getModule().getName()),
\
                                           'list_repo_'+project.getName())               
     
  -                else:
  +                                        
  +                if not outputsOk:
                       #
                       # List all directories that should've contained
                       # outputs, to see what is there.
  
  
  
  1.19      +61 -0     jakarta-gump/python/gump/integrate.py
  
  Index: integrate.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/integrate.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- integrate.py	9 Jan 2004 19:57:19 -0000	1.18
  +++ integrate.py	13 Feb 2004 22:12:37 -0000	1.19
  @@ -1,4 +1,65 @@
   #!/usr/bin/python
  +#!/usr/bin/env python
  +#
  +# $Header$
  +# $Revision$
  +# $Date$
  +#
  +# ====================================================================
  +#
  +# 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/>.
  +
  +
   """
     This is the commandline entrypoint into gump.
   
  
  
  
  1.19      +4 -4      jakarta-gump/python/gump/test/pyunit.py
  
  Index: pyunit.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/pyunit.py,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- pyunit.py	28 Jan 2004 00:13:39 -0000	1.18
  +++ pyunit.py	13 Feb 2004 22:12:37 -0000	1.19
  @@ -306,7 +306,7 @@
               log.info('No Problems Detected')
           
           if problems:   sys.exit(1)
  -        sys.exit()
  +        sys.exit(0)
                       
   if __name__=='__main__':
       
  
  
  
  1.4       +1 -0      jakarta-gump/python/gump/test/utils.py
  
  Index: utils.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/test/utils.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- utils.py	9 Jan 2004 19:57:19 -0000	1.3
  +++ utils.py	13 Feb 2004 22:12:37 -0000	1.4
  @@ -1,4 +1,5 @@
   #!/usr/bin/env python
  +#
   # $Header$
   # $Revision$
   # $Date$
  
  
  
  1.6       +6 -9      jakarta-gump/python/gump/net/mailer.py
  
  Index: mailer.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/net/mailer.py,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- mailer.py	4 Feb 2004 01:43:02 -0000	1.5
  +++ mailer.py	13 Feb 2004 22:12:37 -0000	1.6
  @@ -99,7 +99,7 @@
           """E-mail"""
           # Add the From: and To: headers at the start!
           data = ("Date: %s\r\nFrom: %s\r\nTo: %s\r\nSubject: %s\r\n\r\n%s%s"
  -           	% (	time.strftime('%d %b %y %H:%M:%S'),
  +           	% (	time.strftime('%d %b %y %H:%M:%S', time.gmtime()),
              	    self.fromaddr, 
              		string.join(self.toaddrs, ", "),
                   self.subject,
  @@ -140,12 +140,9 @@
           server.quit()
           
       except Exception, details:
  -        log.error("Failed to send e-mail: " + str(details))
  -        log.error("Server :" + str(server))
  -        log.error("From   :" + str(fromaddr))
  -        log.error("To     :" + str(toaddrs))
  -        log.error("------------------------------------------------------")
  +        log.error('Failed to send e-mail: ' + str(details))
           log.error(data, exc_info=1)
  +        log.error('Server :' + str(server) + ' From   :' + str(fromaddr) + ' To     :'
+ str(toaddrs))
       
   def sanitizeAddress(addr):
       parts=addr.split('<')
  
  
  
  1.11      +60 -43    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- nag.py	12 Feb 2004 00:24:16 -0000	1.10
  +++ nag.py	13 Feb 2004 22:12:37 -0000	1.11
  @@ -78,7 +78,7 @@
   from gump.net.mailer import *
   from gump.utils import *
   
  -LINE='- - - - ----------------------------------------- G U M P Y\n'
  +LINE='-  -  -  -  - -- -- ------------------------------------ G U M P'
   
   class AddressPair:
       def __init__(self,toAddr,fromAddr):
  @@ -115,7 +115,7 @@
       
           # A bit paranoid, ought just rely upon object being
           # destroyed,
  -        self.sent=''
  +        self.unsent=''
           self.unwanted=''
               
           #
  @@ -152,27 +152,33 @@
                   
           # Belt and braces (nag to us if not nag to them)
           if self.unwanted:
  +            log.info('Got some unwanted\'s to send to list...')
               self.sendEmail(self.workspace.mailinglist,self.workspace.email,	\
                           'All dressed up, with nowhere to go...',self.unwanted)
                           
               # A bit paranoid, ought just rely upon object being
               # destroyed,
  -            self.unwanted=''            
  +            self.unwanted=''      
  +        else:
  +            log.debug('No unwanted nags.')
                   
           # Belt and braces (nag to us if not nag to them)
  -        if self.sent:
  +        if self.unsent:
  +            log.info('Got some unsented\'s to send to list...')    
               self.sendEmail(self.workspace.mailinglist,self.workspace.email,	\
                           'Unable to send...',self.unsent)
                           
               # A bit paranoid, ought just rely upon object being
               # destroyed,
  -            self.sent=''
  +            self.unsent=''
  +        else:
  +            log.debug('No unsent nags.')
                   
       def addUnwanted(self,subject,content):
           self.addStuff(self.unwanted,subject,content)
       
       def addUnsent(self,subject,content):
  -        self.addStuff(self.sent,subject,content)
  +        self.addStuff(self.unsent,subject,content)
       
       def addStuff(self,store,subject,content):
           if store:
  @@ -192,12 +198,11 @@
       
       def nagModule(self,module):
           """ Nag to a specific module's <nag entry """
  -        content=''
  -    
  +        
           #
           # Form the content...
           #
  -        content+=self.getNamedTypedContent(module,'index')
  +        content=self.getNamedTypedContent(module,'index')
                   
           #
           # Form the subject
  @@ -211,22 +216,12 @@
       
       def nagProject(self,project):
           """ Nag to a specific project's <nag entry """
  -        content=''
  -    
           module=project.getModule()
       
           #
           # Form the content...
           #
  -        displayedModule=0
  -        displayedProject=0
  -        if not module.isSuccess():
  -            displayedModule=1
  -            content+=self.getNamedTypedContent(module,'index')
  -        
  -        if not project.isSuccess():
  -            displayedProject=1    
  -            content+=self.getNamedTypedContent(project, project.getName() )        
  +        content=self.getNamedTypedContent(project, project.getName() )        
                   
           #
           # Form the subject
  @@ -246,8 +241,13 @@
               # Determine where to send
               #
               toaddr=getattr(nagEntry,'to',self.workspace.mailinglist)
  -            fromaddr=getattr(nagEntry,'from',self.workspace.email)      
  -                  
  +            fromaddr=getattr(nagEntry,'from',self.workspace.email)   
  +            
  +            # Somewhat bogus, but (I think) due to how the XML
  +            # objects never admit to not having something
  +            if not toaddr: toaddr =    self.workspace.mailinglist
  +            if not fromaddr : fromaddr =  self.workspace.email
  +                
               nags.append(AddressPair(toaddr,fromaddr))  
   
           return nags
  @@ -259,6 +259,10 @@
                   self.sendEmail(pair.getToAddress(), pair.getFromAddress(),	\
                                   subject, content)
           else:
  +            #
  +            # This is a catch-all, for all project that
  +            # don't have <nag's assigned.
  +            #
               self.addUnwanted(subject,content)
                       
       def sendEmail(self, toaddr, fromaddr, subject, content):
  @@ -289,28 +293,38 @@
                   self.workspace.mailport) 
               
           except Exception, details:
  -            log.error("Failed to send nag e-mail: " + str(details), \
  +            log.error('Failed to send nag e-mail ['+str(toaddr)+'] ['+str(fromaddr)+']:
' + str(details), \
                           exc_info=1)
                           
  -            self.addUnsent(subject,content)
  -                
  +            self.addUnsent(subject,content)                
               
       def getNamedTypedContent(self,object,feedPrefix=None,message=None):
  -        content='To whom is may concern,\n\nThis is an automated request, but not an unsolicited
one. Please see: http://jakarta.apache.org/gump/nagged.html\n\n'
  +        content="""To whom it may engage...
  +        
  +This is an automated request, but not an unsolicited one. For help understanding the request
please visit http://jakarta.apache.org/gump/nagged.html
  +and/or contact gump@jakarta.apache.org.
  +
  +"""
       
  +        # Get our facts straight.
           name=object.getName()
           type=object.__class__.__name__
           affected=object.determineAffected()
  +        duration=object.getStats().sequenceInState
           
           # Optional message
           if message:
               content+=message             
               
  -        content += type + ': ' + name + ' has an issue affecting it\'s community integration.'
  +        content += type + ' ' + name + ' has an issue affecting it\'s community integration'
  +                
           if affected:
  -            content += ' This issue affects ' + `affected` + ' projects.\n'
  -        else:
  -            content += '\n'
  +            content += '. This issue affects ' + `affected` + ' projects'
  +            
  +        if duration and duration > 1:
  +            content += ', and has been outstanding for ' + `duration` + ' runs'
  +        
  +        content += '.\n'
               
           content += self.getGenericContent(object,feedPrefix)
           
  @@ -326,18 +340,23 @@
           #
           # Add State (and reason)
           #
  -        content += "State: " + object.getStateDescription()
  +        content += 'The current state is \'' + object.getStateDescription() + '\''
       
  -        if not object.hasReason():
  -            content +=  ', Reason: ' + object.getReasonDescription() + '\n'
  -        else:
  -            content += '\n'
  +        if object.hasReason():
  +            content +=  ', for reason ' + object.getReasonDescription() + '\''
  +        
  +        content += '\n'
                                    
           #
           # Link them back here...
           #
           url=self.run.getOptions().getResolver().getUrl(object)
  -        content += "\nThe URL for full details is: " + url + "\n"
  +        content += "\nFull details are available at: " + url 
  +        
  +        
  +        if object.annotations or object.worklist:
  +            content += ', however some snippets follow:\n'
  +            
           content += '\n'
           
           #
  @@ -358,11 +377,9 @@
               content += "\nGump performed this work:\n\n"
               for workitem in object.worklist:
                   content+=workitem.overview()+'\n\n'   
  -                
  -                
  -    
  +                                
           if feedPrefix:
  -            content += '\n\nTo subscribe to this information via syndication:\n'      
  +            content += '\n\nTo subscribe to this information via syndicated feeds:\n' 
    
               
               #
               # Link them back here...
  
  
  
  1.4       +10 -7     jakarta-gump/python/gump/output/repository.py
  
  Index: repository.py
  ===================================================================
  RCS file: /home/cvs/jakarta-gump/python/gump/output/repository.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- repository.py	9 Jan 2004 19:57:18 -0000	1.3
  +++ repository.py	13 Feb 2004 22:12:37 -0000	1.4
  @@ -106,13 +106,16 @@
           if not os.path.exists(jdir): os.mkdir(jdir)
           return jdir  
           
  -    def publish(self,group,jar):
  +    def publish(self,group,artefact):
  +        
  +        # Locate (and make if needed) group.
           cdir=self.getGroupDir(group)
  -        jarname=os.path.basename(jar)
  -        newjar=os.path.join(cdir,jarname)
  -        try:
  -            copyfile(jar,newjar)
  -        except Exception, details:
  -            log.error('Failed to copy [' + str(jar) + '] to [' + str(newjar) + '] : ' +
str(details))
  +        
  +        # Extract name, to make relative to group
  +        artefactName=os.path.basename(artefact)
  +        newArtefact=os.path.join(cdir,artefactName)
  +        
  +        # Do the transfer..
  +        copyfile(artefact,newArtefact)
           
     
  
  
  
  1.50      +17 -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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- project.py	11 Feb 2004 23:35:54 -0000	1.49
  +++ project.py	13 Feb 2004 22:12:38 -0000	1.50
  @@ -190,6 +190,8 @@
       	self.home=None
       	self.basedir=None
       	
  +    	self.license=None
  +    	
       	#############################################################
       	# Dependency Trees
       	#
  @@ -272,6 +274,13 @@
       def hasJarWithId(self,id):
           return self.jars.has_key(id)
           
  +    def hasLicense(self):
  +        if self.license: return 1
  +        return 0
  +        
  +    def getLicense(self):
  +        return self.license
  +        
       def hasJars(self):
           return self.jars
           
  @@ -471,6 +480,10 @@
               self.addError(message)
               self.home=None
   
  +        # Extract license 
  +        if self.xml.license and self.xml.license.name:
  +            self.license = self.xml.license.name
  +        
           #
           # Resolve jars (outputs)
           #
  @@ -1090,7 +1103,7 @@
       # Does this project generate outputs (currently JARs)
       #                  
       def hasOutputs(self):
  -        return self.hasJars()
  +        return self.hasJars() or self.hasLicense()
       
       #
       # Return a (classpath, bootclaspath) tuple for this project
  
  
  

Mime
View raw message