gump-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From leosim...@apache.org
Subject svn commit: r210002 - in /gump/branches/Gump3: ./ metadata/ pygump/ pygump/python/gump/ pygump/python/gump/engine/ pygump/python/gump/model/ pygump/python/gump/plugins/ pygump/python/gump/plugins/java/ pygump/python/gump/test/
Date Sun, 10 Jul 2005 12:34:42 GMT
Author: leosimons
Date: Sun Jul 10 05:34:40 2005
New Revision: 210002

URL: http://svn.apache.org/viewcvs?rev=210002&view=rev
Log:
A lot of updates in an effort to get more of vmgump.xml working as it should and
providing the right output.

 * implement support for <env/> on Script commands, eg
 
   <script><env name=bla value=myvalue/></script>

 * rework enviroment support for command execution to be an essential part of
   the gump.model and update the builder plugins to use the new Command.env.
   Get rid of the no-longer-needed EnvironmentPlugin.
   
 * implement support for shell= on Script commands, eg
 
   <script shell=tcsh/>
   
 * implement support for basedir= on Script commands and make the basedir
   attributer part of every Command
   
 * rework working directory support to make a working directory an intrinsic
   part of the gump.model.Workspace and eliminate the mess of passing around
   the workdir all over the codebase.
   
 * create a more robust BuilderPlugin._do_run_command and use that within the
   other builder plugins

 * add support for 'basedir' for Script and Ant commands
 
 * fix bugs in the AntPlugin so that it builds the correct commandline
 
 * improve a lot of logging statements to emit color when --color is enabled,
   disable a bunch of debug output, and add some useful pointers to the logs

 * change the way the logreporter reports PREREQ or UPDATE failures to mark
   projects as SKIPPED

Removed:
    gump/branches/Gump3/pygump/python/gump/plugins/environment.py
Modified:
    gump/branches/Gump3/gump
    gump/branches/Gump3/metadata/vmgump.xml
    gump/branches/Gump3/pygump/gump.log.config
    gump/branches/Gump3/pygump/python/gump/config.py
    gump/branches/Gump3/pygump/python/gump/engine/normalizer.py
    gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
    gump/branches/Gump3/pygump/python/gump/model/__init__.py
    gump/branches/Gump3/pygump/python/gump/model/util.py
    gump/branches/Gump3/pygump/python/gump/plugins/builder.py
    gump/branches/Gump3/pygump/python/gump/plugins/dirbuilder.py
    gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py
    gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py
    gump/branches/Gump3/pygump/python/gump/plugins/updater.py
    gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
    gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py
    gump/branches/Gump3/pygump/python/gump/test/testModel.py
    gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py
    gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py

Modified: gump/branches/Gump3/gump
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/gump?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/gump (original)
+++ gump/branches/Gump3/gump Sun Jul 10 05:34:40 2005
@@ -1037,8 +1037,6 @@
 # Load environment variables
 setup_env
 
-echo Executing command: $1
-
 # short circuit the help function because we don't really
 # want to load complain about missing environment settings
 # when the user is asking for help...
@@ -1054,9 +1052,3 @@
 
 # Figure out the action to take then run the appropriate function
 delegate $@
-
-# Attempt to clean up leftover commands
-trap 'exit 0' HUP
-trap 'kill -s HUP 0' EXIT
-trap 'kill -s TERM 0' TERM
-trap 'kill -s TERM 0' KILL

Modified: gump/branches/Gump3/metadata/vmgump.xml
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/metadata/vmgump.xml?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/metadata/vmgump.xml (original)
+++ gump/branches/Gump3/metadata/vmgump.xml Sun Jul 10 05:34:40 2005
@@ -101,8 +101,14 @@
 <projects>
     <project name="gump-unit-tests">
         <module name="gump"/>
-        <script name="gump">
+        
+        <!-- commands -->
+        <script name="gump" shell="bash">
             <arg name="" value="test"/>
+            <env name="GUMP_HOME" value="."/>
+            <env name="PYTHONPATH"/>
+            <env name="GUMP_WORKDIR"/>
+            <env name="GUMP_HOSTNAME"/>
         </script> 
     </project>
     

Modified: gump/branches/Gump3/pygump/gump.log.config
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/gump.log.config?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/gump.log.config (original)
+++ gump/branches/Gump3/pygump/gump.log.config Sun Jul 10 05:34:40 2005
@@ -32,7 +32,7 @@
 qualname=walker
 
 [logger_plugin]
-level=WARN
+level=INFO
 handlers=stdout,filehandler
 propagate=0
 qualname=plugin

Modified: gump/branches/Gump3/pygump/python/gump/config.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/config.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/config.py (original)
+++ gump/branches/Gump3/pygump/python/gump/config.py Sun Jul 10 05:34:40 2005
@@ -82,8 +82,6 @@
     
     from gump.plugins.instrumentation import TimerPlugin
     pre_process_plugins.append(TimerPlugin("run_start"))
-    from gump.plugins.environment import EnvironmentPlugin
-    pre_process_plugins.append(EnvironmentPlugin())
     
     plugins = []
 
@@ -100,26 +98,30 @@
     if config.do_update:    
         plugins.append(TimerPlugin("update_start"))
         from gump.plugins.updater import CvsUpdater, SvnUpdater
-        plugins.append(CvsUpdater(config.paths_work))
-        plugins.append(SvnUpdater(config.paths_work))
+        plugins.append(CvsUpdater())
+        plugins.append(SvnUpdater())
         plugins.append(TimerPlugin("update_end"))
+    else:
+        log.info("Not running updates! (pass --do-updates to enable them)")
         
     if config.do_build:
         # by contract, rmdir always needs to go before mkdir!
         from gump.plugins.dirbuilder import RmdirBuilderPlugin
-        plugins.append(RmdirBuilderPlugin(config.paths_work))
+        plugins.append(RmdirBuilderPlugin())
         from gump.plugins.dirbuilder import MkdirBuilderPlugin
-        plugins.append(MkdirBuilderPlugin(config.paths_work))
+        plugins.append(MkdirBuilderPlugin())
     
         buildlog = get_logger(config, "plugin.builder")
     
         from gump.plugins.builder import ScriptBuilderPlugin
