[Buildbot-devel] custom buildstem

mp3 at hello.lv mp3 at hello.lv
Tue Mar 29 13:44:18 UTC 2011

On Tue, 29 Mar 2011 11:23:06 +0200, Benoît Allard <benoit at aeteurope.nl>
> mp3 at hello.lv wrote:
>>> You'll need to implement a new command on the slave, and deploy that
>>> to all of your buildslaves, then call that command from a custom
>>> buildstep on the master.
>>> Dustin
>> How? Could you post a short example?
> Actually, you can help yourself with any existing command. They already 
> are Python program that run on the slave side. They are mainly meant to 
> launch executable on the slave side, but if you replace the 
> system.execute (or whatever is used) with your own mechanics, it should 
> work fine.
> Pick one there for instance as a starting brick.
> I don't know what you're into, but think of making it generic enough, 
> maybe it can be integrated in buildbot and also help others !
> Regards

Thanks. I've created a class based on the MakeDirectory template.
class PrepareVxWorks66(base.Command):
   """Copies the VxWorks 6.6 related project files found in vxworks_6.6 
      folder to its parent folder i.e. one level up. The args dict
contains the
      following keys:

        - ['dir'] (required): where it should look for vxworks_6.6
        It can be ablosute or relative to Builder directory.

    Creates the following status messages:
        - {'rc': rc} : when the process has terminated

   def start(self):
      args = self.args
      assert args['dir'] is not None
      dstDirname = join(self.builder.basedir, args['dir'])
         srcDirname = join(dstDirname, "vxworks_6.6")
         for file in get_files_of_patterns(srcDirname, ".*", "*.wpj"):
            # remove destination file, if it exists
            (_, srcFileName) = os.path.split(file)
               dstFile = open(dstDirname, srcFileName)
               os.remove(dstDirname, srcFileName)
            except IOError:
            # copy
            shutil.copy(file, dstDirname)
            # make a destination file writable for user and readable for
            os.chmod(join(dstDirname, srcFileName),
               stat.S_IWUSR | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH)

         self.sendStatus({'rc': 0})
         self.sendStatus({'rc': 1})

How do I add a new buildstep of this class?
I have to call
registerSlaveCommand("PrepareVxWorks66", PrepareVxWorks66, "0.1")
from buildmaster, right?

How to add a buildstep to some build factory?

More information about the devel mailing list