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

brainstorm braincode at gmail.com
Fri Jan 21 21:42:11 UTC 2011

Hi guys,

Read your rationale regarding mailing lists, Dustin, I agree. Just for
convenience I will label my questions as "USER" just in case people
want to filter them :)

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 :_/

Best practices and suggestions on how to fix/improve the below mess
are welcome too :)

factory.addStep(ShellCommand(command=['/bin/bash','-ex', '-c', r"""
#!/bin/bash -x

dd if=/dev/zero of=${IMAGE} bs=1M count=1700

losetup ${NEW_LOOP} ${IMAGE}

${PARTED} ${NEW_LOOP} mklabel msdos
${PARTED} ${NEW_LOOP} mkpart primary ext2 0% 128M
${PARTED} ${NEW_LOOP} mkpart primary ext2 128M 100%

kpartx -a ${NEW_LOOP}

mkfs.ext2 ${MAPPER}p1
mkfs.ext4 -i 4096 -Linstaller ${MAPPER}p2

mkdir -p ${NEW_MNT}/boot
mkdir -p ${OLD_MNT}

sudo mount ${MAPPER}p2 ${NEW_MNT}

sudo mount ${MAPPER}p1 ${NEW_MNT}/boot

losetup ${OLD_LOOP} ${OLD_IMG}

kpartx -av ${OLD_LOOP}
sudo mount ${OLD_LOOP}p2 ${OLD_MNT}
sudo mount ${OLD_LOOP}p1 ${OLD_MNT}/boot

cp -a ${OLD_MNT}/* ${NEW_MNT}

sudo umount ${OLD_MNT} ${NEW_MNT}
losetup -d ${NEW_LOOP}
losetup -d ${OLD_LOOP}

'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'

More information about the devel mailing list