-        plugins.append(ScriptBuilderPlugin(config.paths_work,buildlog))
+        plugins.append(ScriptBuilderPlugin(buildlog))
         from gump.plugins.java.builder import ClasspathPlugin
         from gump.model import Ant
-        plugins.append(ClasspathPlugin(config.paths_work,buildlog,Ant))
+        plugins.append(ClasspathPlugin(buildlog,Ant))
         from gump.plugins.java.builder import AntPlugin
-        plugins.append(AntPlugin(config.paths_work,buildlog))
+        plugins.append(AntPlugin(buildlog))
+    else:
+        log.info("Not running builds! (pass --do-builds to enable them)")
      
            
     if config.irc:        
@@ -133,6 +135,8 @@
         
         # Add the plugin, based upon this configuration information.
         plugins.append(IrcBotPlugin(log,config.debug,channel,nickname,server,port))
+    else:
+        log.info("Not talking on irc! (pass --irc to enable)")
         
     plugins.append(TimerPlugin("work_end"))
 
@@ -146,6 +150,8 @@
         db = get_db(dblog,config)
         dynagumplog = get_logger(config, "plugin.dynagumper")
         post_process_plugins.append(Dynagumper(db, dynagumplog))
+    else:
+        log.info("Not filling database! (pass --fill-database to enable)")
     
     reportlog = get_logger(config, "plugin.logger")
     from gump.plugins.logreporter import OutputLogReporterPlugin

Modified: gump/branches/Gump3/pygump/python/gump/engine/normalizer.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/engine/normalizer.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/engine/normalizer.py (original)
+++ gump/branches/Gump3/pygump/python/gump/engine/normalizer.py Sun Jul 10 05:34:40 2005
@@ -244,7 +244,8 @@
             repository = self._find_repository_for_module(module)
             if not repository:
                 name = module.getAttribute("name")
-                self.log.warn("Module '%s' does not have a corresponding repository!" % name)
+                # we inform about this later
+                #self.log.warn("Module '%s' does not have a corresponding repository!" % name)
                 # its okay to have a module without associated repository, its
                 # then an "installed package"
                 #continue
@@ -276,7 +277,8 @@
             module = self._find_module_for_project(project)
             if not module:
                 name = project.getAttribute("name")
-                self.log.warn("Project '%s' does not have a corresponding module!" % name)
+                # we inform about this later
+                #self.log.warn("Project '%s' does not have a corresponding module!" % name)
             else:
                 moduleref = self.newdoc.createElement("module")
                 moduleref.setAttribute("name", module.getAttribute("name") )

Modified: gump/branches/Gump3/pygump/python/gump/engine/objectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/engine/objectifier.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/engine/objectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/engine/objectifier.py Sun Jul 10 05:34:40 2005
@@ -32,21 +32,23 @@
 from gump.engine import EngineError
 from gump.engine.modeller import _find_element_text
 
+from gump.util import ansicolor
+
 DEFAULT_GUMP_LOCAL_REPOSITORY_NAME = "DEFAULT_GUMP_LOCAL_REPOSITORY"
 DEFAULT_GUMP_LOCAL_MODULE_NAME = "DEFAULT_GUMP_LOCAL_MODULE"
 ###
 ### Utility
 ###
-def _extract_path(workdir, project, element):
+def _extract_path(project, element):
     """ Extract directory relative to module or project, based
         upon which attribute (parent or nested) is present."""
     parent = element.getAttribute("parent")
     nested = element.getAttribute("nested")
     
     if parent:
-        return os.path.join(get_module_directory(workdir, project.module), parent)
+        return os.path.join(get_module_directory(project.module), parent)
     elif nested:
-        return os.path.join(get_project_directory(workdir, project), nested)
+        return os.path.join(get_project_directory(project), nested)
     else:
         raise Error, "Unknown relative path entry (no parent or nested): %s" % (element)
 
@@ -54,8 +56,8 @@
 ###
 ### Creation
 ###
-def _create_workspace(workspace_definition):
-    return Workspace(workspace_definition.getAttribute('name'))
+def _create_workspace(workspace_definition, workdir):
+    return Workspace(workspace_definition.getAttribute('name'), workdir)
 
 
 def _create_repository(workspace, repository_definition):
@@ -157,7 +159,7 @@
     return LocalModule(repository, name, url, description)
 
 
-def _create_project(module, project_definition, workdir):
+def _create_project(module, project_definition):
     name = project_definition.getAttribute("name")
     path = project_definition.getAttribute("path")
     
@@ -165,7 +167,7 @@
 
     homes = project_definition.getElementsByTagName("home")
     if homes.length > 0:
-        project.homedir = _extract_path(workdir, project, homes.item(0))
+        project.homedir = _extract_path(project, homes.item(0))
 
     return project
 
@@ -177,6 +179,45 @@
     _create_ant_commands(project, project_definition)
     #TODO more commands
 
+ENV_DELETION_MARKER="gumpobjectifierdeletethisvariableplease"
+def _create_env_vars(command, cmd):
+    env = {}
+    for env in cmd.getElementsByTagName("env"):
+        envname = env.getAttribute("name")
+        envvalue = env.getAttribute("value")
+        if not envname:
+            continue
+        if envvalue:
+            command.env[envname] = envvalue
+        else:
+            if command.env.has_key(envname):
+                command.env.pop(envname)
+
+
+def _get_args(cmd):
+    args = []
+    for arg in cmd.getElementsByTagName("arg"):
+        argname = arg.getAttribute("name")
+        argvalue = arg.getAttribute("value")
+        if argname:
+            if argname.startswith("--"):
+                if argvalue:
+                    args.append("%s=%s" % (argname, argvalue))
+                else:
+                    args.append(argname)
+            elif argname.startswith("-"):
+                args.append(argname)
+                if argvalue:
+                    args.append(argvalue)
+            else:
+                args.append(argname)
+                if argvalue:
+                    args.append(argvalue)
+        else:
+            if argvalue:
+                args.append(argvalue)
+    return args
+
 
 def _create_rmdir_commands(project, project_definition):
     rmdirs = project_definition.getElementsByTagName("delete")
