Return-Path: Delivered-To: apmail-gump-commits-archive@www.apache.org Received: (qmail 50218 invoked from network); 7 Jul 2010 04:58:58 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 7 Jul 2010 04:58:58 -0000 Received: (qmail 73215 invoked by uid 500); 7 Jul 2010 04:58:57 -0000 Mailing-List: contact commits-help@gump.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: general@gump.apache.org Delivered-To: mailing list commits@gump.apache.org Received: (qmail 73208 invoked by uid 99); 7 Jul 2010 04:58:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jul 2010 04:58:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 07 Jul 2010 04:58:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 0D81523888A6; Wed, 7 Jul 2010 04:58:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r961244 - in /gump/trunk/python/gump: actor/mvnrepoproxy/proxycontrol.py core/build/mvn.py Date: Wed, 07 Jul 2010 04:58:00 -0000 To: commits@gump.apache.org From: bodewig@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100707045801.0D81523888A6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bodewig Date: Wed Jul 7 04:58:00 2010 New Revision: 961244 URL: http://svn.apache.org/viewvc?rev=961244&view=rev Log: use a central definition for repository mirrors, mirror dev.java.net again Modified: gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py gump/trunk/python/gump/core/build/mvn.py Modified: gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py?rev=961244&r1=961243&r2=961244&view=diff ============================================================================== --- gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py (original) +++ gump/trunk/python/gump/actor/mvnrepoproxy/proxycontrol.py Wed Jul 7 04:58:00 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/trunk/python/gump/core/build/mvn.py URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/build/mvn.py?rev=961244&r1=961243&r2=961244&view=diff ============================================================================== --- gump/trunk/python/gump/core/build/mvn.py (original) +++ gump/trunk/python/gump/core/build/mvn.py Wed Jul 7 04:58:00 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 gump-%s Gump proxying %s - http://localhost:%s/%s + http://localhost:%s%s %s """ % (mirror_of, mirror_of, port, prefix, mirror_of) ) @@ -251,11 +252,9 @@ class Maven2Builder(RunSpecific): localRepositoryDir)) if not self.run.getEnvironment().noMvnRepoProxy: props.write("") - write_mirror_entry(props, 'maven2', 'central', \ - self.run.getWorkspace().mvnRepoProxyPort) - write_mirror_entry(props, 'repo/m2-snapshot-repository', \ - 'apache.snapshots', \ - self.run.getWorkspace().mvnRepoProxyPort) + for (name, prefix, _url) in PROXY_CONFIG: + write_mirror_entry(props, prefix, name, \ + self.run.getWorkspace().mvnRepoProxyPort) props.write("") props.write("")