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

brainstorm braincode at gmail.com
Sat Jan 22 11:07:08 UTC 2011


Thanks Tom !

Yes, the """ ... """ trick is a neat one (taken from HelpfulHints in
the wiki). But there's a big downside though, I cannot use "workdir"
in the script itself, as it is interpreted as a mere string "workdir".
Any suggestions to make this work properly without resorting to the
unflexible array.split() of the shell command ?

Another issue I'm having is: I have a big iso image file (3GB) which I
don't want to download every time to buildslaves. Is there a standard
way in buildbot to declare static resources that should not be deleted
in the slaves ? Or should I just throw it to "source" directory ?

On Sat, Jan 22, 2011 at 8:12 AM, tom fogal <tfogal at sci.utah.edu> wrote:
> 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