@@ -196,17 +237,13 @@
     scripts = project_definition.getElementsByTagName("script")
     for cmd in scripts:
         name = cmd.getAttribute("name")
-        args = []
-        for arg in cmd.getElementsByTagName("arg"):
-            # TODO parse "-", "--", etc
-            argname = arg.getAttribute("name")
-            argvalue = arg.getAttribute("value")
-            if argname:
-                args.append(argname)
-            if argvalue:
-                args.append(argvalue)
-            
-        project.add_command(Script(project, name, args))
+        shell = cmd.getAttribute("shell")
+        basedir = cmd.getAttribute("basedir")
+        args = _get_args(cmd)
+        command = Script(project, name, args, shell=shell, basedir=basedir)
+        _create_env_vars(command, cmd)
+        
+        project.add_command(command)
 
 
 def _create_ant_commands(project, project_definition):
@@ -218,11 +255,12 @@
             
         project.add_command(Ant(project, target, buildfile, basedir=basedir))
 
-def _create_outputs(project, project_definition, workdir):    
+
+def _create_outputs(project, project_definition):    
     # Working directories for this project (containing java classes)
     works = project_definition.getElementsByTagName("work")
     for work in works:
-        path = _extract_path(workdir, project, work)
+        path = _extract_path(project, work)
         project.add_output(Classdir(project, path))
 
     # Jars
@@ -307,7 +345,8 @@
         self.dependency_name = dependency_name
     
     def __str__(self):
-        return "Dependency '%s' specified by '%s' cannot be found!" % (self.dependency_name, self.project)
+        return "%sDependency '%s' specified by '%s' cannot be found!%s" % \
+               (ansicolor.Red, self.dependency_name, self.project, ansicolor.Black)
 
 
 class Objectifier:
@@ -333,7 +372,7 @@
     def get_workspace(self, domtree):
         """Transforms a workspace xml document into object form."""
         root = domtree.documentElement
-        workspace = _create_workspace(root)
+        workspace = _create_workspace(root, self.workdir)
 
         self._create_repositories(workspace, _find_repository_definitions(root))
         self._create_modules(workspace, _find_module_definitions(root))
@@ -352,13 +391,14 @@
         for repository_definition in [r for r in repository_definitions \
                 if r.nodeType == dom.Node.ELEMENT_NODE]:
             name = repository_definition.getAttribute("name")
-            self.log.debug("Converting repository definition '%s' into object form." % name)
+            #self.log.debug("Converting repository definition '%s' into object form." % name)
             try:
                 repository = _create_repository(workspace, repository_definition)
                 workspace.repositories[repository.name] = repository
             except:
                 self.log.exception(
-                    "Failed to convert repository definition '%s' into object form." % name)
+                    "%sFailed to convert repository definition '%s' into object form.%s" % \
+                    (ansicolor.Bright_Red, name, ansicolor.Black))
     
     def _find_repository_for_module(self, workspace, module_definition):
         try:
@@ -369,7 +409,8 @@
         except:
             # If we can't find a repository, then we're dealing with an installed
             # package
-            self.log.debug("It seems that the module '%s' is an installed package" % name)
+            self.log.warn("Could not find a corresponding repository, so %smodule '%s' will be treated as an installed package%s" % \
+                          (ansicolor.Yellow, name, ansicolor.Black))
             return workspace.repositories[DEFAULT_GUMP_LOCAL_REPOSITORY_NAME]
 
     def _create_modules(self, workspace, module_definitions):
@@ -383,14 +424,15 @@
         for module_definition in [m for m in module_definitions \
                 if m.nodeType == dom.Node.ELEMENT_NODE]:
             name = module_definition.getAttribute("name")
-            self.log.debug("Converting module definition '%s' into object form." % name)
+            #self.log.debug("Converting module definition '%s' into object form." % name)
             try:
                 repository = self._find_repository_for_module(workspace, module_definition)
                 module = _create_module(repository, module_definition)
                 module.repository.modules[module.name] = module
                 workspace.modules[module.name] = module
             except:
-                self.log.exception("Failed to convert module definition '%s' into object form." % name)
+                self.log.exception("%sFailed to convert module definition '%s' into object form.%s" % \
+                                   (ansicolor.Bright_Red, name, ansicolor.Black))
         
     def _find_module_for_project(self, workspace, project_definition):
         try:
@@ -401,7 +443,8 @@
         except:
             # If we can't find a module, then we're dealing with an installed
             # package
-            self.log.debug("It seems that the project '%s' is an installed package" % name)
+            self.log.warn("Could not find a corresponding module, so %sproject '%s' will be treated as an installed package%s" % \
+                          (ansicolor.Yellow, name, ansicolor.Black))
             return workspace.modules[DEFAULT_GUMP_LOCAL_MODULE_NAME]
 
     def _create_projects(self, workspace, project_definitions):
@@ -412,21 +455,22 @@
         for project_definition in project_definitions:
             name = project_definition.getAttribute("name")
             if not name:
-                self.log.error("Can't convert project definition because it does not have a name!")
+                self.log.error("%sCan't convert project definition because it does not have a name!%s" % \
+                               (ansicolor.Bright_Red, ansicolor.Black))
                 failures.append(project_definition)
                 continue
-            self.log.debug("Converting project definition '%s' into object form." % name)
+            #self.log.debug("Converting project definition '%s' into object form." % name)
             try:
                 module = self._find_module_for_project(workspace, project_definition)
-                project = _create_project(module, project_definition, self.workdir)
+                project = _create_project(module, project_definition)
                 project.module.projects[project.name] = project
-                self.log.debug("Adding %s to workspace project list" % project.name)
                 workspace.projects[project.name] = project
     
                 _create_commands(project, project_definition)
-                _create_outputs(project, project_definition, self.workdir)
+                _create_outputs(project, project_definition)
             except:
