You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gump.apache.org by bo...@apache.org on 2007/09/13 21:50:23 UTC

svn commit: r575416 - in /gump/trunk/python/gump: actor/mvnrepository/ actor/mvnrepository/__init__.py actor/mvnrepository/local.py core/build/mvn.py core/model/workspace.py core/runner/demand.py core/runner/runner.py

Author: bodewig
Date: Thu Sep 13 12:50:22 2007
New Revision: 575416

URL: http://svn.apache.org/viewvc?rev=575416&view=rev
Log:
One local mvn repository per run, keep a local repository per project as an (disabled) option

Added:
    gump/trunk/python/gump/actor/mvnrepository/
    gump/trunk/python/gump/actor/mvnrepository/__init__.py
    gump/trunk/python/gump/actor/mvnrepository/local.py
Modified:
    gump/trunk/python/gump/core/build/mvn.py
    gump/trunk/python/gump/core/model/workspace.py
    gump/trunk/python/gump/core/runner/demand.py
    gump/trunk/python/gump/core/runner/runner.py

Added: gump/trunk/python/gump/actor/mvnrepository/__init__.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/mvnrepository/__init__.py?rev=575416&view=auto
==============================================================================
--- gump/trunk/python/gump/actor/mvnrepository/__init__.py (added)
+++ gump/trunk/python/gump/actor/mvnrepository/__init__.py Thu Sep 13 12:50:22 2007
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+#!/usr/bin/env python
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# tell Python what modules make up the gump.repostory package
+__all__ = ["local"]
+
+    

Added: gump/trunk/python/gump/actor/mvnrepository/local.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/actor/mvnrepository/local.py?rev=575416&view=auto
==============================================================================
--- gump/trunk/python/gump/actor/mvnrepository/local.py (added)
+++ gump/trunk/python/gump/actor/mvnrepository/local.py Thu Sep 13 12:50:22 2007
@@ -0,0 +1,37 @@
+#!/usr/bin/env python
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from gump.core.run.gumprun import *
+from gump.util.tools import wipeDirectoryTree
+
+import gump.core.run.actor
+
+class LocalMvnRepositoryCleaner(gump.core.run.actor.AbstractRunActor):
+    """
+    Removes the workspace wide local repository directory
+    if one has been created
+    """
+
+    def __init__(self, run):        
+        gump.core.run.actor.AbstractRunActor.__init__(self, run)    
+
+    def processOtherEvent(self, event):
+        if isinstance(event, FinalizeRunEvent):
+            self.cleanLocalRepository()
+
+    def cleanLocalRepository(self):
+        wipeDirectoryTree(self.run.getWorkspace().getLocalRepositoryDirectory())

Modified: gump/trunk/python/gump/core/build/mvn.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/build/mvn.py?rev=575416&r1=575415&r2=575416&view=diff
==============================================================================
--- gump/trunk/python/gump/core/build/mvn.py (original)
+++ gump/trunk/python/gump/core/build/mvn.py Thu Sep 13 12:50:22 2007
@@ -224,7 +224,11 @@
         if os.path.exists(settingsFile):
             project.addWarning('Overriding Maven2 settings: ['+settingsFile+']')
     
-        
+        if self.needsSeparateLocalRepository():
+            localRepositoryDir = self.locateLocalRepo(project)
+        else:
+            localRepositoryDir = self.run.getWorkspace().getLocalRepositoryDirectory()
+
         props=open(settingsFile,'w')
         
         props.write(("""<?xml version="1.0"?>
@@ -250,7 +254,7 @@
     </mirror>
   </mirrors-->
 </settings>""")	% (project.getName(), time.strftime('%Y-%m-%d %H:%M:%S'),
-                   self.locateLocalRepo(project)) )
+                   localRepositoryDir) )
         return settingsFile
 
     def locateMvnSettings(self, project):
@@ -266,3 +270,6 @@
         #
         return os.path.abspath(os.path.join(self.run.getWorkspace().getBaseDirectory(),
                                             project.getName() + ".mvnlocalrepo"))
+
+    def needsSeparateLocalRepository(self):
+        return False

Modified: gump/trunk/python/gump/core/model/workspace.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/model/workspace.py?rev=575416&r1=575415&r2=575416&view=diff
==============================================================================
--- gump/trunk/python/gump/core/model/workspace.py (original)
+++ gump/trunk/python/gump/core/model/workspace.py Thu Sep 13 12:50:22 2007
@@ -607,6 +607,13 @@
         
         self.setResolved()  
 
+    def getLocalRepositoryDirectory(self):
+        #
+        # Where to put the local repository
+        #
+        return os.path.abspath(os.path.join(self.getBaseDirectory(),
+                                            "mvnlocalrepo"))
+
 class WorkspaceStatistics(Statistics):
     """Statistics Holder"""
     def __init__(self,workspaceName):

Modified: gump/trunk/python/gump/core/runner/demand.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/runner/demand.py?rev=575416&r1=575415&r2=575416&view=diff
==============================================================================
--- gump/trunk/python/gump/core/runner/demand.py (original)
+++ gump/trunk/python/gump/core/runner/demand.py Thu Sep 13 12:50:22 2007
@@ -35,7 +35,6 @@
 from gump.core.model.project import Project
 from gump.core.model.depend import  ProjectDependency
 from gump.core.model.stats import *
-from gump.core.model.state import *
 
 from gump.util.threads.tools import *
 from gump.util.locks import *

Modified: gump/trunk/python/gump/core/runner/runner.py
URL: http://svn.apache.org/viewvc/gump/trunk/python/gump/core/runner/runner.py?rev=575416&r1=575415&r2=575416&view=diff
==============================================================================
--- gump/trunk/python/gump/core/runner/runner.py (original)
+++ gump/trunk/python/gump/core/runner/runner.py Thu Sep 13 12:50:22 2007
@@ -35,6 +35,7 @@
 from gump.actor.notify.notifier import Notifier
 from gump.actor.results.resulter import Resulter
 from gump.actor.syndication.syndicator import Syndicator
+from gump.actor.mvnrepository.local import LocalMvnRepositoryCleaner
 
 class GumpRunner(RunSpecific):
     """
@@ -222,7 +223,8 @@
             self.log.info('Not doing notifications [%s,%s]' \
                 % (self.run.getOptions().isNotify(), \
                     self.run.getWorkspace().isNotify() ) )
-                    
+        
+        self.run.registerActor(LocalMvnRepositoryCleaner(self.run))
                     
         # See what we have...            
         self.run.logActors()