def HandleSuccess(self):
        if self._run.config.master:
            self.sync_stage.pool.SubmitPool(
                reason=constants.STRATEGY_CQ_SUCCESS)
            if config_lib.IsPFQType(self._run.config.build_type):
                super(CommitQueueCompletionStage, self).HandleSuccess()

        manager = self._run.attrs.manifest_manager
        version = manager.current_version
        if version:
            chroot_manager = chroot_lib.ChrootManager(self._build_root)
            chroot_manager.SetChrootVersion(version)
Пример #2
0
    def PerformStage(self):
        chroot_path = os.path.join(self._build_root,
                                   constants.DEFAULT_CHROOT_DIR)
        replace = self._run.config.chroot_replace or self.force_chroot_replace
        pre_ver = post_ver = None
        if os.path.isdir(self._build_root) and not replace:
            try:
                pre_ver = cros_build_lib.GetChrootVersion(chroot=chroot_path)
                commands.RunChrootUpgradeHooks(
                    self._build_root,
                    chrome_root=self._run.options.chrome_root,
                    extra_env=self._portage_extra_env)
            except failures_lib.BuildScriptFailure:
                logging.PrintBuildbotStepText('Replacing broken chroot')
                logging.PrintBuildbotStepWarnings()
            else:
                # Clear the chroot manifest version as we are in the middle of building.
                chroot_manager = chroot_lib.ChrootManager(self._build_root)
                chroot_manager.ClearChrootVersion()

        if not os.path.isdir(chroot_path) or replace:
            use_sdk = (self._run.config.use_sdk
                       and not self._run.options.nosdk)
            pre_ver = None
            commands.MakeChroot(buildroot=self._build_root,
                                replace=replace,
                                use_sdk=use_sdk,
                                chrome_root=self._run.options.chrome_root,
                                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:
            logging.PrintBuildbotStepText('%s->%s' % (pre_ver, post_ver))
        else:
            logging.PrintBuildbotStepText(post_ver)

        commands.SetSharedUserPassword(
            self._build_root, password=self._run.config.shared_user_password)
Пример #3
0
 def setUp(self):
     self.chroot_manager = chroot_lib.ChrootManager(self.tempdir)