summaryrefslogtreecommitdiff
path: root/buildbot
diff options
context:
space:
mode:
authorYunlian Jiang <yunlian@google.com>2014-05-12 17:07:48 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-05-20 07:34:34 +0000
commitdcd020939d033baac3af23bfa157661717c61733 (patch)
treed20740691cfca171c5f91b4f4f258e3549dd5101 /buildbot
parente31064bfb15fe21c8ecfdaad2c8a1e0aac6e8ea8 (diff)
downloadchromite-dcd020939d033baac3af23bfa157661717c61733.tar.gz
chromite: respect USE flags in SDKTest stage.
This makes the SDKtest stage respect the USE flags to use the right gcc version. BUG=chromium:371970 TEST=./cbuild_bot --local toolchain-major passes. Change-Id: I46b974ffcea2d09765bd08738467fcf4226f5dac Reviewed-on: https://chromium-review.googlesource.com/199133 Reviewed-by: Han Shen <shenhan@google.com> Commit-Queue: Yunlian Jiang <yunlian@chromium.org> Tested-by: Yunlian Jiang <yunlian@chromium.org>
Diffstat (limited to 'buildbot')
-rw-r--r--buildbot/stages/build_stages.py31
-rw-r--r--buildbot/stages/generic_stages.py20
-rw-r--r--buildbot/stages/sdk_stages.py6
-rwxr-xr-xbuildbot/stages/stage_results_unittest.py1
4 files changed, 31 insertions, 27 deletions
diff --git a/buildbot/stages/build_stages.py b/buildbot/stages/build_stages.py
index 12d3dddf5..2318bbeeb 100644
--- a/buildbot/stages/build_stages.py
+++ b/buildbot/stages/build_stages.py
@@ -126,16 +126,7 @@ class InitSDKStage(generic_stages.BuilderStage):
chroot_replace: If True, force the chroot to be replaced.
"""
super(InitSDKStage, self).__init__(builder_run, **kwargs)
- self._env = {}
self.force_chroot_replace = chroot_replace
- if self._run.options.clobber:
- self._env['IGNORE_PREFLIGHT_BINHOST'] = '1'
-
- self._latest_toolchain = (self._run.config.latest_toolchain or
- self._run.options.latest_toolchain)
- if self._latest_toolchain and self._run.config.gcc_githash:
- self._env['USE'] = 'git_gcc'
- self._env['GCC_GITHASH'] = self._run.config.gcc_githash
def PerformStage(self):
chroot_path = os.path.join(self._build_root, constants.DEFAULT_CHROOT_DIR)
@@ -158,7 +149,7 @@ class InitSDKStage(generic_stages.BuilderStage):
replace=replace,
use_sdk=use_sdk,
chrome_root=self._run.options.chrome_root,
- extra_env=self._env)
+ extra_env=self._portage_extra_env)
post_ver = cros_build_lib.GetChrootVersion(chroot=chroot_path)
if pre_ver is not None and pre_ver != post_ver:
@@ -198,7 +189,7 @@ class SetupBoardStage(generic_stages.BoardSpecificBuilderStage, InitSDKStage):
self._build_root, board=self._current_board, usepkg=usepkg,
chrome_binhost_only=self._run.config.chrome_binhost_only,
force=self._run.config.board_replace,
- extra_env=self._env, chroot_upgrade=chroot_upgrade,
+ extra_env=self._portage_extra_env, chroot_upgrade=chroot_upgrade,
profile=self._run.options.profile or self._run.config.profile)
@@ -221,16 +212,6 @@ class BuildPackagesStage(generic_stages.BoardSpecificBuilderStage,
self.name += ' [%s]' % constants.USE_PGO_USE
useflags.append(constants.USE_PGO_USE)
- self._env = {}
- if useflags:
- self._env['USE'] = ' '.join(useflags)
-
- if self._run.options.chrome_root:
- self._env['CHROME_ORIGIN'] = 'LOCAL_SOURCE'
-
- if self._run.options.clobber:
- self._env['IGNORE_PREFLIGHT_BINHOST'] = '1'
-
def _GetArchitectures(self):
"""Get the list of architectures built by this builder."""
return set(self._GetPortageEnvVar('ARCH', b) for b in self._boards)
@@ -254,7 +235,7 @@ class BuildPackagesStage(generic_stages.BoardSpecificBuilderStage,
skip_chroot_upgrade=True,
chrome_root=self._run.options.chrome_root,
noworkon=noworkon,
- extra_env=self._env)
+ extra_env=self._portage_extra_env)
class BuildImageStage(BuildPackagesStage):
@@ -285,7 +266,7 @@ class BuildImageStage(BuildPackagesStage):
rootfs_verification=rootfs_verification,
version=version,
disk_layout=disk_layout,
- extra_env=self._env)
+ extra_env=self._portage_extra_env)
# Update link to latest image.
latest_image = os.readlink(self.GetImageDirSymlink('latest'))
@@ -306,14 +287,14 @@ class BuildImageStage(BuildPackagesStage):
self._build_root,
self._current_board,
disk_layout=self._run.config.disk_vm_layout,
- extra_env=self._env)
+ extra_env=self._portage_extra_env)
def _GenerateAuZip(self, image_dir):
"""Create au-generator.zip."""
if not self._pgo_generate:
commands.GenerateAuZip(self._build_root,
image_dir,
- extra_env=self._env)
+ extra_env=self._portage_extra_env)
def _HandleStageException(self, exc_info):
"""Tell other stages to not wait on us if we die for some reason."""
diff --git a/buildbot/stages/generic_stages.py b/buildbot/stages/generic_stages.py
index 41d0ebc9a..fe2ff703d 100644
--- a/buildbot/stages/generic_stages.py
+++ b/buildbot/stages/generic_stages.py
@@ -16,6 +16,7 @@ import traceback
# We import mox so that we can identify mox exceptions and pass them through
# in our exception handling code.
try:
+ # pylint: disable=F0401
import mox
except ImportError:
mox = None
@@ -106,6 +107,25 @@ class BuilderStage(object):
if self._run.options.chrome_rev:
self._chrome_rev = self._run.options.chrome_rev
+ # USE and enviroment variable settings.
+ self._portage_extra_env = {}
+ useflags = self._run.config.useflags[:]
+
+ if self._run.options.clobber:
+ self._portage_extra_env['IGNORE_PREFLIGHT_BINHOST'] = '1'
+
+ if self._run.options.chrome_root:
+ self._portage_extra_env['CHROME_ORIGIN'] = 'LOCAL_SOURCE'
+
+ self._latest_toolchain = (self._run.config.latest_toolchain or
+ self._run.options.latest_toolchain)
+ if self._latest_toolchain and self._run.config.gcc_githash:
+ useflags.append('git_gcc')
+ self._portage_extra_env['GCC_GITHASH'] = self._run.config.gcc_githash
+
+ if useflags:
+ self._portage_extra_env['USE'] = ' '.join(useflags)
+
def GetStageNames(self):
"""Get a list of the places where this stage has recorded results."""
return [self.name]
diff --git a/buildbot/stages/sdk_stages.py b/buildbot/stages/sdk_stages.py
index fae3079d8..8227b3927 100644
--- a/buildbot/stages/sdk_stages.py
+++ b/buildbot/stages/sdk_stages.py
@@ -111,7 +111,8 @@ class SDKTestStage(generic_stages.BuilderStage):
# Build a new SDK using the provided tarball.
cmd = new_chroot_cmd + ['--download', '--replace', '--nousepkg',
'--url', 'file://' + tarball_location]
- cros_build_lib.RunCommand(cmd, cwd=self._build_root)
+ cros_build_lib.RunCommand(cmd, cwd=self._build_root,
+ extra_env=self._portage_extra_env)
for board in self._boards:
cros_build_lib.PrintBuildbotStepText(board)
@@ -120,4 +121,5 @@ class SDKTestStage(generic_stages.BuilderStage):
cros_build_lib.RunCommand(cmd, cwd=self._build_root)
cmd = new_chroot_cmd + ['--', './build_packages',
'--board', board, '--nousepkg', '--skip_chroot_upgrade']
- cros_build_lib.RunCommand(cmd, cwd=self._build_root)
+ cros_build_lib.RunCommand(cmd, cwd=self._build_root,
+ extra_env=self._portage_extra_env)
diff --git a/buildbot/stages/stage_results_unittest.py b/buildbot/stages/stage_results_unittest.py
index 087855dfb..f5ef7d559 100755
--- a/buildbot/stages/stage_results_unittest.py
+++ b/buildbot/stages/stage_results_unittest.py
@@ -140,6 +140,7 @@ class BuildStagesResultsTest(cros_test_lib.TestCase):
options.buildnumber = 1234
options.chrome_rev = None
options.branch = 'dontcare'
+ options.chrome_root = False
self._manager = parallel.Manager()
self._manager.__enter__()