def PerformStage(self): # This prepares depot_tools in the source tree, in advance. self.DepotToolsEnsureBootstrap() 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_sdk_lib.GetChrootVersion(chroot=chroot_path) if pre_ver is not None: 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() 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, use_image=self._run.config.chroot_use_image) post_ver = cros_sdk_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)
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)