[Buildbot-commits] buildbot/buildbot/steps dummy.py, 1.4, 1.5 maxq.py, 1.1, 1.2 python_twisted.py, 1.3, 1.4 shell.py, 1.4, 1.5 source.py, 1.5, 1.6 transfer.py, 1.10, 1.11

Brian Warner warner at users.sourceforge.net
Mon Jun 18 02:52:51 UTC 2007


Update of /cvsroot/buildbot/buildbot/buildbot/steps
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv23618/buildbot/steps

Modified Files:
	dummy.py maxq.py python_twisted.py shell.py source.py 
	transfer.py 
Log Message:
[project @ use instances instead of class/kwarg tuples when putting BuildSteps in factories. Closes: #11.]

Original author: warner at lothar.com
Date: 2007-06-18 02:51:00+00:00

Index: dummy.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/dummy.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- dummy.py	24 Nov 2006 07:16:35 -0000	1.4
+++ dummy.py	18 Jun 2007 02:52:49 -0000	1.5
@@ -20,6 +20,7 @@
         @param timeout: the number of seconds to delay before completing
         """
         BuildStep.__init__(self, **kwargs)
+        self.addFactoryArguments(timeout=timeout)
         self.timeout = timeout
         self.timer = None
 
@@ -70,6 +71,7 @@
         @param timeout: the number of seconds to delay
         """
         LoggingBuildStep.__init__(self, **kwargs)
+        self.addFactoryArguments(timeout=timeout)
         self.timeout = timeout
         self.description = ["remote", "delay", "%s secs" % timeout]
 
@@ -89,6 +91,7 @@
     name = "wait"
     def __init__(self, handle, **kwargs):
         LoggingBuildStep.__init__(self, **kwargs)
+        self.addFactoryArguments(handle=handle)
         self.handle = handle
 
     def describe(self, done=False):

Index: maxq.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/maxq.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- maxq.py	15 Sep 2006 14:47:03 -0000	1.1
+++ maxq.py	18 Jun 2007 02:52:49 -0000	1.2
@@ -10,6 +10,7 @@
             raise TypeError("please pass testdir")
         command = 'run_maxq.py %s' % (testdir,)
         ShellCommand.__init__(self, command=command, **kwargs)
+        self.addFactoryArguments(testdir=testdir)
 
     def startStatus(self):
         evt = event.Event("yellow", ['running', 'maxq', 'tests'],

Index: python_twisted.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/python_twisted.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- python_twisted.py	12 Dec 2006 03:24:03 -0000	1.3
+++ python_twisted.py	18 Jun 2007 02:52:49 -0000	1.4
@@ -34,6 +34,7 @@
 
     def __init__(self, python=None, **kwargs):
         ShellCommand.__init__(self, **kwargs)
+        self.addFactoryArguments(python=python)
         self.python = python
 
     def start(self):
@@ -332,6 +333,17 @@
                        timeout.
         """
         ShellCommand.__init__(self, **kwargs)
+        self.addFactoryArguments(reactor=reactor,
+                                 python=python,
+                                 trial=trial,
+                                 testpath=testpath,
+                                 tests=tests,
+                                 testChanges=testChanges,
+                                 recurse=recurse,
+                                 randomly=randomly,
+                                 trialMode=trialMode,
+                                 trialArgs=trialArgs,
+                                 )
 
         if python:
             self.python = python

Index: shell.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/shell.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- shell.py	26 Nov 2006 08:31:37 -0000	1.4
+++ shell.py	18 Jun 2007 02:52:49 -0000	1.5
@@ -81,7 +81,7 @@
     # without dooming the entire build to a status of FAILURE
     flunkOnFailure = True
 
-    def __init__(self, workdir,
+    def __init__(self, workdir=None,
                  description=None, descriptionDone=None,
                  command=None,
                  **kwargs):
@@ -89,7 +89,7 @@
         # that we create, but first strip out the ones that we pass to
         # BuildStep (like haltOnFailure and friends), and a couple that we
         # consume ourselves.
-        self.workdir = workdir # required by RemoteShellCommand
+
         if description:
             self.description = description
         if isinstance(self.description, str):
@@ -108,11 +108,18 @@
                 buildstep_kwargs[k] = kwargs[k]
                 del kwargs[k]
         LoggingBuildStep.__init__(self, **buildstep_kwargs)
+        self.addFactoryArguments(workdir=workdir,
+                                 description=description,
+                                 descriptionDone=descriptionDone,
+                                 command=command)
 
         # everything left over goes to the RemoteShellCommand
         kwargs['workdir'] = workdir # including a copy of 'workdir'
         self.remote_kwargs = kwargs
 
+    def setDefaultWorkdir(self, workdir):
+        rkw = self.remote_kwargs
+        rkw['workdir'] = rkw['workdir'] or workdir
 
     def setCommand(self, command):
         self.command = command

Index: source.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/source.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- source.py	6 Feb 2007 20:36:16 -0000	1.5
+++ source.py	18 Jun 2007 02:52:49 -0000	1.6
@@ -22,7 +22,7 @@
 
     branch = None # the default branch, should be set in __init__
 
-    def __init__(self, workdir, mode='update', alwaysUseLatest=False,
+    def __init__(self, workdir=None, mode='update', alwaysUseLatest=False,
                  timeout=20*60, retry=None, **kwargs):
         """
         @type  workdir: string
@@ -105,6 +105,12 @@
         """
 
         LoggingBuildStep.__init__(self, **kwargs)
+        self.addFactoryArguments(workdir=workdir,
+                                 mode=mode,
+                                 alwaysUseLatest=alwaysUseLatest,
+                                 timeout=timeout,
+                                 retry=retry,
+                                 )
 
         assert mode in ("update", "copy", "clobber", "export")
         if retry:
@@ -132,6 +138,9 @@
         self.description = description
         self.descriptionDone = descriptionDone
 
+    def setDefaultWorkdir(self, workdir):
+        self.args['workdir'] = self.args['workdir'] or workdir
+
     def describe(self, done=False):
         if done:
             return self.descriptionDone
@@ -206,7 +215,6 @@
     def __init__(self, cvsroot, cvsmodule, 
                  global_options=[], branch=None, checkoutDelay=None,
                  login=None,
-                 clobber=0, export=0, copydir=None,
                  **kwargs):
 
         """
@@ -263,20 +271,14 @@
         self.checkoutDelay = checkoutDelay
         self.branch = branch
 
-        if not kwargs.has_key('mode') and (clobber or export or copydir):
-            # deal with old configs
-            warnings.warn("Please use mode=, not clobber/export/copydir",
-                          DeprecationWarning)
-            if export:
-                kwargs['mode'] = "export"
-            elif clobber:
-                kwargs['mode'] = "clobber"
-            elif copydir:
-                kwargs['mode'] = "copy"
-            else:
-                kwargs['mode'] = "update"
-
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(cvsroot=cvsroot,
+                                 cvsmodule=cvsmodule,
+                                 global_options=global_options,
+                                 branch=branch,
+                                 checkoutDelay=checkoutDelay,
+                                 login=login,
+                                 )
 
         self.args.update({'cvsroot': cvsroot,
                           'cvsmodule': cvsmodule,
@@ -383,6 +385,11 @@
         self.branch = defaultBranch
 
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(svnurl=svnurl,
+                                 baseURL=baseURL,
+                                 defaultBranch=defaultBranch,
+                                 directory=directory,
+                                 )
 
         if not svnurl and not baseURL:
             raise ValueError("you must use exactly one of svnurl and baseURL")
@@ -502,7 +509,11 @@
         self.baseURL = baseURL
         self.branch = defaultBranch
         Source.__init__(self, **kwargs)
-        assert kwargs['mode'] != "export", \
+        self.addFactoryArguments(repourl=repourl,
+                                 baseURL=baseURL,
+                                 defaultBranch=defaultBranch,
+                                 )
+        assert self.args['mode'] != "export", \
                "Darcs does not have an 'export' mode"
         if (not repourl and not baseURL) or (repourl and baseURL):
             raise ValueError("you must provide exactly one of repourl and"
@@ -565,6 +576,7 @@
         """
         self.branch = None # TODO
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(repourl=repourl)
         self.args['repourl'] = repourl
 
     def startVC(self, branch, revision, patch):
@@ -609,6 +621,10 @@
         """
         self.branch = version
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(url=url,
+                                 version=version,
+                                 archive=archive,
+                                 )
         self.args.update({'url': url,
                           'archive': archive,
                           })
@@ -716,6 +732,10 @@
         """
         self.branch = version
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(url=url,
+                                 version=version,
+                                 archive=archive,
+                                 )
         self.args.update({'url': url,
                           'archive': archive,
                           })
@@ -769,6 +789,10 @@
         self.baseURL = baseURL
         self.branch = defaultBranch
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(repourl=repourl,
+                                 baseURL=baseURL,
+                                 defaultBranch=defaultBranch,
+                                 )
         if (not repourl and not baseURL) or (repourl and baseURL):
             raise ValueError("you must provide exactly one of repourl and"
                              " baseURL")
@@ -833,6 +857,10 @@
         self.baseURL = baseURL
         self.branch = defaultBranch
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(repourl=repourl,
+                                 baseURL=baseURL,
+                                 defaultBranch=defaultBranch,
+                                 )
         if (not repourl and not baseURL) or (repourl and baseURL):
             raise ValueError("you must provide exactly one of repourl and"
                              " baseURL")
@@ -900,14 +928,26 @@
 
         self.branch = defaultBranch
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(p4base=p4base,
+                                 defaultBranch=defaultBranch,
+                                 p4port=p4port,
+                                 p4user=p4user,
+                                 p4passwd=p4passwd,
+                                 p4extra_views=p4extra_views,
+                                 p4client=p4client,
+                                 )
         self.args['p4port'] = p4port
         self.args['p4user'] = p4user
         self.args['p4passwd'] = p4passwd
         self.args['p4base'] = p4base
         self.args['p4extra_views'] = p4extra_views
-        self.args['p4client'] = p4client % {
-            'slave': self.build.slavename,
-            'builder': self.build.builder.name,
+        self.p4client = p4client
+
+    def setBuild(self, build):
+        Source.setBuild(self, build)
+        self.args['p4client'] = self.p4client % {
+            'slave': build.slavename,
+            'builder': build.builder.name,
         }
 
     def computeSourceRevision(self, changes):
@@ -950,6 +990,11 @@
         assert kwargs['mode'] == "copy", "P4Sync can only be used in mode=copy"
         self.branch = None
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(p4port=p4port,
+                                 p4user=p4user,
+                                 p4passwd=p4passwd,
+                                 p4client=p4client,
+                                )
         self.args['p4port'] = p4port
         self.args['p4user'] = p4user
         self.args['p4passwd'] = p4passwd
@@ -982,6 +1027,11 @@
                  monotone="monotone",
                  **kwargs):
         Source.__init__(self, **kwargs)
+        self.addFactoryArguments(server_addr=server_addr,
+                                 branch=branch,
+                                 db_path=db_path,
+                                 monotone=monotone,
+                                 )
         self.args.update({"server_addr": server_addr,
                           "branch": branch,
                           "db_path": db_path,

Index: transfer.py
===================================================================
RCS file: /cvsroot/buildbot/buildbot/buildbot/steps/transfer.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- transfer.py	17 Apr 2007 06:38:51 -0000	1.10
+++ transfer.py	18 Jun 2007 02:52:49 -0000	1.11
@@ -88,10 +88,17 @@
 
     name = 'upload'
 
-    def __init__(self, build, slavesrc, masterdest,
+    def __init__(self, slavesrc, masterdest,
                  workdir="build", maxsize=None, blocksize=16*1024, mode=None,
                  **buildstep_kwargs):
-        BuildStep.__init__(self, build, **buildstep_kwargs)
+        BuildStep.__init__(self, **buildstep_kwargs)
+        self.addFactoryArguments(slavesrc=slavesrc,
+                                 masterdest=masterdest,
+                                 workdir=workdir,
+                                 maxsize=maxsize,
+                                 blocksize=blocksize,
+                                 mode=mode,
+                                 )
 
         self.slavesrc = slavesrc
         self.masterdest = masterdest
@@ -208,10 +215,17 @@
 
     name = 'download'
 
-    def __init__(self, build, mastersrc, slavedest,
+    def __init__(self, mastersrc, slavedest,
                  workdir="build", maxsize=None, blocksize=16*1024, mode=None,
                  **buildstep_kwargs):
-        BuildStep.__init__(self, build, **buildstep_kwargs)
+        BuildStep.__init__(self, **buildstep_kwargs)
+        self.addFactoryArguments(mastersrc=mastersrc,
+                                 slavedest=slavedest,
+                                 workdir=workdir,
+                                 maxsize=maxsize,
+                                 blocksize=blocksize,
+                                 mode=mode,
+                                 )
 
         self.mastersrc = mastersrc
         self.slavedest = slavedest





More information about the Commits mailing list