gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r958813 - in /gump/live: ./ python/gump/actor/mvnrepoproxy/ python/gump/core/model/ python/gump/core/update/
Date Tue, 29 Jun 2010 03:51:36 GMT
Author: bodewig
Date: Tue Jun 29 03:51:36 2010
New Revision: 958813

URL: http://svn.apache.org/viewvc?rev=958813&view=rev
Log:
merge a few changes from trunk: generic output and wait for proxy

Added:
    gump/live/python/gump/core/model/output.py
      - copied unchanged from r958453, gump/trunk/python/gump/core/model/output.py
Modified:
    gump/live/   (props changed)
    gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py
    gump/live/python/gump/core/model/__init__.py
    gump/live/python/gump/core/model/misc.py
    gump/live/python/gump/core/model/project.py
    gump/live/python/gump/core/update/bzr.py   (props changed)
    gump/live/python/gump/core/update/darcs.py   (props changed)
    gump/live/python/gump/core/update/hg.py   (props changed)

Propchange: gump/live/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 29 03:51:36 2010
@@ -1 +1 @@
-/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,957107,957408
+/gump/trunk:746160,746727,746892,747270,747272-747273,747656,748010,748018,748028,748661,748967,760784-761159,815848,953630-954169,955387,955837,956771,957107,957408,958453

Modified: gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py?rev=958813&r1=958812&r2=958813&view=diff
==============================================================================
--- gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py (original)
+++ gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py Tue Jun 29 03:51:36 2010
@@ -17,26 +17,27 @@
 
 import os
 import os.path
-import sys
 import time
 import urllib
 
 from gump import log
-from gump.core.run.gumprun import *
+from gump.core.model.output import OUTPUT_JAR, OUTPUT_POM
+from gump.core.run.actor import AbstractRunActor, FinalizeRunEvent, \
+    InitializeRunEvent
 
-class MvnRepositoryProxyController(gump.core.run.actor.AbstractRunActor):
+class MvnRepositoryProxyController(AbstractRunActor):
     """
        Starts/Stops the proxy, adds artifacts to it when a project has
        been built, collects the results.
     """
 
-    def __init__(self, run, javaCommand='java'):
-        gump.core.run.actor.AbstractRunActor.__init__(self, run)
+    def __init__(self, run, javaCommand = 'java'):
+        AbstractRunActor.__init__(self, run)
         self.proxyURL = "http://localhost:%s/" \
             % (run.getWorkspace().mvnRepoProxyPort)
         self.java = javaCommand
 
-    def processProject(self,project):
+    def processProject(self, project):
         """
         Process a project (i.e. publish it's artifacts to the proxy)
         """
@@ -44,13 +45,16 @@ class MvnRepositoryProxyController(gump.
         if project.okToPerformWork() and project.hasOutputs():
             groupId = project.getArtifactGroup()
             for output in project.getOutputs():
-                fileName = os.path.abspath(output.getPath())
-                try:
-                    log.info('Publishing \'%s\' to proxy' % (fileName))
-                    self.publish(groupId, output.getId(), fileName)
-                except:
-                    log.error('Failed to publish \'%s\' to proxy' % (fileName),
-                              exc_info=1)
+                if output.getType() == OUTPUT_JAR \
+                        or output.getType() == OUTPUT_POM:
+                    fileName = os.path.abspath(output.getPath())
+                    try:
+                        log.info('Publishing \'%s\' output \'%s\' to proxy'
+                                 % (output.getType(), fileName))
+                        self.publish(groupId, output.getId(), fileName)
+                    except:
+                        log.error('Failed to publish \'%s\' to proxy' %
+                                  (fileName), exc_info = 1)
 
     def processOtherEvent(self, event):
         if isinstance(event, InitializeRunEvent):
@@ -74,6 +78,16 @@ class MvnRepositoryProxyController(gump.
             # TODO emulate spawnlp on non-Unix platforms
             os.spawnlp(os.P_NOWAIT, self.java, self.java, '-jar', proxyJar,
                        self.workspace.mvnRepoProxyPort)
+            # Hang back for a bit while the proxy starts up
+            for _pWait in range(10):
+                try:
+                    urllib.urlopen(self.proxyURL)
+                    # Not reached until urlopen succeeds
+                    log.info('mvn Repository proxy started')
+                    break
+                except IOError:
+                    time.sleep(1)
+                    continue
         except:
             log.error('--- Failed to start proxy', exc_info=1)
 
@@ -86,13 +100,14 @@ class MvnRepositoryProxyController(gump.
             proxyLogContent = proxyLogRequest.read()
             proxyLogRequest.close()
             # TODO xdocs-Documenter is hard-coded here
-            proxyLogFile = open(os.path.join(os.path.join(self.workspace.getBaseDirectory(),
-                                                     'xdocs-work'),
-                                             proxyLogFileName), 'w')
+            proxyLogFile = open(os.path.join(
+                    os.path.join(self.workspace.getBaseDirectory(),
+                                 'xdocs-work'),
+                    proxyLogFileName), 'w')
             proxyLogFile.write(proxyLogContent)
-            proxyLogFile.close();
+            proxyLogFile.close()
         except:
-            log.error('--- Failed to store ' + proxyLogFileName, exc_info=1)
+            log.error('--- Failed to store ' + proxyLogFileName, exc_info = 1)
 
         log.info('Stopping mvn repository proxy')
         try:
@@ -100,4 +115,4 @@ class MvnRepositoryProxyController(gump.
             # allow Java process to stop before the Python process terminates
             time.sleep(5)
         except:
-            log.error('--- Failed to stop proxy', exc_info=1)
+            log.error('--- Failed to stop proxy', exc_info = 1)

Modified: gump/live/python/gump/core/model/__init__.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/model/__init__.py?rev=958813&r1=958812&r2=958813&view=diff
==============================================================================
--- gump/live/python/gump/core/model/__init__.py (original)
+++ gump/live/python/gump/core/model/__init__.py Tue Jun 29 03:51:36 2010
@@ -41,7 +41,7 @@
 ###############################################################################
 
 # tell Python what modules make up the gump.core.model package
-__all__ = ["misc","state", \
+__all__ = ["misc","state", "output", \
     "object","project","module","workspace","repository", \
     "builder","profile",]
 

Modified: gump/live/python/gump/core/model/misc.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/model/misc.py?rev=958813&r1=958812&r2=958813&view=diff
==============================================================================
--- gump/live/python/gump/core/model/misc.py (original)
+++ gump/live/python/gump/core/model/misc.py Tue Jun 29 03:51:36 2010
@@ -18,261 +18,210 @@
 """
 
     This module contains miscellaneous model objects
-    
+
 """
 
-from time import localtime, strftime, tzname
-from string import lower, capitalize
+import os
 
-#from gump.util.note import *
-#from gump.util.work import *
-#from gump.util.file import *
-#from gump.util.owner import *
-from gump.util.domutils import *
-from gump.core.model.object import *
+from gump.core.model.object import NamedModelObject, ModelObject
 
 class Positioned:
     def __init__(self): 
-        self.posn=-1
-        self.total=-1
-        
-    def setPosition(self,posn):
+        self.posn = -1
+        self.total = -1
+
+    def setPosition(self, posn):
         """ Set this object's position (within some sequence) """
-        self.posn=posn
-        
-    def setTotal(self,total):
-        """ Set the total length of sequence """    
-        self.total=total
+        self.posn = posn
+
+    def setTotal(self, total):
+        """ Set the total length of sequence """
+        self.total = total
 
     def getPosition(self):
-        """ Return either a tuple or a position, dependent upon if total is set. Mainly for
presentation in ``. """
+        """ Return either a tuple or a position, dependent upon if
+        total is set. Mainly for presentation in ``. """
         if -1 != self.total:
-            return (self.posn,self.total)
+            return (self.posn, self.total)
         if -1 != self.posn:
             return self.posn
-            
+
     def getPositionIndex(self):
         """ Get index in sequence """
         return self.posn
-          
+
 class Resultable:
     def __init__(self): 
         pass
-    
-    # Stats are loaded separately and cached on here,
+
+    # Stats are loaded separately and cached on here, 
     # hence they may exist on an object at all times.
     def hasServerResults(self):
-        return hasattr(self,'serverResults')
-        
-    def setServerResults(self,serverResults):
-        self.serverResults=serverResults
-        
+        return hasattr(self, 'serverResults')
+
+    def setServerResults(self, serverResults):
+        self.serverResults = serverResults
+
     def getServerResults(self):
         if not self.hasServerResults():
             raise RuntimeError, "ServerResults not available [yet]: " \
                     + self.getName()
         return self.serverResults
-        
-    
-    # Stats are loaded separately and cached on here,
+
+
+    # Stats are loaded separately and cached on here, 
     # hence they may exist on an object at all times.
     def hasResults(self):
-        return hasattr(self,'results')
-        
-    def setResults(self,results):
-        self.results=results
-        
+        return hasattr(self, 'results')
+
+    def setResults(self, results):
+        self.results = results
+
     def getResults(self):
         if not self.hasResults():
             raise RuntimeError, "Results not available [yet]: " \
                     + self.getName()
         return self.results
-        
-        
-        
-# represents a <nag/> element
-class Nag(ModelObject):
-    def __init__(self,toaddr,fromaddr):
-    	ModelObject.__init__(self,xml,workspace)
-
-# represents a <javadoc/> element
-class Javadoc(ModelObject): pass
-      
-# represents a <description/> element
-class Description(ModelObject): pass
-
-# represents a <home/> element
-class Home(ModelObject): pass
-
-# represents an <output/> element
-class BaseOutput(NamedModelObject):
-    def __init__(self,name,dom,owner):
-        NamedModelObject.__init__(self,name,dom,owner)
-        self.id=''
-        self.type=''
-        
-    def setPath(self,path):
-        self.path=path
-    
-    def getPath(self):
-        return self.path;
-        
-    def hasId(self):
-        if self.id: return True
-        return False
-        
-    def setId(self,id):
-        self.id = id
-        
-    def getId(self):
-        return self.id
-        
-    def getType(self):
-        return self.type
-        
-# represents a <jar/> element
-class Jar(BaseOutput): 
-    """ Represents a <jar/> element."""
-    pass
-    
-class Assembly(BaseOutput): 
-    """ Represents an <assembly/> element."""
-    pass
 
 class Resolvable(ModelObject):
     """
-    A ModelObject that can be resolved relative to it's owning model or workspace
-    e.g. JUnitReport or Work
+    A ModelObject that can be resolved relative to it's owning model
+    or workspace e.g. JUnitReport or Work
     """
-    def __init__(self,dom,owner):
-        ModelObject.__init__(self,dom,owner)     
-        self.path=None           
-        
+    def __init__(self, dom, owner):
+        ModelObject.__init__(self, dom, owner)
+        self.path = None
+
     def complete(self):
-        if self.isComplete(): return     
-        
-        
+        if self.isComplete():
+            return
+
+
         if self.hasDomAttribute('nested'):
-            self.path=os.path.abspath(
-                    os.path.join(    self.owner.getModule().getWorkingDirectory(),
-                                    self.getDomAttributeValue('nested')))
+            self.path = os.path.abspath(
+                os.path.join(self.owner.getModule().getWorkingDirectory(), 
+                             self.getDomAttributeValue('nested')))
         elif self.hasDomAttribute('parent'):
-            self.path=os.path.abspath(
-                    os.path.join(self.owner.getWorkspace().getBaseDirectory(),
-                                 self.getDomAttributeValue('parent')))
-                                 
+            self.path = os.path.abspath(
+                os.path.join(self.owner.getWorkspace().getBaseDirectory(), 
+                             self.getDomAttributeValue('parent')))
+
         # Done, don't redo
-        self.setComplete(True)    
-        
-    def getResolvedPath(self):  
+        self.setComplete(True)
+
+    def getResolvedPath(self):
         return self.path
-              
+
 # represents a <junitreport/> element
 class JunitReport(Resolvable):
-    def __init__(self,dom,owner):
-        Resolvable.__init__(self,dom,owner)    
-   
+    def __init__(self, dom, owner):
+        Resolvable.__init__(self, dom, owner)
+
  
 # represents a <work/> element
 class Work(Resolvable): 
-    def __init__(self,dom,owner):
-        Resolvable.__init__(self,dom,owner)    
-        
+    def __init__(self, dom, owner):
+        Resolvable.__init__(self, dom, owner)
+
 class DirResolvable(ModelObject):
     """
-    	Common code for getting a directory (attribute) and
-    	returning that as a path relative to the 
+        Common code for getting a directory (attribute) and
+        returning that as a path relative to the 
     """
-    def __init__(self,dom,owner):
-        ModelObject.__init__(self,dom,owner)   
-        self.dir=None        
-                
+    def __init__(self, dom, owner):
+        ModelObject.__init__(self, dom, owner)
+        self.dir = None
+
     def complete(self):
-        if self.isComplete(): return     
-        
+        if self.isComplete():
+            return
+
         if self.hasDomAttribute('dir'):
-            dirString=self.getDomAttributeValue('dir')
-            
+            dirString = self.getDomAttributeValue('dir')
+
             # Security attempt
             # :TODO: Move to a one-time check
             if '..' in dirString:
                 self.owner.addError('Bad directory attribute %s on <%s' % \
                                     dirString, self.__class__.__name__)
-                dirString='bogus'
-            
-            self.dir=os.path.abspath(
-                        os.path.join( self.owner.getModule().getWorkingDirectory(),
-                                        dirString))
-        
+                dirString = 'bogus'
+
+            self.dir = os.path.abspath(
+                os.path.join(self.owner.getModule().getWorkingDirectory(), 
+                              dirString))
+
         # Done, don't redo
-        self.setComplete(True)    
+        self.setComplete(True)
 
     def hasDirectory(self):
         """
         Does it have a directory?
         """
-        if self.dir: return True
+        if self.dir:
+            return True
         return False
-                
-    def getDirectory(self):  
+
+    def getDirectory(self):
         """ 
         Get the directory. 
         """
         return self.dir
-        
-        
+
+
 # represents a <mkdir/> element
 class Mkdir(DirResolvable):
-    def __init__(self,dom,owner):
-        DirResolvable.__init__(self,dom,owner) 
-        
+    def __init__(self, dom, owner):
+        DirResolvable.__init__(self, dom, owner) 
+
 # represents a <delete/> element
 class Delete(DirResolvable): 
-    def __init__(self,dom,owner):
-        DirResolvable.__init__(self,dom,owner)    
-        self.file=None
-        
+    def __init__(self, dom, owner):
+        DirResolvable.__init__(self, dom, owner)
+        self.file = None
+
     def complete(self):
-        if self.isComplete(): return    
-        
+        if self.isComplete():
+            return
+
         DirResolvable.complete(self)
-      
+
         if self.hasDomAttribute('file'):
-            file=self.getDomAttributeValue('file')
-            
+            file = self.getDomAttributeValue('file')
+
             # Security attempt
             # :TODO: Move to a one-time check
             if '..' in file:
                 self.owner.addError('Bad file attribute %s on <%s' % \
                                     file, self.__class__.__name__)
-                file='bogus'
-                        
-            self.file=os.path.abspath(
-                        os.path.join( self.owner.getModule().getWorkingDirectory(),
-                                        file))
-        
+                file = 'bogus'
+
+            self.file = os.path.abspath(
+                os.path.join(self.owner.getModule().getWorkingDirectory(), 
+                             file))
+
         # Done, don't redo
-        self.setComplete(True)    
-        
+        self.setComplete(True)
+
     def hasFile(self):
-        if self.file: return True
+        if self.file:
+            return True
         return False
-        
-    def getFile(self):  
+
+    def getFile(self):
         return self.file 
-        
+
 class AddressPair:
-    def __init__(self,toAddr,fromAddr):
-        self.toAddr=toAddr
-        self.fromAddr=fromAddr
-        
+    def __init__(self, toAddr, fromAddr):
+        self.toAddr = toAddr
+        self.fromAddr = fromAddr
+
     def __str__(self):
         return '[To:' + self.toAddr + ', From:' + self.fromAddr + ']'
-        
+
     def getToAddress(self):
         return self.toAddr
-        
+
     def getFromAddress(self):
         return self.fromAddr
-        
-        
+
+

Modified: gump/live/python/gump/core/model/project.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/model/project.py?rev=958813&r1=958812&r2=958813&view=diff
==============================================================================
--- gump/live/python/gump/core/model/project.py (original)
+++ gump/live/python/gump/core/model/project.py Tue Jun 29 03:51:36 2010
@@ -31,10 +31,10 @@ from gump.core.config import default
 from gump.core.model.builder import Ant, NAnt, Maven, Maven2, Script, \
     Configure, Make
 from gump.core.model.depend import Dependable, importDomDependency
-from gump.core.model.misc import Jar, Assembly, BaseOutput, \
-    Resultable, Positioned, Mkdir, Delete, JunitReport, Work, \
-    AddressPair
+from gump.core.model.misc import AddressPair, \
+    Resultable, Positioned, Mkdir, Delete, JunitReport, Work
 from gump.core.model.object import NamedModelObject
+from gump.core.model.output import Output
 from gump.core.model.state import REASON_CONFIG_FAILED, STATE_FAILED, \
     STATE_PREREQ_FAILED, REASON_MISSING_OUTPUTS
 from gump.core.model.stats import Statable, Statistics
@@ -105,7 +105,7 @@ class Project(NamedModelObject, Statable
         self.packageNames = None
 
         #############################################################
-        # Outputs (Jars, Assemblies)
+        # Outputs (like jars, assemblies, poms ...)
         #
         self.outputs = {}
         self.outputs_expanded = False
@@ -519,8 +519,9 @@ class Project(NamedModelObject, Statable
                 self.home = os.path.abspath(
                     os.path.join(workspace.getBaseDirectory(), parent))
             else:
-                message = ('Unable to complete project.home for %s [not nested/parent] :
%s') \
-                            % (self.name, home)
+                message = ('Unable to complete project.home for %s' +
+                           ' [not nested/parent] : %s') \
+                           % (self.name, home)
                 self.addError(message)
                 log.warning(message)
                 self.home = None
@@ -555,28 +556,30 @@ class Project(NamedModelObject, Statable
                 self.addError('Missing \'name\' on <license')
 
         #
-        # Resolve jars/assemblies/outputs
+        # Resolve outputs
         #
-        outputTypes = {'jar' : Jar,
-                       'assembly' : Assembly,
-                       'output' : BaseOutput}
+        outputTypes = ['jar',
+                       'assembly',
+                       'output',
+                       'pom']
 
-        for (tag, clazz) in outputTypes.iteritems():
+        for tag in outputTypes:
             for tdom in self.getDomChildIterator(tag):
-                name = self.expandVariables(
-                        getDomAttributeValue(tdom, 'name'))
+                name = self.expandVariables(getDomAttributeValue(tdom, 'name'))
 
                 if self.home and name:
-                    output = clazz(name, tdom, self)
+                    output = Output(name, tdom, self)
                     output.complete()
                     output.setPath(os.path.abspath(os.path.join(self.home,
                                                                 name)))
+                    if not output.getType() and tag != 'output':
+                        output.setType(tag)
                     self.addOutput(output)
                 else:
                     self.addError('Missing \'name\' on <' + tag)
 
 
-        # Fix 'ids' on all Jars/Assemblies/Outputs which don't have them
+        # Fix 'ids' on all outputs which don't have them
         if self.hasOutputs():
             if 1 == self.getOutputCount():
                 output = self.getOutputAt(0)
@@ -602,8 +605,8 @@ class Project(NamedModelObject, Statable
                             newId = newId[:reduction]
                         # Assign...
                         self.addDebug('Output [' + basename + \
-                                          '] identifier set to output basename: [' \
-                                          + newId + ']')
+                                          '] identifier set to output ' + \
+                                          'basename: [' + newId + ']')
                         output.setId(newId)
 
         # Grab all the work
@@ -662,13 +665,14 @@ class Project(NamedModelObject, Statable
                     for circProject in new_visited:
                         circProject.changeState(STATE_FAILED, 
                                                 REASON_CONFIG_FAILED)
-                        circProject.addError("Circular Dependency. Path: %s -> %s." %
\
-                                                (new_visited, 
-                                                 depProject.getName()))
-
-                    self.addError("Dependency broken, removing dependency on %s from %s."
% \
-                                                (depProject.getName(), 
-                                                 self.getName()))
+                        circProject.addError("Circular Dependency. Path: " + \
+                                                 "%s -> %s." % \
+                                                 (new_visited,
+                                                  depProject.getName()))
+
+                    self.addError("Dependency broken, removing dependency " + \
+                                      "on %s from %s." % \
+                                      (depProject.getName(), self.getName()))
 
                     removes.append(dependency)
                 else:
@@ -720,9 +724,11 @@ class Project(NamedModelObject, Statable
 
                 for badOpt in badOptions:
                     (xmloption, reason) = badOpt
-                    self.addWarning("Bad *Optional* Dependency. Project: %s : %s" \
-                            % (getDomAttributeValue(xmloption, 'project'), 
-                               reason))
+                    self.addWarning("Bad *Optional* Dependency. " + \
+                                        "Project: %s : %s" \
+                                        % (getDomAttributeValue(xmloption,
+                                                                'project'), 
+                                           reason))
         else:
             self.addInfo("This is a packaged project, location: " + self.home)
 

Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 29 03:51:36 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,957107,957408
+/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453

Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 29 03:51:36 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,957107,957408
+/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453

Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 29 03:51:36 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,957107,957408
+/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453



Mime
View raw message