Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Buildbot scripts for Efika MX image/release engineering
#!/bin/bash
dcfldd if=/dev/$1 bs=1M count=1800 status=on statusinterval=1 | xz -z -T3 -c -e >$2
# -*- python -*-
# ex: set syntax=python:
c = BuildmasterConfig = {}
####### BUILDSLAVES
from buildbot.buildslave import BuildSlave
c['slaves'] = [BuildSlave("laila", "ooghi8Ia")]
c['slavePortnum'] = 9989
####### CHANGESOURCES
#from buildbot.changes.gitpoller import GitPoller
#c['change_source'] = GitPoller(
# 'http://git.gitorious.org/~brainstorm/efikamx/efika-kernel.git',
# branch='master', pollinterval=1200)
####### SCHEDULERS
from buildbot.scheduler import Scheduler
c['schedulers'] = []
c['schedulers'].append(Scheduler(name="all", branch=None,
treeStableTimer=None,
builderNames=["runtests"]))
####### BUILDERS
from buildbot.process.factory import BuildFactory
from buildbot.steps.source import Git
from buildbot.steps.shell import ShellCommand
factory = BuildFactory()
efika_bundle = "efika_bundle"
efika_img = "efika.dd"
descr_torrent="Ubuntu EfikaMX bundled image for general use (Ubuntu), see: powerdeveloper.org. Potentially useful for cloudbiolinux.com\n"
bundle_url="http://buildbot.nopcode.org/"+efika_bundle
factory.addStep(Git(repourl='http://git.gitorious.org/~brainstorm/efikamx/efika-kernel.git', mode='copy', branch='efikasb-10.08.00', progress=True))
## Here we assume that the following packages are installed on the
## buildslave(s): uboot-mkimage gcc-arm-linux-gnueabi kpartx mktorrent
## Those packages may be found in ubuntu natty: kernel-package >= 0.234 and qemu-user-static
## XXX: Find a less risky way to handle this.... chroot ? kvm machines ?
## /etc/sudoers: buildbot ALL=NOPASSWD: /bin/mount,/bin/umount,/bin/cp,/bin/rm,/sbin/kpartx, /usr/bin/rsync
factory.addStep(ShellCommand(command=["make", "mx51_efikamx_defconfig"], env={'ARCH': 'armhf', 'CROSS_COMPILE': 'arm-linux-gnueabi-'}))
## Uncomment if you don't want a debian package but the vanilla kernel images instead
#factory.addStep(ShellCommand(command=["make", "-j2", "uImage", "modules"], env={'ARCH': 'arm', 'CROSS_COMPILE': 'arm-linux-gnueabi-'}))
#factory.addStep(ShellCommand(command=["fakeroot", "make-kpkg", "--arch", "armel", "--subarch", "efikamx", "--initrd", "-j2", "--us",
#"--uc", "--cross-compile", "arm-linux-gnueabi-", "--revision", "9999999", "kernel_image"], env={'ARCH': 'arm', 'CROSS_COMPILE': 'arm-linux-gnueabi-'}))
factory.addStep(ShellCommand(command=["fakeroot", "make-kpkg", "--arch", "armhf", "--subarch", "efikamx", "--initrd", "-j2", "--us",
"--uc", "--cross-compile", "arm-linux-gnueabi-", "--revision", "9999999", "kernel_image"], env={'ARCH': 'armhf', 'CROSS_COMPILE': 'arm-linux-gnueabi-'}))
factory.addStep(ShellCommand(command=['/bin/bash','-ex', '-c', r"""
#!/bin/bash -x
WORKDIR=$(readlink -e .)
OLD_MNT="$WORKDIR/mnt/old_mnt"
NEW_MNT="$WORKDIR/mnt/new_mnt"
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}0p1
mkfs.ext4 -i 4096 -Linstaller ${MAPPER}0p2
mkdir -p ${NEW_MNT}
sudo mount ${MAPPER}0p2 ${NEW_MNT}
mkdir -p ${NEW_MNT}/boot
sudo mount ${MAPPER}0p1 ${NEW_MNT}/boot
losetup ${OLD_LOOP} ../${OLD_IMG}
kpartx -av ${OLD_LOOP}
mkdir -p ${OLD_MNT}
sudo mount ${MAPPER}1p2 ${OLD_MNT}
mkdir -p ${OLD_MNT}/boot
sudo mount ${MAPPER}1p1 ${OLD_MNT}/boot
sudo cp -a ${OLD_MNT}/* ${NEW_MNT}
## XXX: Signal cleanup on failure for previous
## steps too (trap ?)
sudo umount ${OLD_MNT}/boot
sudo umount ${OLD_MNT}
sudo umount ${NEW_MNT}/boot
sudo umount ${NEW_MNT}
kpartx -d ${NEW_LOOP}
kpartx -d ${OLD_LOOP}
losetup -d ${NEW_LOOP}
losetup -d ${OLD_LOOP}
sudo rm -rf ${WORKDIR}/mnt
"""],
env={
'IMAGE': efika_img,
'EFIKA_BUNDLE': efika_bundle,
'PARTED': 'parted',
'NEW_LOOP': '/dev/loop0',
'MAPPER': '/dev/mapper/loop',
'OLD_IMG': 'maverick-installer.img',
'OLD_LOOP': '/dev/loop1',
'PATH': '/bin:/sbin:/usr/bin:/usr/local/bin'
}))
#source_stamp = factory.getSourceStamp()
#efika_rev = efika_bundle+source_stamp.revision
# needed for biotorrents.net
#open(workdir+'README', 'w').write(descr_torrent)
#factory.addStep(ShellCommand(command=["tar", "cfj", efika_rev, workdir+"../linux-image*", efika_img, "README")]))
#factory.addStep(ShellCommand(command=["sudo", "rsync", "-a", efika_rev, "buildbot_brain@nopcode.org:buildbot.nopcode.org"], timeout=3600))
#factory.addStep(ShellCommand(command=["upload_to_biotorrents_as_brainstorm.pl", "-c", "10", "-l", "8", "-t", efika_rev \
# ,"-u" , efika_rev, "-w", bundle_url, efika_rev]))
from buildbot.config import BuilderConfig
c['builders'] = []
c['builders'].append(
BuilderConfig(name="runtests",
slavenames=["laila"],
factory=factory))
####### STATUS TARGETS
# 'status' is a list of Status Targets. The results of each build will be
# pushed to these targets. buildbot/status/*.py has a variety to choose from,
# including web pages, email senders, and IRC bots.
c['status'] = []
from buildbot.status import html
from buildbot.status.web import auth, authz
authz_cfg=authz.Authz(
# change any of these to True to enable; see the manual for more
# options
gracefulShutdown = False,
forceBuild = True, # use this to test your slave once it is set up
forceAllBuilds = False,
pingBuilder = False,
stopBuild = False,
stopAllBuilds = False,
cancelPendingBuild = False,
)
c['status'].append(html.WebStatus(http_port=8010, authz=authz_cfg))
####### PROJECT IDENTITY
c['projectName'] = "x90 buildbot"
c['projectURL'] = "http://nopcode.org"
c['buildbotURL'] = "http://buildbot.nopcode.org:8010/"
####### DB URL
c['db_url'] = "sqlite:///state.sqlite"
#!/bin/bash -x
DISK=$1
PARTED="parted /dev/${DISK} -aoptimal -s "
dcfldd if=/dev/zero of=/dev/${DISK} bs=1M count=9 status=on statusinterval=1
dcfldd if=/dev/zero of=/dev/${DISK} bs=1M seek=1670 status=on statusinterval=1
sync
${PARTED} mklabel msdos
${PARTED} mkpart primary ext2 0% 128M
${PARTED} mkpart primary ext2 128M 1670M
sync
mkfs.ext2 /dev/${DISK}1
mkfs.ext4 -Linstaller /dev/${DISK}2
sync
mount /dev/${DISK}2 /mnt
mkdir -p /mnt/boot
mount /dev/${DISK}1 /mnt/boot
sync
rsync -W -a --progress --numeric-ids $2/* /mnt
sync
dcfldd if=/dev/zero of=/mnt/zero status=on statusinterval=1
sync
rm -f /mnt/zero
sync
dcfldd if=/dev/zero of=/mnt/boot/zero status=on statusinterval=1
sync
rm -f /mnt/boot/zero
sync
umount /mnt/boot /mnt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment