aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDon Garrett <dgarrett@google.com>2015-12-04 18:52:28 -0800
committerDon Garrett <dgarrett@google.com>2015-12-04 18:52:28 -0800
commit59bdd559b005508ff5ea985c0b2b60d588c86236 (patch)
tree04eabf794dd586c6bb5b0dc5f00eab5dbb49fb72
parentb12db961bfd22fb9292b80ceb64d4bf2d93b6b0e (diff)
downloadbbuildbot_config-59bdd559b005508ff5ea985c0b2b60d588c86236.tar.gz
Create bbuildbot config repository.
This contains the manifest and configuration (along with supporting code) for a brillo continuous builder config (bbuildbot). BUG=chromium:558660 TEST=Not fully testable before commit. Change-Id: I2df555014b6efc4503c3ba888a82801ec6cde9c6
-rw-r--r--.gitignore11
-rw-r--r--README.txt12
-rw-r--r--__init__.py0
-rw-r--r--builders/__init__.py0
-rw-r--r--builders/brillo_builders.py92
-rw-r--r--config_dump.json16
-rw-r--r--default.xml26
7 files changed, 157 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c541a9c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,11 @@
+# Generated files
+*.pyc
+*~
+*.swp
+.project
+.pydevproject
+
+# source cross-reference files.
+tags
+.ctags
+cscope.out
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..7e48ed8
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,12 @@
+This repository exists to configure cbuildbot based bruteus builds.
+
+To check this out as a repo checkout:
+
+ repo init -u https://android.googlesource.com/platform/bbuildbot_config
+
+To perform a local build:
+
+ bin/cbuildbot --buildroot ~/tmp/test_buildroot \
+ --buildbot --debug --config_repo \
+ https://android.googlesource.com/platform/bbuildbot_config \
+ bbuildbot
diff --git a/__init__.py b/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/__init__.py
diff --git a/builders/__init__.py b/builders/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/builders/__init__.py
diff --git a/builders/brillo_builders.py b/builders/brillo_builders.py
new file mode 100644
index 0000000..52b6206
--- /dev/null
+++ b/builders/brillo_builders.py
@@ -0,0 +1,92 @@
+# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""Module builders for bbuildbot."""
+
+from __future__ import print_function
+
+import os
+
+from chromite.lib import cros_build_lib
+from chromite.lib import osutils
+
+from chromite.cbuildbot.builders import generic_builders
+from chromite.cbuildbot.stages import generic_stages
+from chromite.cbuildbot.stages import sync_stages
+from chromite.cbuildbot import repository
+
+
+class BrilloStageBase(generic_stages.BuilderStage):
+ """Base class for all symbols build stages."""
+
+ def BrilloRoot(self):
+ # Turn /mnt/data/b/cbuild/android -> /mnt/data/b/cbuild/android_brillo
+
+ # We have to be OUTSIDE the build root, since this is a new repo checkout.
+ # We don't want to be in /tmp both because we might not fit, and because the
+ # initial sync is expensive enough that we don't want to have to redo it if
+ # avoidable.
+ return self._run.buildroot + '_brillo'
+
+ def BuildOutput(self):
+ # We store brillo build output in brillo's default output directory.
+ # (ex: brillo_root/out)
+ return os.path.join(self.BrilloRoot(), 'out')
+
+
+class BrilloCleanStage(BrilloStageBase):
+ """Compile the Brillo checkout."""
+
+ def PerformStage(self):
+ """Clean up Brillo build output."""
+ osutils.RmDir(self.BuildOutput(), ignore_missing=True)
+
+ if self._run.options.clobber:
+ osutils.RmDir(self.BrilloRoot(), ignore_missing=True)
+
+
+class BrilloSyncStage(BrilloStageBase):
+ """Sync Brillo code to a sub-directory."""
+
+ def PerformStage(self):
+ """Do the sync work."""
+ osutils.SafeMakedirs(self.BrilloRoot())
+
+ # Fetch and/or update the brillo source code.
+ brillo_repo = repository.RepoRepository(
+ manifest_repo_url=self._run.config.brillo_manifest_url,
+ branch=self._run.config.brillo_manifest_branch,
+ directory=self.BrilloRoot())
+ brillo_repo.Initialize()
+ brillo_repo.Sync()
+
+
+class BrilloBuildStage(BrilloStageBase):
+ """Compile the Brillo checkout."""
+
+ def PerformStage(self):
+ """Do the build work."""
+ cmd_list = []
+ cmd_list.append('. build/envsetup.sh')
+ cmd_list.append('lunch brilloemulator_arm-eng')
+ cmd_list.append('OUT_DIR=%s' % self.BuildOutput())
+ cmd_list.append('make -j 32')
+
+ # We use a shell invocation so environmental variables are preserved.
+ cmd = ' && '.join(cmd_list)
+ cros_build_lib.RunCommand(cmd, shell=True, cwd=self.BrilloRoot())
+
+
+class BrilloBuilder(generic_builders.Builder):
+ """Builder that performs sync, then exits."""
+
+ def GetSyncInstance(self):
+ """Returns an instance of a SyncStage that should be run."""
+ return self._GetStageInstance(sync_stages.SyncStage)
+
+ def RunStages(self):
+ """Run something after sync/reexec."""
+ self._RunStage(BrilloCleanStage)
+ self._RunStage(BrilloSyncStage)
+ self._RunStage(BrilloBuildStage)
diff --git a/config_dump.json b/config_dump.json
new file mode 100644
index 0000000..20279cd
--- /dev/null
+++ b/config_dump.json
@@ -0,0 +1,16 @@
+{
+ "_default": {
+ "boards": [],
+ "manifest_repo_url": "https://chromium.googlesource.com/chromiumos/chromite/abuildbot_config"
+ },
+ "_site_params": {
+ "ARCHIVE_URL": "gs://abuildbot-build-archive/bbuildbot"
+ },
+ "_templates": {},
+
+ "bbuildbot": {
+ "builder_class_name": "config.builders.brillo_builders.BrilloBuilder",
+ "brillo_manifest_url": "https://android.googlesource.com/brillo/manifest",
+ "brillo_manifest_branch": "master"
+ }
+}
diff --git a/default.xml b/default.xml
new file mode 100644
index 0000000..cabb867
--- /dev/null
+++ b/default.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<manifest>
+ <remote name="cros"
+ fetch="https://chromium.googlesource.com"
+ review="https://chromium-review.googlesource.com" />
+
+ <remote name="cros-internal"
+ fetch="https://chrome-internal.googlesource.com"
+ review="https://chrome-internal-review.googlesource.com" />
+
+ <default revision="refs/heads/master"
+ remote="cros" sync-j="8" />
+
+ <notice>
+Your sources have been sync'd successfully.
+ </notice>
+
+ <project path="chromite" name="chromiumos/chromite" />
+ <project path="chromite/config" name="brillo/bbuildbot_config"
+ remote="cros-internal" />
+
+ <!-- To get requirements for cros lint -->
+ <project path="chromium/tools/depot_tools"
+ name="chromium/tools/depot_tools"
+ revision="b6795643ec0305ba2ff862fcd0f450756aa5e58c" />
+</manifest>