gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r961567 - in /gump/live: ./ python/gump/actor/mvnrepoproxy/proxycontrol.py python/gump/core/build/mvn.py python/gump/core/update/bzr.py python/gump/core/update/darcs.py python/gump/core/update/hg.py
Date Thu, 08 Jul 2010 03:41:33 GMT
Author: bodewig
Date: Thu Jul  8 03:41:33 2010
New Revision: 961567

URL: http://svn.apache.org/viewvc?rev=961567&view=rev
Log:
configure maven proxy mirrors in a single place

Modified:
    gump/live/   (props changed)
    gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py
    gump/live/python/gump/core/build/mvn.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 Thu Jul  8 03:41:33 2010
@@ -1 +1 @@
-/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,958915,959344,959847,960295,960297,960300,960303
+/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,958915,959344,959847,960260,960295,960297,960300,960303,961244

Modified: gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py?rev=961567&r1=961566&r2=961567&view=diff
==============================================================================
--- gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py (original)
+++ gump/live/python/gump/actor/mvnrepoproxy/proxycontrol.py Thu Jul  8 03:41:33 2010
@@ -17,6 +17,7 @@
 
 import os
 import os.path
+import tempfile
 import time
 import urllib
 
@@ -25,6 +26,17 @@ from gump.core.model.output import OUTPU
 from gump.core.run.actor import AbstractRunActor, FinalizeRunEvent, \
     InitializeRunEvent
 
+# list of tuples listing all repositories we want to mirror
+#   each tuple consists of a name, the path prefix that identifies the
+#   repository and the real repository URL without that prefix
+#   (properly escaped to be used in a Java .properties file
+PROXY_CONFIG = [
+    ('central', '/maven2', 'http\://repo1.maven.org'),
+    ('apache.snapshots', '/repo/m2-snapshot-repository',
+     'http\://people.apache.org'),
+    ('maven2-repository.dev.java.net', '/maven/2', 'http\://download.java.net')
+    ]
+
 class MvnRepositoryProxyController(AbstractRunActor):
     """
        Starts/Stops the proxy, adds artifacts to it when a project has
@@ -69,14 +81,23 @@ class MvnRepositoryProxyController(Abstr
 
     def spawnProxy(self):
         log.info('Starting mvn repository proxy')
+ 
+        propsfile = tempfile.NamedTemporaryFile(mode = 'w+',
+                                                suffix = '.properties')
+        log.info('Writing ' + propsfile.name)
+        for (_name, prefix, url) in PROXY_CONFIG:
+            propsfile.write("%s=%s\n" % (prefix, url))
+        propsfile.flush()
+
         try:
             proxyJar = os.path.join(os.environ.get('MVN_PROXY_HOME'),
                                     'repoproxy.jar')
-            log.info('Running: %s -jar %s %s'
-                     % (self.java, proxyJar, self.workspace.mvnRepoProxyPort))
+            log.info('Running: %s -jar %s %s %s'
+                     % (self.java, proxyJar, self.workspace.mvnRepoProxyPort,
+                        propsfile.name))
             # TODO emulate spawnlp on non-Unix platforms
             os.spawnlp(os.P_NOWAIT, self.java, self.java, '-jar', proxyJar,
-                       self.workspace.mvnRepoProxyPort)
+                       self.workspace.mvnRepoProxyPort, propsfile.name)
             # Hang back for a bit while the proxy starts up
             for _pWait in range(10):
                 try:
@@ -89,6 +110,7 @@ class MvnRepositoryProxyController(Abstr
                     continue
         except:
             log.error('--- Failed to start proxy', exc_info=1)
+        propsfile.close()
 
     def saveLogAndStop(self):
         proxyLogFileName = 'proxyLog.html'

Modified: gump/live/python/gump/core/build/mvn.py
URL: http://svn.apache.org/viewvc/gump/live/python/gump/core/build/mvn.py?rev=961567&r1=961566&r2=961567&view=diff
==============================================================================
--- gump/live/python/gump/core/build/mvn.py (original)
+++ gump/live/python/gump/core/build/mvn.py Thu Jul  8 03:41:33 2010
@@ -19,6 +19,7 @@
 import os.path
 
 from gump import log
+from gump.actor.mvnrepoproxy.proxycontrol import PROXY_CONFIG
 from gump.core.model.workspace import CommandWorkItem, \
     REASON_BUILD_FAILED, REASON_BUILD_TIMEDOUT, REASON_PREBUILD_FAILED, \
     STATE_FAILED, STATE_SUCCESS,  WORK_TYPE_BUILD
@@ -40,7 +41,7 @@ def write_mirror_entry(props, prefix, mi
     <mirror>
       <id>gump-%s</id>
       <name>Gump proxying %s</name>
-      <url>http://localhost:%s/%s</url>
+      <url>http://localhost:%s%s</url>
       <mirrorOf>%s</mirrorOf>
     </mirror>""" % (mirror_of, mirror_of, port, prefix, mirror_of) )
 
@@ -251,14 +252,9 @@ class Maven2Builder(RunSpecific):
                        localRepositoryDir))
         if not self.run.getEnvironment().noMvnRepoProxy:
             props.write("<mirrors>")
-            write_mirror_entry(props, 'maven2', 'central', \
-                                   self.run.getWorkspace().mvnRepoProxyPort)
-            write_mirror_entry(props, 'repo/m2-snapshot-repository', \
-                                   'apache.snapshots', \
-                                   self.run.getWorkspace().mvnRepoProxyPort)
-            write_mirror_entry(props, 'maven/2', \
-                                   'maven2-repository.dev.java.net', \
-                                   self.run.getWorkspace().mvnRepoProxyPort)
+            for (name, prefix, _url) in PROXY_CONFIG:
+                write_mirror_entry(props, prefix, name, \
+                                       self.run.getWorkspace().mvnRepoProxyPort)
             props.write("</mirrors>")
 
         props.write("</settings>")

Propchange: gump/live/python/gump/core/update/bzr.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul  8 03:41:33 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960295,960297,960300,960303
+/gump/trunk/python/gump/core/update/bzr.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244

Propchange: gump/live/python/gump/core/update/darcs.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul  8 03:41:33 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960295,960297,960300,960303
+/gump/trunk/python/gump/core/update/darcs.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244

Propchange: gump/live/python/gump/core/update/hg.py
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Jul  8 03:41:33 2010
@@ -1 +1 @@
-/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960295,960297,960300,960303
+/gump/trunk/python/gump/core/update/hg.py:815848,953630-954169,955387,955837,956771,957107,957408,958453,958915,959344,959847,960260,960295,960297,960300,960303,961244



Mime
View raw message