[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gump
Subject:    cvs commit: gump/python/gump/output nag.py statsdb.py
From:       ajack () apache ! org
Date:       2004-04-24 15:25:18
Message-ID: 20040424152518.61865.qmail () minotaur ! apache ! org
[Download RAW message or body]

ajack       2004/04/24 08:25:18

  Modified:    python/gump/model project.py
               .        gumpy.py minimal-workspace.xml
               python/gump integrate.py
               python/gump/test syndicator.py
               python/gump/core config.py engine.py
               python   gmp.py
               python/gump/output nag.py statsdb.py
  Log:
  E-mail & Result (exit code) cleanup.
  
  Revision  Changes    Path
  1.79      +3 -0      gump/python/gump/model/project.py
  
  Index: project.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/model/project.py,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- project.py	23 Apr 2004 18:09:24 -0000	1.78
  +++ project.py	24 Apr 2004 15:25:18 -0000	1.79
  @@ -303,6 +303,9 @@
               if cause and cause == self:
                   if not project in self.affectedProjects:
                       self.affectedProjects.append(project)
  +    
  +        # Sort whatever we got
  +        self.affectedProjects.sort()
           
       def propagateErrorStateChange(self,state,reason,cause,message):
           
  
  
  
  1.25      +65 -6     gump/gumpy.py
  
  Index: gumpy.py
  ===================================================================
  RCS file: /home/cvs/gump/gumpy.py,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- gumpy.py	23 Apr 2004 18:09:24 -0000	1.24
  +++ gumpy.py	24 Apr 2004 15:25:18 -0000	1.25
  @@ -94,7 +94,8 @@
                   catFile(log,outputFile)            
               os.remove(outputFile)
           
  -        log.write('Exit Code : ' + `exit_code` + '\n')
  +        if exit_code:
  +            log.write('Process Exit Code : ' + `exit_code` + '\n')
       
       finally:
           if originalCWD: os.chdir(originalCWD)
  @@ -181,7 +182,42 @@
       except:
           # Somehow another could delete this, even if locked...
           pass
  +               
  +               
  +def tailFile(file,lines,eol=None,marker=None):
  +    """ Return the last N lines of a file as a list """
  +    taillines=[]
  +    try:
  +        o=None
  +        try:
  +            # Read lines from the file...
  +            o=open(file, 'r')
  +            line=o.readline()
  +            
  +            size=0
  +            while line:      
  +                # Store the lines
  +                taillines.append(line)
  +            
  +                # But dump any before 'lines'
  +                size=len(taillines)
  +                if size > lines:
  +                    del taillines[0:(size-lines)]
  +                    size=len(taillines)
  +                    
  +                # Read next...
  +                line=o.readline()
                   
  +        finally:
  +            if o: o.close()
  +    except Exception, details:
  +        print 'Failed to tail :' + file + ' : ' + str(details)
  +                            
  +    return taillines
  +
  +def tailFileToString(file,lines,eol=None,marker=None):
  +    return "".join(tailFile(file,lines,eol,marker))
  +    
   # Allow a lock    
   lockFile=os.path.abspath('gumpy.lock')
   lock=establishLock(lockFile)        
  @@ -196,7 +232,8 @@
       pass
   
   # Enable a log
  -logFile=os.path.abspath('gumpy_log.txt')
  +logFileName='gumpy_log.txt'
  +logFile=os.path.abspath(logFileName)
   log=open(logFile,'w',0) # Unbuffered...
   
   result=0
  @@ -359,7 +396,7 @@
       releaseLock(lock,lockFile)
       
       if result:
  -        logTitle='The Apache Gump log...'
  +        logTitle='Problem running Apache Gump...'
           
           # :TODO: Need to check if stdout is a plain terminal? Not sure, see next.
           # :TODO: On some cron set-ups this will mail the log, on
  @@ -368,7 +405,7 @@
           # Cat log if failed...
           published=0
           if logdir:
  -            publishedLogFile=os.path.abspath(os.path.join(logdir,'gumpy_log.txt'))
  +            publishedLogFile=os.path.abspath(os.path.join(logdir,logFileName))
               try:
                   publishedLog=open(publishedLogFile,'w',0) # Unbuffered...
                   catFile(publishedLog, logFile, logTitle)    
  @@ -395,8 +432,30 @@
               #logData=tmpStream.read()
               #tmpStream.close()
               #tmpStream=None
  -            logData='There is a problem with the run at : ' + logurl
  -            sendEmail(mailto,mailfrom,logTitle,logData,mailserver,mailport)
  +            mailData='There is a problem with the run at : ' + logurl + '\n'
  +            
  +            #
  +            # :TODO: Add link to log 
  +            # :TODO: Tail log
  +            #
  +            try:
  +                maxTailLines=50
  +                tailData=tailFileToString(logFile,maxTailLines)           
  +                mailData += '------------------------------------------------------------\n' 
  +                mailData += 'The log ought be at:\n'
  +                mailData += '   '
  +                logFileUrl=logurl
  +                if not logFileUrl.endswith('/'): logFileUrl+='/'
  +                logFileUrl+=logFileName
  +                mailData += logFileUrl
  +                mailData += '\n'
  +                mailData += '------------------------------------------------------------\n' 
  +                mailData += 'The last (up to) %s lines of the log are :\n' % maxTailLines
  +                mailData += tailData
  +            except:
  +                pass
  +            
  +            sendEmail(mailto,mailfrom,logTitle,mailData,mailserver,mailport)
   
   # bye!
   sys.exit(result)
  
  
  
  1.4       +4 -1      gump/minimal-workspace.xml
  
  Index: minimal-workspace.xml
  ===================================================================
  RCS file: /home/cvs/gump/minimal-workspace.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- minimal-workspace.xml	16 Mar 2004 19:50:14 -0000	1.3
  +++ minimal-workspace.xml	24 Apr 2004 15:25:18 -0000	1.4
  @@ -27,7 +27,10 @@
   	and build stuff. If you use any packages available as
   	binaries only, you need to set pkgdir as well.
   -->
  -<workspace name="minimal" basedir="C:\jakarta" pkgdir="C:\opt" version="0.3">
  +<workspace name="minimal" 
  +		basedir="C:\gump" 
  +		pkgdir="C:\opt" 
  +		version="0.4">
   
   	<!-- this tells Ant to completely ignore all classpath
   	     elements in build scripts. This makes sure we build
  
  
  
  1.27      +2 -2      gump/python/gump/integrate.py
  
  Index: integrate.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/integrate.py,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- integrate.py	16 Apr 2004 17:28:38 -0000	1.26
  +++ integrate.py	24 Apr 2004 15:25:18 -0000	1.27
  @@ -81,7 +81,7 @@
       logResourceUtilization('Before exit')
       
       #
  -    log.info('Gump Integration complete. Exit code:' + str(result))                  
  +    log.info('Gump Integration complete. Exit code [0=SUCCESS] : ' + str(result))                  
             
       # bye!
       sys.exit(result)
  
  
  
  1.9       +2 -0      gump/python/gump/test/syndicator.py
  
  Index: syndicator.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/test/syndicator.py,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- syndicator.py	16 Apr 2004 17:28:35 -0000	1.8
  +++ syndicator.py	24 Apr 2004 15:25:18 -0000	1.9
  @@ -14,7 +14,9 @@
   # limitations under the License.
   
   """
  +
       Syndication Testing
  +    
   """
   
   import os
  
  
  
  1.2       +2 -2      gump/python/gump/core/config.py
  
  Index: config.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/core/config.py,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- config.py	16 Apr 2004 17:28:41 -0000	1.1
  +++ config.py	24 Apr 2004 15:25:18 -0000	1.2
  @@ -71,8 +71,8 @@
       mailserver = 'mail.apache.org'
       mailport = 25
       prefix = '[GUMP@' + gumphost + ']'
  -    signature="\r\n--\r\nGump http://gump.apache.org/\n" \
  -        + '[' + gumpfullhost + "]\n"
  +    signature="\r\n--\r\nApache Gump\nhttp://gump.apache.org/ " \
  +        + '[Instance: ' + gumpfullhost + "]\n"
           
       if not os.name == 'dos' and not os.name == 'nt':
           classpathSeparator=':'
  
  
  
  1.4       +4 -1      gump/python/gump/core/engine.py
  
  Index: engine.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/core/engine.py,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- engine.py	22 Apr 2004 22:58:16 -0000	1.3
  +++ engine.py	24 Apr 2004 15:25:18 -0000	1.4
  @@ -163,6 +163,9 @@
           if not run.getOptions().isQuick():
               workspace.writeXMLToFile(default.merge)
               workspace.setMergeFile(default.merge)
  +                 
  +        # :TODO: Put this somewhere else, and/or make it depend upon something...
  +        workspace.changeState(STATE_SUCCESS)
   
       """
       
  @@ -550,7 +553,7 @@
                   project.changeState(STATE_FAILED,REASON_PREBUILD_FAILED)
               
           if not project.okToPerformWork():
  -            log.warn('Failed to perform prebuild on project [' + project.getName() + ']')
  +            log.warn('Failed to perform pre-build on project [' + project.getName() + ']')
   
       def performPostBuild(self, run, project, repository, wasBuilt, stats):
           """Perform Post-Build Actions"""
  
  
  
  1.7       +4 -4      gump/python/gmp.py
  
  Index: gmp.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gmp.py,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- gmp.py	23 Apr 2004 18:09:24 -0000	1.6
  +++ gmp.py	24 Apr 2004 15:25:18 -0000	1.7
  @@ -118,8 +118,8 @@
           
   args=sys.argv
   try:
  -
  -        
  +    print 'Apache Gump (A multi-project builder)'
  +    
       try:
           # Process Environment
           hostname = socket.gethostname()
  @@ -131,7 +131,7 @@
           # Workspace is the `hostname`.xml or workspace.xml, 
           # unless overridden
           workspaceName = hostname + '.xml'
  -        if not os.path.abspath(workspaceName):
  +        if not os.path.exists(os.path.abspath(workspaceName)):
               workspaceName='workspace.xml'
               
           if os.environ.has_key('GUMP_WORKSPACE'):        
  
  
  
  1.35      +21 -21    gump/python/gump/output/nag.py
  
  Index: nag.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/output/nag.py,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- nag.py	23 Apr 2004 18:09:24 -0000	1.34
  +++ nag.py	24 Apr 2004 15:25:18 -0000	1.35
  @@ -210,7 +210,7 @@
       
       def nagWorkspace(self):
           """ Nag for the workspace """
  -        content=self.getGenericContent(self.workspace,'index',"There is a workspace problem... \n")
  +        content=self.getGenericContent(self.workspace,'There is a workspace problem... \n')
           
           self.sendEmail(self.workspace.mailinglist,	\
                           self.workspace.email,	\
  @@ -222,7 +222,7 @@
           #
           # Form the content...
           #
  -        content=self.getNamedTypedContent(module,'index')
  +        content=self.getNamedTypedContent(module)
                   
           #
           # Form the subject
  @@ -241,7 +241,7 @@
           #
           # Form the content...
           #
  -        content=self.getNamedTypedContent(project, project.getName() )        
  +        content=self.getNamedTypedContent(project )        
                   
           #
           # Form the subject
  @@ -333,7 +333,7 @@
               
           return sent
           
  -    def getNamedTypedContent(self,object,feedPrefix=None,message=None):
  +    def getNamedTypedContent(self,object,message=None):
           content="""To whom it may engage...
           
   This is an automated request, but not an unsolicited one. For help 
  @@ -382,11 +382,11 @@
               
                   content += '\n'            
               
  -        content += self.getGenericContent(object,feedPrefix)
  +        content += self.getGenericContent(object)
           
           return content
               
  -    def getGenericContent(self,object,feedPrefix=None,message=None):
  +    def getGenericContent(self,object,message=None):
           content=''
       
           # Optional message
  @@ -412,7 +412,7 @@
           content += "\n"
                   
           if object.annotations or object.worklist:
  -            content += ', however some snippets follow:\n'
  +            content += 'That said, some snippets follow:\n'
               
           content += '\n'
           
  @@ -420,8 +420,9 @@
           # Add an info/error/etc...
           #
           if object.annotations:
  -            content += LINE
  -            content += "\n\nGump provided these annotations:\n\n"
  +            #content += LINE
  +            content += "\n"
  +            content += "Gump provided these annotations:\n"
               for note in object.annotations:      
                   content += (' - %s - %s\n' % (levelName(note.level), note.text))
       
  @@ -430,24 +431,23 @@
           #
           if object.worklist: 
               content+="\n\n"
  -            content += LINE   
  -            content += "\nGump performed this work:\n\n"
  +            #content += LINE   
  +            content += "Gump performed this work:\n"
               for workitem in object.worklist:
                   workurl=self.run.getOptions().getResolver().getUrl(workitem)
                   content+=workurl+'\n'
  -                content+=workitem.overview()+'\n\n'   
  +                content+=workitem.overview()+'\n'   
                                   
  -        if feedPrefix:
  -            content += '\n\nTo subscribe to this information via syndicated feeds:\n'      
  +        content += '\n\nTo subscribe to this information via syndicated feeds:\n'      
               
  -            #
  -            # Link them back here...
  -            #
  -            rssurl=self.run.getOptions().getResolver().getUrl(object,feedPrefix,'.rss')
  -            atomurl=self.run.getOptions().getResolver().getUrl(object,feedPrefix,'.atom')
  +        #
  +        # Link them back here...
  +        #
  +        rssurl=self.run.getOptions().getResolver().getUrl(object,'rss','.xml')
  +        atomurl=self.run.getOptions().getResolver().getUrl(object,'atom','.xml')
               
  -            content += "RSS: " + rssurl + " | "
  -            content += "Atom: " + atomurl + '\n'         
  +        content += "RSS: " + rssurl + '\n'
  +        content += "Atom: " + atomurl + '\n'         
       
           return content
       
  
  
  
  1.25      +1 -1      gump/python/gump/output/statsdb.py
  
  Index: statsdb.py
  ===================================================================
  RCS file: /home/cvs/gump/python/gump/output/statsdb.py,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- statsdb.py	22 Apr 2004 22:58:17 -0000	1.24
  +++ statsdb.py	24 Apr 2004 15:25:18 -0000	1.25
  @@ -41,7 +41,7 @@
           self.dbpath    = os.path.abspath('%s/%s' % (dbdir,name))
           
           if not os.path.exists(self.dbpath):
  -            log.info('*New* Statistic Database:' + self.dbpath)
  +            log.info('*New* Statistics Database:' + self.dbpath)
               
           log.debug('Open Statistic Database:' + self.dbpath)
           if not os.name == 'dos' and not os.name == 'nt':
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: general-unsubscribe@gump.apache.org
For additional commands, e-mail: general-help@gump.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic