[Buildbot-devel] [USER] Variable referring to builddir ?

tom fogal tfogal at sci.utah.edu
Sat Jan 22 07:12:29 UTC 2011


brainstorm <braincode at gmail.com> writes:
> I've been scanning buildbot's documentation but I cannot find a good
> way to substitute (and get a working version) of "PREFIX_DIRTY_HACK"
> here. I recall reading about a variable such as "workdir" or
> "builddir" that pointed to "/var/lib/buildbot/bbot/runtests/build",
> but cannot find/use it on the docs now :_/

It is 'workdir', and it's part of the parent of ShellCommand or
similar.  So basically any command you can come up with accepts
'workdir'.

(Side note:
  tf at shigeru docs grep "@item workdir" *
  cfg-buildfactories.texinfo:@item workdir
  cfg-buildsteps.texinfo:@item workdir
  cfg-buildsteps.texinfo:@item workdir
  cfg-changesources.texinfo:@item workdir
  tf at shigeru docs pwd
  /home/tfogal/dev/buildbot/master/docs
That is, the docs are in the buildbot tree && very greppable.  I've had
to do this a few times myself; times like these where I remember the
argument but not which class it belongs to.  'BuildStep' is probably
the answer here.)

It defaults to the location you started the slave from, plus the
'builddir' setting you set in your builders.

I would guess your issue is that you have an environment variable that
depends on an environment variable:

  > env={
  > 'PREFIX_DIRTY_HACK' : '/var/lib/buildbot/bbot/runtests/build'
  > 'IMAGE': 'efika.dd',
  > 'PARTED': 'parted',
  > 'NEW_LOOP': '/dev/loop0',
  > 'MAPPER': '/dev/mapper/loop0',
  > 'OLD_IMG': 'maverick-installer.img',
  > 'OLD_LOOP': '/dev/loop1',
  > 'OLD_MNT': "$PREFIX_DIRTY_HACK/mnt/old_mnt",
  > 'NEW_MNT': "$PREFIX_DIRTY_HACK/mnt/new_mnt",
  > 'PATH': '/bin:/sbin:/usr/bin'
  > }))

I would just avoid setting OLD_MNT and NEW_MNT at all here.  Put them
as the first few lines of your shell script instead; I bet that'll
work.

> factory.addStep(ShellCommand(command=['/bin/bash','-ex', '-c', r"""
> #!/bin/bash -x
> 
> dd if=/dev/zero of=${IMAGE} bs=1M count=1700

i.e. right above this `dd' invocation.

Cute trick with the r""" ... """ btw; I hadn't thought of that.

HTH,

-tom




More information about the devel mailing list