예제 #1
0
    def PerformStage(self):
        build_id, _ = self._run.GetCIDBHandle()
        install_plan_fn = ('/tmp/%s_install_plan.%s' %
                           (self._current_board, build_id))

        # We need to run chroot updates on most builders because they uprev after
        # the InitSDK stage. For the SDK builder, we can skip updates because uprev
        # is run prior to InitSDK. This is not just an optimization: It helps
        # workaround http://crbug.com/225509
        if self._run.config.build_type != constants.CHROOT_BUILDER_TYPE:
            usepkg_toolchain = (self._run.config.usepkg_toolchain
                                and not self._latest_toolchain)
            commands.UpdateChroot(self._build_root,
                                  toolchain_boards=[self._current_board],
                                  usepkg=usepkg_toolchain,
                                  extra_env=self._portage_extra_env,
                                  save_install_plan=install_plan_fn)

        # Always update the board.
        usepkg = self._run.config.usepkg_build_packages
        commands.SetupBoard(
            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._portage_extra_env,
            chroot_upgrade=False,
            profile=self._run.options.profile or self._run.config.profile,
            save_install_plan=install_plan_fn)
예제 #2
0
    def PerformStage(self):
        chroot_args = None
        if self._run.options.cache_dir:
            chroot_args = ['--cache-dir', self._run.options.cache_dir]

        # Ensure we don't run on SDK builder. https://crbug.com/225509
        if self._run.config.build_type != constants.CHROOT_BUILDER_TYPE:
            # Setup board's toolchain.
            usepkg_toolchain = (self._run.config.usepkg_toolchain
                                and not self._latest_toolchain)
            commands.SetupToolchains(self._build_root,
                                     usepkg=usepkg_toolchain,
                                     targets='boards',
                                     boards=self._current_board,
                                     chroot_args=chroot_args)

        # Update the board.
        usepkg = self._run.config.usepkg_build_packages

        commands.SetupBoard(self._build_root,
                            board=self._current_board,
                            usepkg=usepkg,
                            force=self._run.config.board_replace,
                            extra_env=self._portage_extra_env,
                            chroot_upgrade=False,
                            profile=self._run.options.profile
                            or self._run.config.profile,
                            chroot_args=chroot_args)
예제 #3
0
    def PerformStage(self):
        new_chroot_dir = 'new-sdk-chroot'
        tarball_location = os.path.join(self._build_root, SDK_TARBALL_NAME)
        new_chroot_args = ['--chroot', new_chroot_dir]
        if self._run.options.chrome_root:
            new_chroot_args += ['--chrome_root', self._run.options.chrome_root]

        # Build a new SDK using the provided tarball.
        chroot_args = new_chroot_args + [
            '--download', '--replace', '--nousepkg', '--url',
            'file://' + tarball_location
        ]
        cros_build_lib.run(['true'],
                           cwd=self._build_root,
                           enter_chroot=True,
                           chroot_args=chroot_args,
                           extra_env=self._portage_extra_env)

        # Inject the toolchain binpkgs from the previous sdk build.  On end user
        # systems, they'd be fetched from the binpkg mirror, but we don't have one
        # set up for this local build.
        pkgdir = os.path.join('var', 'lib', 'portage', 'pkgs')
        old_pkgdir = os.path.join(self._build_root,
                                  constants.DEFAULT_CHROOT_DIR, pkgdir)
        new_pkgdir = os.path.join(self._build_root, new_chroot_dir, pkgdir)
        osutils.SafeMakedirs(new_pkgdir, sudo=True)
        cros_build_lib.sudo_run(['cp', '-r'] +
                                glob.glob(os.path.join(old_pkgdir, '*')) +
                                [new_pkgdir])

        # Now install those toolchains in the new chroot.  We skip the chroot
        # upgrade below which means we need to install the toolchain manually.
        cmd = [
            'cros_setup_toolchains', '--targets=boards',
            '--include-boards=%s' % ','.join(self._boards)
        ]
        commands.RunBuildScript(self._build_root,
                                cmd,
                                chromite_cmd=True,
                                enter_chroot=True,
                                sudo=True,
                                chroot_args=new_chroot_args,
                                extra_env=self._portage_extra_env)

        # Build all the boards with the new sdk.
        for board in self._boards:
            logging.PrintBuildbotStepText(board)
            commands.SetupBoard(self._build_root,
                                board,
                                usepkg=True,
                                chroot_upgrade=False,
                                extra_env=self._portage_extra_env,
                                chroot_args=new_chroot_args)
            commands.Build(self._build_root,
                           board,
                           build_autotest=True,
                           usepkg=False,
                           extra_env=self._portage_extra_env,
                           chroot_args=new_chroot_args,
                           disable_revdep_logic=True)