-                self.log.exception("Failed to convert project definition '%s' into object form." % name)
+                self.log.exception("%sFailed to convert project definition '%s' into object form.%s" % \
+                                   (ansicolor.Bright_Red, name, ansicolor.Black))
                 failures.append(project_definition)
         
         # wire up dependencies only after projects have been created

Modified: gump/branches/Gump3/pygump/python/gump/model/__init__.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/__init__.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/__init__.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/__init__.py Sun Jul 10 05:34:40 2005
@@ -19,6 +19,7 @@
 __copyright__ = "Copyright (c) 2004-2005 The Apache Software Foundation"
 __license__   = "http://www.apache.org/licenses/LICENSE-2.0"
 
+import os
         
 class Error(Exception):
     """Generic error thrown for all internal model module exceptions."""
@@ -57,15 +58,22 @@
     Has the following properties:
         
         - name     -- per-host unique identifier
+        - workdir  -- working directory for gump data and files
         - repositories -- dictionary of contained repositories
         - modules -- dictionary of contained modules
         - projects -- dictionary of contained projects
         - dependencies -- list of all dependencies between projects
     """
-    def __init__(self, name):
+    def __init__(self, name, workdir):
         assert isinstance(name, basestring)
+        assert isinstance(workdir, basestring)
+        if not os.path.isdir(workdir):
+            if os.path.exists(workdir):
+                raise Error, "Workspace %s working directory '%s' can't be created because a file is in the way!" % (name, workdir)
+            os.makedirs(workdir)
     
         self.name = name
+        self.workdir = workdir
         self.repositories = {}
         self.modules = {}
         self.projects = {}
@@ -475,9 +483,19 @@
         
         - project -- the containing project
     """
-    def __init__(self, project):
+    def __init__(self, project, basedir=None, shell=None):
         assert isinstance(project, Project)
+
+        if basedir != None:
+            assert isinstance(basedir, basestring)
+
+        if shell != None:
+            assert isinstance(shell, basestring)
+            
         self.project = project
+        self.basedir = basedir
+        self.shell = shell
+        self.env = dict(os.environ)
         
     def __str__(self):
         return "<Command:%s>" % self.project
@@ -530,8 +548,10 @@
         - args -- a list of arguments to the command,
                   where each element is a (name, value)
                   tuple
+        - basedir -- directory relative to project home in which to run
+        - shell -- the shell in which to execute the script
     """
-    def __init__(self, project, name, args=None):
+    def __init__(self, project, name, args=None, basedir=None, shell=None):
         assert isinstance(name, basestring)
         if args != None:
             assert isinstance(args, list)
@@ -540,12 +560,12 @@
             self.args = args
         else:
             self.args = []
-            
-        Command.__init__(self, project)
+
+        Command.__init__(self, project, basedir=basedir, shell=shell)
         self.name = name
 
     def __str__(self):
-        return "<Script:%s,args=%s>" % (self.name, " ".join(self.args))
+        return "<Script:%s,args=%s,shell=%s,basedir=%s>" % (self.name, " ".join(self.args), self.shell, self.basedir)
 
 class Ant(Command):
     """Command to run an Ant build.
@@ -555,20 +575,18 @@
         - all the properties a Command has
         - target -- the Ant target
         - buildfile -- the Ant build file
+        - basedir -- directory relative to project home in which to run
     """
     def __init__(self, project, target, buildfile="build.xml",basedir=None):
         assert isinstance(target, basestring)
         assert isinstance(buildfile, basestring)
-        if basedir != None:
-            assert isinstance(basedir, basestring)
             
-        Command.__init__(self, project)
+        Command.__init__(self, project, basedir)
         self.target = target
         self.buildfile = buildfile
-        self.basedir = basedir
 
     def __str__(self):
-        return "<Ant:target=%s,buildfile=%s>" % (self.target, self.buildfile)
+        return "<Ant:target=%s,buildfile=%s,basedir=%s>" % (self.target, self.buildfile, self.basedir)
 
 #TODO: more Commands
 

Modified: gump/branches/Gump3/pygump/python/gump/model/util.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/model/util.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/model/util.py (original)
+++ gump/branches/Gump3/pygump/python/gump/model/util.py Sun Jul 10 05:34:40 2005
@@ -29,29 +29,29 @@
 UPDATE_TYPE_CHECKOUT="checkout"
 UPDATE_TYPE_UPDATE="update"
 
-def get_jar_path(workdir, jar):
+def get_jar_path(jar):
     """Determine the path to a Jar."""
-    return join(get_project_home_directory(workdir, jar.project),jar.name)
+    return join(get_project_home_directory(jar.project),jar.name)
 
-def get_project_home_directory(workdir, project):
+def get_project_home_directory(project):
     """Determine the home directory for a project."""
-    return join(get_project_directory(workdir, project),project.homedir)
+    return join(get_project_directory(project),project.homedir)
 
-def get_project_directory(workdir, project):
+def get_project_directory(project):
     """Determine the base directory for a project."""
-    return join(get_module_directory(workdir, project.module),project.path)
+    return join(get_module_directory(project.module),project.path)
 
-def get_module_directory(workdir, module):
+def get_module_directory(module):
     """Determine the base directory for a module."""
-    return join(get_repository_directory(workdir,module.repository),module.name)
+    return join(get_repository_directory(module.repository),module.name)
 
-def get_repository_directory(workdir, repository):
+def get_repository_directory(repository):
     """Determine the base directory for a repository."""
-    return join(get_workspace_directory(workdir,repository.workspace),repository.name)
+    return join(get_workspace_directory(repository.workspace),repository.name)
 
-def get_workspace_directory(workdir, workspace):
+def get_workspace_directory(workspace):
     """Determine the base directory for a workspace."""
-    return abspath(join(workdir,workspace.name))
+    return abspath(join(workspace.workdir,workspace.name))
 
 def mark_failure(model_element, cause):
     """Mark a model element as "failed"."""
@@ -169,7 +169,7 @@
     model_object.exceptions.append(ExceptionInfo(type, value, traceback))
 
         
-def calculate_classpath(workdir, project, recurse=True, runtimeonly=False):
+def calculate_classpath(project, recurse=True, runtimeonly=False):
     """This ugly beast of a method looks at a project and its dependencies and
     builds a classpath and a bootclasspath based on its <work/> directives
     and its <depend/> directives."""
@@ -210,7 +210,7 @@
                 if isinstance(output, Classdir):
                     path = output.path
                 if isinstance(output, Jar):
-                    path = get_jar_path(workdir,output)
+                    path = get_jar_path(output)
                 
                 # actually add the path
                 if output.add_to_bootclass_path:
@@ -227,17 +227,17 @@
                 # only the "runtime" dependencies.
                 if recurse:
                     if info.inherit == DEPENDENCY_INHERIT_ALL or info.inherit == DEPENDENCY_INHERIT_HARD:
-                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(workdir, dependency, recurse=False)
+                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(dependency, recurse=False)
                         classpath.extend(inheritedclasspath)
                         bootclasspath.extend(inheritedbootclasspath)
                     
                     if info.inherit == DEPENDENCY_INHERIT_JARS:
-                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(workdir, dependency, recurse=True)
+                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(dependency, recurse=True)
                         classpath.extend(inheritedclasspath)
                         bootclasspath.extend(inheritedbootclasspath)
                     
                     if info.inherit == DEPENDENCY_INHERIT_RUNTIME:
-                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(workdir, dependency, recurse=False, runtimeonly=True)
+                        (inheritedclasspath, inheritedbootclasspath) = calculate_classpath(dependency, recurse=False, runtimeonly=True)
                         classpath.extend(inheritedclasspath)
                         bootclasspath.extend(inheritedbootclasspath)
                         

Modified: gump/branches/Gump3/pygump/python/gump/plugins/builder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/builder.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/builder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/builder.py Sun Jul 10 05:34:40 2005
@@ -22,67 +22,124 @@
 import os
 import sys
 from os.path import abspath, join, isfile
+from tempfile import mkdtemp
+import shutil
 
 from gump.model import Script, Error, Project, Ant, Dependency
 from gump.model.util import get_project_directory
 from gump.plugins import AbstractPlugin
 from gump.util.executor import Popen, PIPE, STDOUT
 
+#DEFAULT_SCRIPT_SHELL = "sh"
+if sys.platform == "win32":
+    DEFAULT_SCRIPT_SHELL = "cmd"
+else:
+    DEFAULT_SCRIPT_SHELL = "sh"
+
 class BuilderPlugin(AbstractPlugin):
     """Abstract class for creating plugins that handle the execution of Commands.
 
     To create a subclass, override __init__, then call it from the subclass with
     the method to call."""
-    def __init__(self, workdir, log, cmd_clazz, method):
+    def __init__(self, log, cmd_clazz, method):
         """Create a new builder. Arguments:
         
