コード例 #1
0
    def PerformStage(self):
        with osutils.TempDir(prefix='chrome-sdk-cache') as tempdir:
            cache_dir = os.path.join(tempdir, 'cache')
            extra_args = [
                '--cwd', self.chrome_src, '--sdk-path', self.archive_path
            ]
            # Do not automatically run 'gn gen', that will be done in _BuildChrome.
            extra_args.extend(['--nogn-gen'])
            if self._ShouldEnableGoma():
                # TODO(crbug.com/751010): Revisit to enable DepsCache for
                # non-chrome-pfq bots, too.
                use_goma_deps_cache = self._run.config.name.endswith(
                    'chrome-pfq')
                goma = goma_util.Goma(self._run.options.goma_dir,
                                      self._run.options.goma_client_json,
                                      stage_name=self.StageNamePrefix()
                                      if use_goma_deps_cache else None)
                extra_args.extend(
                    ['--nostart-goma', '--gomadir', goma.goma_dir])
                self._run.attrs.metadata.UpdateWithDict(
                    {'goma_tmp_dir_for_simple_chrome': goma.goma_tmp_dir})
            else:
                goma = None

            sdk_cmd = commands.ChromeSDK(self._build_root,
                                         self._current_board,
                                         chrome_src=self.chrome_src,
                                         goma=bool(goma),
                                         extra_args=extra_args,
                                         cache_dir=cache_dir)
            self._BuildChrome(sdk_cmd, goma)
            self._TestDeploy(sdk_cmd)
コード例 #2
0
ファイル: chrome_stages.py プロジェクト: sjg20/chromite
    def PerformStage(self):
        if platform.dist()[-1] == 'lucid':
            # Chrome no longer builds on Lucid. See crbug.com/276311
            print('Ubuntu lucid is no longer supported.')
            print('Please upgrade to Ubuntu Precise.')
            logging.PrintBuildbotStepWarnings()
            return

        steps = [
            self._BuildAndArchiveChromeSysroot, self._ArchiveChromeEbuildEnv,
            self._GenerateAndUploadMetadata
        ]
        with self.ArtifactUploader(self._upload_queue, archive=False):
            parallel.RunParallelSteps(steps)

            if self._run.config.chrome_sdk_build_chrome:
                with osutils.TempDir(prefix='chrome-sdk-cache') as tempdir:
                    cache_dir = os.path.join(tempdir, 'cache')
                    extra_args = [
                        '--cwd', self.chrome_src, '--sdk-path',
                        self.archive_path
                    ]
                    sdk_cmd = commands.ChromeSDK(
                        self._build_root,
                        self._current_board,
                        chrome_src=self.chrome_src,
                        goma=self._run.config.chrome_sdk_goma,
                        extra_args=extra_args,
                        cache_dir=cache_dir)
                    self._BuildChrome(sdk_cmd)
                    self._TestDeploy(sdk_cmd)
コード例 #3
0
 def testRunCommandKwargs(self):
   """Exercise optional arguments."""
   custom_inst = commands.ChromeSDK(
       self.CWD, self.BOARD, extra_args=list(self.EXTRA_ARGS),
       chrome_src=self.CHROME_SRC, debug_log=True)
   custom_inst.Run(self.CMD, list(self.EXTRA_ARGS2))
   self.assertCommandContains(['debug', self.BOARD] + list(self.EXTRA_ARGS) +
                              list(self.EXTRA_ARGS2) + self.CMD, cwd=self.CWD)
コード例 #4
0
    def __init__(self, options):
        """Constructor.

    Args:
      options: In addition to the flags required by the base class, need to
        specify:
        * chromium_dir: Optional. If specified, use the chromium repo the path
          points to. Otherwise, use base_dir/chromium/src.
        * build_dir: Optional. Store build result to it if specified. Default:
          base_dir/build.
        * archive_build: True to archive build.
        * reuse_build: True to reuse previous build.
    """
        super(SimpleChromeBuilder, self).__init__(options)
        self.reuse_build = options.reuse_build
        self.archive_build = options.archive_build

        if 'chromium_dir' in options and options.chromium_dir:
            self.chromium_dir = options.chromium_dir
            self.repo_dir = os.path.join(self.chromium_dir, 'src')
        else:
            self.chromium_dir = os.path.join(self.base_dir, CHROMIUM_DIR)
            self.repo_dir = os.path.join(self.base_dir, self.DEFAULT_REPO_DIR)

        if 'build_dir' in options and options.build_dir:
            self.archive_base = options.build_dir
        else:
            self.archive_base = os.path.join(self.base_dir, 'build')
        if self.archive_build:
            osutils.SafeMakedirs(self.archive_base)

        self.gclient = osutils.Which('gclient')
        if not self.gclient:
            self.gclient = os.path.join(constants.DEPOT_TOOLS_DIR, 'gclient')

        self.verbose = logging.getLogger().isEnabledFor(logging.DEBUG)
        self.chrome_sdk = commands.ChromeSDK(self.repo_dir,
                                             self.board,
                                             goma=True,
                                             debug_log=self.verbose)

        # log_output=True: Instead of emitting output to STDOUT, redirect output to
        # logging.info.
        self.log_output_args = {'log_output': True}
コード例 #5
0
def _InitSimpleChromeSDK(tempdir, build_target_name, sysroot_path, chrome_root,
                         use_goma):
  """Create ChromeSDK object for executing 'cros chrome-sdk' commands.

  Args:
    tempdir (string): Tempdir for command execution.
    build_target_name (string): Board build target.
    sysroot_path (string): Sysroot for Chrome to use.
    chrome_root (string): Path to Chrome.
    use_goma (bool): Whether to use goma.

  Returns:
    A ChromeSDK object.
  """
  extra_args = ['--cwd', chrome_root, '--sdk-path', sysroot_path]
  cache_dir = os.path.join(tempdir, 'cache')

  sdk_cmd = commands.ChromeSDK(
      constants.SOURCE_ROOT, build_target_name, chrome_src=chrome_root,
      goma=use_goma, extra_args=extra_args, cache_dir=cache_dir)
  return sdk_cmd
コード例 #6
0
 def setUp(self):
   self.inst = commands.ChromeSDK(self.CWD, self.BOARD)