Bug 1085620 part2: Support for emulator builds in the builder image. r=lightsofapollo

The setup of builder image moved to system-setup.sh script because
needs to do more complex work, like downloading repo and installing
mozilla buildtools package.

The build-emulator.sh script is reponsible for building emulators.
Besides the REPOSITORY and REVISION environment variables, it requires
TARGET and B2G_CONFIG too.
This commit is contained in:
Wander Lairson Costa 2014-11-26 10:11:34 -08:00
parent 9e947b71c6
commit dbcd1bed96
4 changed files with 68 additions and 3 deletions

View File

@ -1,4 +1,4 @@
FROM quay.io/mozilla/base:0.0.2
FROM quay.io/mozilla/base:0.0.3
MAINTAINER Jonas Finnemann Jensen <jopsen@gmail.com>
ENV PATH $PATH:/home/worker/bin/

View File

@ -1 +1 @@
0.0.16
0.0.17

View File

@ -0,0 +1,39 @@
#! /bin/bash -vex
### Check that require variables are defined
test $REPOSITORY # Should be an hg repository url to pull from
test $REVISION # Should be an hg revision to pull down
test $TARGET
test $B2G_CONFIG
# First check if the mozharness directory is available. This is intended to be
# used locally in development to test mozharness changes:
#
# $ docker -v your_mozharness:/home/worker/mozharness ...
#
if [ ! -d mozharness ]; then
hg clone https://hg.mozilla.org/build/mozharness mozharness
fi
OBJDIR=$HOME/object-folder
mkdir -p $OBJDIR
git clone https://git.mozilla.org/b2g/B2G.git $OBJDIR/B2G
./mozharness/scripts/b2g_build.py \
--config b2g/taskcluster-emulator.py \
--disable-mock \
--work-dir=$OBJDIR/B2G \
--log-level=debug \
--target=$TARGET \
--b2g-config-dir=$B2G_CONFIG \
--checkout-revision=$REVISION \
--repo=$REPOSITORY
# Move files into artifact locations!
mkdir -p artifacts
mv $OBJDIR/B2G/sources.xml artifacts/sources.xml
mv $OBJDIR/B2G/out/target/product/generic/tests/gaia-tests.zip artifacts/gaia-tests.zip
mv $OBJDIR/B2G/out/target/product/generic/tests/b2g-*.zip artifacts/b2g-tests.zip
mv $OBJDIR/B2G/out/emulator.tar.gz artifacts/emulator.tar.gz
mv $OBJDIR/B2G/objdir-gecko/dist/b2g-*.crashreporter-symbols.zip artifacts/b2g-crashreporter-symbols.zip

View File

@ -3,6 +3,7 @@
############################### system-setup.sh ###############################
home="/home/worker"
tools_dir="/tmp/tools"
mkdir -p $home/bin
mkdir -p $home/tools
@ -10,7 +11,32 @@ mkdir -p $home/tools/tooltool-cache
wget -O $home/tools/tooltool.py https://raw.githubusercontent.com/mozilla/build-tooltool/master/tooltool.py
chown -R worker:worker /home/worker/* /home/worker/.*
chown -R worker:worker $home/* $home/.*
# Install android repo tool
curl https://storage.googleapis.com/git-repo-downloads/repo > $home/bin/repo
chmod a+x $home/bin/repo
# Install build tools
cd /tmp
hg clone http://hg.mozilla.org/build/tools/
cd $tools_dir
python setup.py install
# Put gittool and hgtool in the PATH
cp $tools_dir/buildfarm/utils/gittool.py $home/bin
cp $tools_dir/buildfarm/utils/hgtool.py $home/bin
chmod +x $home/bin/gittool.py
chmod +x $home/bin/hgtool.py
# Initialize git (makes repo happy)
git config --global user.email "docker@docker.com"
git config --global user.name "docker"
cd $home
# cleanup
rm -rf $tools_dir
# Remove the setup.sh setup, we don't really need this script anymore, deleting
# it keeps the image as clean as possible.