-          -- workdir = the directory in which to perform the command
           -- log = the Logger instance for debugging
           -- cmd_clazz = the Command subclass the plugin handles
           -- method = the python method (which must be a class method on
              the subclass) to call. It will be provided with a Project
              instance and with the relevant Command instance to process"""
-        self.workdir = workdir
         self.log = log
         self.cmd_clazz = cmd_clazz
         self.method = method             
 
+    def initialize(self):
+        self.tempdir = mkdtemp()
+
     def visit_project(self, project):
         """Dispatch for each matching command (matching by class type) """        
         assert isinstance(project, Project)
-        self.log.debug("Visit %s looking for %s" % (project,self.cmd_clazz))
+        #self.log.debug("Visit %s looking for %s" % (project,self.cmd_clazz))
         for command in [command for command in project.commands if isinstance(command,self.cmd_clazz)]:
             self.log.debug("Perform %s on %s" % (command, project))
             self.method(project, command)
+    
+    def _do_run_command(self, command, args, workdir, shell=False):
+        """Utility method for actually executing commands and storing their
+           results within the model.
+        
+        Arguments:
+          - command -- the model object instance (subclass of Command) this
+                       action is associated with
+          - args    -- the action to take (including, for example, a script
+                       name)
+        """
+        # running subprocess.Popen with shell=True results in "sh -c", which is
+        # not what we want, since our shell=True indicates we're actually running
+        # a shell script, and potentially using a different shell!
+        if shell:
+            myargs = ["/usr/bin/env", command.shell or "sh"]
+            myargs.extend(args)
+        else:
+            myargs = args
+        
+        # unfortunately we can't use the communicate() method on the command
+        # it seems that, when invoking python-in-bash-in-python-in-bash (eg
+        # using Gump to run gump, for example) and similar complex setups,
+        # deadlocking can occur, for example when calling select.select(). So
+        # we send output to a temporary file. We can't use the regular "tmpfile"
+        # because when we close that file it is removed. Hence, we resort to
+        # using a temporary directory. *sigh*
+        outputfilename = os.path.join(self.tempdir, "BuilderPlugin_%s.tmp-out" % command.project.name)
+        outputfile = None
+        try:
+            outputfile = open(outputfilename,'wb')
+            cmd = Popen(myargs,shell=False,cwd=workdir,stdout=outputfile,stderr=STDOUT,env=command.env)
+            #command.build_log = cmd.communicate()[0]
+            command.build_exit_status = cmd.wait()
+
+            outputfile.close()
+            outputfile = open(outputfilename,'rb')
+            command.build_log = outputfile.read()
+        finally:
+            if outputfile:
+                try: outputfile.close()
+                except: pass
+                
+            try: os.remove(outputfilename)
+            except: pass        
             
+    def finalize(self, workspace):
+        try: shutil.rmtree(self.tempdir)
+        except: pass
+
 class ScriptBuilderPlugin(BuilderPlugin):
     """Execute all "script" commands for all projects."""
-    def __init__(self, workdir, log):
-        BuilderPlugin.__init__(self, workdir, log, Script, self._do_script)  
+    def __init__(self, log):
+        BuilderPlugin.__init__(self, log, Script, self._do_script)
         
     def _do_script(self, project, script):
-        # NOTE: no support for basedir="", an undocumented feature in gump2        
-        assert isinstance(project, Project)
-        projectpath = get_project_directory(self.workdir,project)
+        # working directory
+        projectpath = get_project_directory(project)
+        if script.basedir:
+            projectpath = os.path.join(projectpath, script.basedir)
         
+        # command line
+        myargs = []
         scriptfile = abspath(join(projectpath, script.name))
         
         # No extension is ok, otherwise guess at one, platform appropriately
         if not isfile(scriptfile):
+            oldscriptfile = scriptfile
             if sys.platform == "win32":
                 scriptfile += ".bat"
             else:
                 scriptfile += ".sh"
             
             if not isfile(scriptfile):
-                raise Error, "No script '%s' found!" % scriptfile
-        
-        self.log.debug("Scriptfile seems to be %s" % scriptfile)
-        args = []
-        args.append(scriptfile)
-        args.extend(script.args)
-        cmd = Popen(args,shell=True,cwd=projectpath,stdout=PIPE,stderr=STDOUT,env=project.env)
+                raise Error, "No script '%s' found!" % oldscriptfile
         
-        script.build_log = cmd.communicate()[0]
-        script.build_exit_status = cmd.wait()
-
+        myargs.append(scriptfile)
+        myargs.extend(script.args)
+        # run it
+        self._do_run_command(script, myargs, projectpath, shell=True)

Modified: gump/branches/Gump3/pygump/python/gump/plugins/dirbuilder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/dirbuilder.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/dirbuilder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/dirbuilder.py Sun Jul 10 05:34:40 2005
@@ -28,11 +28,11 @@
 
 class MkdirBuilderPlugin(AbstractPlugin):
     """Execute all "mkdir" commands for all projects."""
-    def __init__(self, workdir):
-        self.workdir = workdir
+    def __init__(self):
+        pass
         
     def _do_mkdir(self, project, directory):
-        projectpath = get_project_directory(self.workdir,project)
+        projectpath = get_project_directory(project)
         dirpath = os.path.abspath(os.path.join(projectpath,directory))
         if not dirpath.startswith(projectpath):
             raise Error, "Directory '%s' to be created not within project path '%s'!" % (directory, projectpath)
@@ -49,11 +49,11 @@
 
 class RmdirBuilderPlugin(AbstractPlugin):
     """Execute all "rmdir" commands for all projects."""
-    def __init__(self, workdir):
-        self.workdir = workdir
+    def __init__(self):
+        pass
         
     def _do_rmdir(self, project, directory):
-        projectpath = get_project_directory(self.workdir,project)
+        projectpath = get_project_directory(project)
         dirpath = os.path.abspath(os.path.join(projectpath,directory))
         if not dirpath.startswith(projectpath):
             raise Error, "Directory '%s' to be deleted not within project path '%s'!" % (directory, projectpath)

Modified: gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/java/builder.py Sun Jul 10 05:34:40 2005
@@ -28,63 +28,47 @@
 from gump.plugins import AbstractPlugin
 from gump.plugins.builder import BuilderPlugin
 from gump.util.executor import Popen, PIPE, STDOUT
-
+from gump.util import ansicolor
 
 class ClasspathPlugin(BuilderPlugin):
     """Generate the java build attributes (e.g. CLASSPATH) for the specified command."""
-    def __init__(self, workdir, log, CommandClazz):
-        BuilderPlugin.__init__(self, workdir, log, CommandClazz, self.set_classpath)
+    def __init__(self, log, CommandClazz):
+        BuilderPlugin.__init__(self, log, CommandClazz, self.set_classpath)
         
     def set_classpath(self, project, command):
-        (classpath, bootclasspath) = calculate_classpath(self.workdir, project)
+        (classpath, bootclasspath) = calculate_classpath(project)
         command.classpath = classpath
         command.boot_classpath = bootclasspath
                 
         
 class AntPlugin(BuilderPlugin):
     """Execute all "ant" commands for all projects."""
-    def __init__(self, workdir, log, debug=False):
-        BuilderPlugin.__init__(self, workdir, log, Ant, self._do_ant)
+    def __init__(self, log, debug=False):
+        BuilderPlugin.__init__(self, log, Ant, self._do_ant)
         self.debug = debug
         
     def _do_ant(self, project, ant):                
-        projectpath = get_project_directory(self.workdir,project)
+        # environment
+        self.log.debug("        CLASSPATH is '%s%s%s'" % \
+                       (ansicolor.Blue, ":".join(ant.classpath), ansicolor.Black))
+        ant.env['CLASSPATH'] = os.pathsep.join(ant.classpath)
+        
+        # working directory
+        projectpath = get_project_directory(project)
         if ant.basedir:
             projectpath = os.path.join(projectpath, ant.basedir)
         
-        self.log.debug('CLASSPATH %s' % ant.classpath)
-        self.log.debug('BOOTCLASSPATH %s' % ant.boot_classpath)
+        # command line
+        args = [join(ant.env["JAVA_HOME"], "bin", "java")]
         
-        # Create an Environment
-        project.env['CLASSPATH'] = os.pathsep.join(ant.classpath)
-        
-        # TODO test this
-        # TODO sysclasspath only
-        # TODO more options
-        
-        # Build the command line.
-        args = [join(os.environ["JAVA_HOME"], "bin", "java")]
-        
-        # Allow bootclasspath
-        if ant.boot_classpath:
-            args += ['-Xbootclasspath/p',':'.join(ant.boot_classpath)]
+        if ant.boot_classpath and len(ant.boot_classpath) > 0:
+            args.append('-Xbootclasspath/p:' + ':'.join(ant.boot_classpath))
 
-        # Ant's entry point, and main options.
         args += ["org.apache.tools.ant.Main"]
-                 
-        # Specify a build file.
         if ant.buildfile: args += ["-buildfile",ant.buildfile]
-
-        # Override the default target
         if ant.target: args += [ant.target]
-        
-        # Allow debugging
         if self.debug: args += ["-debug"]
         
-        self.log.debug("Command : %s " % (args))
-        self.log.debug("        : %s " % ant.classpath)
-        #self.log.debug("        : %s " % self.tmp_env)
-        cmd = Popen(args,shell=False,cwd=projectpath,stdout=PIPE,stderr=STDOUT,env=project.env)
-
-        ant.build_log = cmd.communicate()[0]
-        ant.build_exit_status = cmd.wait()
+        # run it
+        self._do_run_command(ant, args, projectpath)
+        

Modified: gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/logreporter.py Sun Jul 10 05:34:40 2005
@@ -194,20 +194,29 @@
         if not check_failure(project):
             self.wr('  %s%s: OK%s' % (ansicolor.Green, project, ansicolor.Black))
         else:
-            self.wr('  %s%s: FAIL%s' % (ansicolor.Red, project, ansicolor.Black+ansicolor.Black))
+            firsterror = '  %s%s: FAIL%s' % (ansicolor.Red, project, ansicolor.Black+ansicolor.Black)
 
             causes = get_failure_causes(project)
+            
+            if len(causes) > 0:
+                cause = causes[0]
+                if isinstance(cause, Dependency) or isinstance(cause, Project) or isinstance(cause, Module):
+                    firsterror = '  %s%s: SKIPPED%s' % (ansicolor.Yellow, project, ansicolor.Black+ansicolor.Black)
+            self.wr(firsterror)
+            
             for cause in causes:
+                seconderror = "      %sUNKNOWN FAILURE (%s)%s" % (ansicolor.Bright_Red, cause, ansicolor.Black)
                 if isinstance(cause, ExceptionInfo):
-                    self.wr("      %sMETADATA FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black))
+                    seconderror = "      %sMETADATA FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black)
                 if isinstance(cause, Command):
-                    self.wr("      %sBUILD FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black))
+                    seconderror = "      %sBUILD FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black)
                 if isinstance(cause, Dependency):
-                    self.wr("      %sPREREQ FAILURE (%s)%s" % (ansicolor.Red, cause.dependency, ansicolor.Black))
+                    seconderror = "      %sPREREQ FAILURE (%s)%s" % (ansicolor.Yellow, cause.dependency, ansicolor.Black)
                 if isinstance(cause, Project):
-                    self.wr("      %sPREREQ FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black))
+                    seconderror = "      %sPREREQ FAILURE (%s)%s" % (ansicolor.Yellow, cause, ansicolor.Black)
                 if isinstance(cause, Module):
-                    self.wr("      %sUPDATE FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black))
+                    seconderror = "      %sUPDATE FAILURE (%s)%s" % (ansicolor.Red, cause, ansicolor.Black)
+                self.wr(seconderror)
                 
                 indent =    "       "
                 for trace_elem in get_root_cause(cause):

Modified: gump/branches/Gump3/pygump/python/gump/plugins/updater.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/plugins/updater.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/plugins/updater.py (original)
+++ gump/branches/Gump3/pygump/python/gump/plugins/updater.py Sun Jul 10 05:34:40 2005
@@ -34,22 +34,22 @@
 from gump.model.util import UPDATE_TYPE_CHECKOUT, UPDATE_TYPE_UPDATE
 
 class ModuleUpdater(AbstractPlugin):
-    def __init__(self, workdir):
-        self.workdir = workdir
+    def __init__(self):
+        pass
 
     def visit_repository(self, repository):
-        repopath = get_repository_directory(self.workdir, repository)
+        repopath = get_repository_directory(repository)
         if not os.path.exists(repopath):
             os.makedirs(repopath)
 
     def visit_module(self, module):
-        modulepath = get_module_directory(self.workdir, module)
+        modulepath = get_module_directory(module)
         if not os.path.exists(modulepath):
             os.makedirs(modulepath)
 
 class CvsUpdater(ModuleUpdater):
-    def __init__(self, workdir):
-        ModuleUpdater.__init__(self, workdir)
+    def __init__(self):
+        ModuleUpdater.__init__(self)
     
     def visit_repository(self, repository):
         if isinstance(repository, CvsRepository):
@@ -60,7 +60,7 @@
 
         ModuleUpdater.visit_module(self, module)
 
-        repopath = get_repository_directory(self.workdir, module.repository)
+        repopath = get_repository_directory(module.repository)
         current = os.path.curdir
         modulepath = os.path.join(repopath, module.name)
         cvsdir = os.path.join(modulepath, 'CVS')
@@ -89,8 +89,8 @@
         module.update_type = UPDATE_TYPE_UPDATE
 
 class SvnUpdater(ModuleUpdater):
-    def __init__(self, workdir):
-        ModuleUpdater.__init__(self, workdir)
+    def __init__(self):
+        ModuleUpdater.__init__(self)
     
     def visit_repository(self, repository):
         if isinstance(repository, SvnRepository):
@@ -101,7 +101,7 @@
 
         ModuleUpdater.visit_module(self, module)
 
-        modulepath = get_module_directory(self.workdir, module)
+        modulepath = get_module_directory(module)
         current = os.path.curdir
         os.chdir(modulepath)
         svndir = os.path.join(modulepath, '.svn')

Modified: gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testEngineObjectifier.py Sun Jul 10 05:34:40 2005
@@ -340,7 +340,7 @@
             def getAttribute(self, name):
                 return getattr(self, name, None)
         
-        w = Workspace("bla")
+        w = Workspace("bla", self.workdir)
         r = Repository(w, "blabla")
         m = Module(r, "blablabla")
         bla_project = Project(m, "blablablabla")

Modified: gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testEngineWalker.py Sun Jul 10 05:34:40 2005
@@ -20,6 +20,8 @@
 import unittest
 from pmock import MockTestCase
 
+import os
+
 from gump.engine.walker import Walker
 
 class MockWorkspace:
@@ -50,6 +52,11 @@
         self.w = w
         
         self.walker = Walker(self.log)
+    
+    def tearDown(self):
+        if os.path.exists("bla"):
+            import shutil
+            shutil.rmtree("bla")
 
     def test_constructor(self):
         Walker(self.log)
@@ -102,7 +109,7 @@
         from gump.model import Project
         from gump.model import Dependency
         
-        w = Workspace("ws")
+        w = Workspace("ws", "bla")
         r = Repository(w,"repo")
         m = Module(r,"mod")
         

Modified: gump/branches/Gump3/pygump/python/gump/test/testModel.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testModel.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testModel.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testModel.py Sun Jul 10 05:34:40 2005
@@ -20,6 +20,8 @@
 import unittest
 from unittest import TestCase
 
+import os
+
 from gump.model import Error
 from gump.model import ModelObject
 from gump.model import ExceptionInfo
@@ -45,6 +47,11 @@
 from gump.model import Classdir
 
 class ModelTestCase(TestCase):
+    def tearDown(self):
+        if os.path.exists("bla"):
+            import shutil
+            shutil.rmtree("bla")
+
     def test_error(self):
         e = Error()
         try:
@@ -78,15 +85,15 @@
     
     def test_workspace(self):
         name = "blah"
-        w = Workspace(name)
+        w = Workspace(name, "bla")
         self.assertEqual(name, w.name)
         self.assertEqual({}, w.repositories)
         self.assertEqual({}, w.modules)
         self.assertEqual({}, w.projects)
         self.assertEqual([], w.dependencies)
         
-        self.assertRaises(AssertionError, Workspace, None)
-        Workspace(unicode("blah")) # unicode is okay too...
+        self.assertRaises(AssertionError, Workspace, None, "blah")
+        Workspace(unicode("blah"), "bla") # unicode is okay too...
         
         r = Repository(w, "booh")
         w.add_repository(r)
@@ -98,13 +105,13 @@
         self.assertRaises(AssertionError, w.add_repository, "blah")
         self.assertEqual(1, len(w.repositories))
         
-        w2 = Workspace("blah2")
+        w2 = Workspace("blah2", "bla")
         r2 = Repository(w2, "booh2")
         self.assertRaises(AssertionError,w.add_repository,r2)
     
     def test_repository(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         name = "booh"
         title = "t"
         home_page = "h"
@@ -150,7 +157,7 @@
     
     def test_cvs_repository(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         name = "booh"
         hostname = "cvs.somewhere.org"
         path = "/some/cvs/location"
@@ -193,7 +200,7 @@
 
     def test_svn_repository(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         name = "booh"
         url = "http://svn.somewhere.org/some/svn/repo"
         title = "t"
@@ -228,7 +235,7 @@
 
     def test_module(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         
@@ -268,7 +275,7 @@
     
     def test_module_is_added_to_workspace_by_repository(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         r2name = "booh2"
@@ -292,7 +299,7 @@
         
     def test_cvs_module(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         
@@ -314,7 +321,7 @@
 
     def test_svn_module(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         
@@ -333,7 +340,7 @@
         
     def test_project(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -380,7 +387,7 @@
         
     def test_project_is_added_to_workspace_by_module(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         url = "http://www.somewhere.org/bweh/"
@@ -402,7 +409,7 @@
         
     def test_dependencies(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -493,7 +500,7 @@
     
     def test_dependency_info(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -566,7 +573,7 @@
         
     def test_command(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -584,7 +591,7 @@
 
     def test_mkdir(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -606,7 +613,7 @@
 
     def test_rmdir(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -628,7 +635,7 @@
 
     def test_script(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -662,7 +669,7 @@
 
     def test_ant(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -689,7 +696,7 @@
 
     def test_output(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -708,7 +715,7 @@
 
     def test_jar(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"
@@ -745,7 +752,7 @@
 
     def test_classdir(self):
         wname = "blah"
-        w = Workspace(wname)
+        w = Workspace(wname, "bla")
         rname = "booh"
         r = Repository(w,rname)
         mname = "bweh"

Modified: gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testPluginBuilder.py Sun Jul 10 05:34:40 2005
@@ -40,7 +40,7 @@
     def test_do_script(self):
         basedir = abspath(mkdtemp())
         try:
-            w = Workspace("w")
+            w = Workspace("w", basedir)
             mkdir(join(basedir,w.name))
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
@@ -68,7 +68,8 @@
 
             log = self.mock()
             log.stubs().method("debug")
-            plugin = ScriptBuilderPlugin(basedir, log)
+            plugin = ScriptBuilderPlugin(log)
+            plugin.initialize()
 
             cmd = Script(p, "dobuild")
             plugin._do_script(cmd.project, cmd)
@@ -78,4 +79,7 @@
             cmd = Script(p, "nosuchscript")
             self.assertRaises(Error, plugin._do_script, cmd.project, cmd)
         finally:
+            if plugin:
+                try: plugin.finalize(w)
+                except: pass
             rmtree(basedir)        

Modified: gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py
URL: http://svn.apache.org/viewcvs/gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py?rev=210002&r1=210001&r2=210002&view=diff
==============================================================================
--- gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py (original)
+++ gump/branches/Gump3/pygump/python/gump/test/testPluginDirBuilder.py Sun Jul 10 05:34:40 2005
@@ -38,7 +38,7 @@
     def test_do_rmdir(self):
         basedir = abspath(mkdtemp())
         try:
-            w = Workspace("w")
+            w = Workspace("w", basedir)
             mkdir(join(basedir,w.name))
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
@@ -51,7 +51,7 @@
 
             cmd = Rmdir(p,"somedir")
 
-            plugin = RmdirBuilderPlugin(basedir)
+            plugin = RmdirBuilderPlugin()
             
             makedirs(join(ppath, cmd.directory, "nested", "stuff", "here"))
             plugin._do_rmdir(cmd.project, cmd.directory)
@@ -85,7 +85,7 @@
     def test_do_mkdir(self):
         basedir = abspath(mkdtemp())
         try:
-            w = Workspace("w")
+            w = Workspace("w", basedir)
             mkdir(join(basedir,w.name))
             r = Repository(w,"r")
             mkdir(join(basedir,w.name,r.name))
@@ -98,7 +98,7 @@
 
             cmd = Mkdir(p,"somedir")
         
-            plugin = MkdirBuilderPlugin(basedir)
+            plugin = MkdirBuilderPlugin()
             
             plugin._do_mkdir(cmd.project, cmd.directory)
             self.assert_(isdir(join(ppath,cmd.directory)))



Mime
View raw message