Ejemplo n.º 1
0
 async def _cook_recipe_step_with_prompt(self, recipe, step, count):
     try:
         await self._cook_recipe_step(recipe, step, count)
     except BuildStepError as be:
         if not self.interactive:
             raise be
         print()
         msg = be.msg
         msg += _("Select an action to proceed:")
         action = shell.prompt_multiple(msg, RecoveryActions())
         if action == RecoveryActions.SHELL:
             environ = recipe.get_recipe_env()
             if recipe.use_system_libs:
                 add_system_libs(recipe.config, environ, environ)
             shell.enter_build_environment(self.config.target_platform,
                                           be.arch,
                                           recipe.get_for_arch(
                                               be.arch, 'build_dir'),
                                           env=environ)
             raise be
         elif action == RecoveryActions.RETRY_ALL:
             shutil.rmtree(recipe.get_for_arch(be.arch, 'build_dir'))
             self.cookbook.reset_recipe_status(recipe.name)
             # propagate up to the task manager to retry the recipe entirely
             raise RetryRecipeError()
         elif action == RecoveryActions.RETRY_STEP:
             await self._cook_recipe_step(recipe, step, count)
         elif action == RecoveryActions.SKIP:
             # propagate up to the task manager to retry the recipe entirely
             raise SkipRecipeError()
         elif action == RecoveryActions.ABORT:
             raise AbortedError()
Ejemplo n.º 2
0
    def start_cooking(self):
        '''
        Cooks the recipe and all its dependencies
        '''
        recipes = [self.cookbook.get_recipe(x) for x in self.recipes]

        if self.no_deps:
            ordered_recipes = recipes
        else:
            ordered_recipes = []
            for recipe in self.recipes:
                deps = self.cookbook.list_recipe_deps(recipe)
                # remove recipes already scheduled to be built
                deps = [x for x in deps if x not in ordered_recipes]
                ordered_recipes.extend(deps)

        if self.deps_only:
            ordered_recipes = [x for x in ordered_recipes if x not in recipes]

        m.message(
            _("Building the following recipes: %s") %
            ' '.join([x.name for x in ordered_recipes]))

        i = 1
        self._static_libraries_built = []
        for recipe in ordered_recipes:
            try:
                self._cook_recipe(recipe, i, len(ordered_recipes))
            except BuildStepError as be:
                if not self.interactive:
                    raise be
                msg = be.msg
                msg += _("Select an action to proceed:")
                action = shell.prompt_multiple(msg, RecoveryActions())
                if action == RecoveryActions.SHELL:
                    shell.enter_build_environment(self.config.target_platform,
                                                  be.arch,
                                                  recipe.get_for_arch(
                                                      be.arch, 'build_dir'),
                                                  env=recipe.config.env)
                    raise be
                elif action == RecoveryActions.RETRY_ALL:
                    shutil.rmtree(recipe.get_for_arch(be.arch, 'build_dir'))
                    self.cookbook.reset_recipe_status(recipe.name)
                    self._cook_recipe(recipe, i, len(ordered_recipes))
                elif action == RecoveryActions.RETRY_STEP:
                    self._cook_recipe(recipe, i, len(ordered_recipes))
                elif action == RecoveryActions.SKIP:
                    i += 1
                    continue
                elif action == RecoveryActions.ABORT:
                    raise AbortedError()
            i += 1
Ejemplo n.º 3
0
    def start_cooking(self):
        '''
        Cooks the recipe and all its dependencies
        '''
        if self.no_deps:
            ordered_recipes = [self.cookbook.get_recipe(x) for x in
                               self.recipes]
        else:
            ordered_recipes = []
            for recipe in self.recipes:
                recipes = self.cookbook.list_recipe_deps(recipe)
                # remove recipes already scheduled to be built
                recipes = [x for x in recipes if x not in ordered_recipes]
                ordered_recipes.extend(recipes)
        m.message(_("Building the following recipes: %s") %
                  ' '.join([x.name for x in ordered_recipes]))

        i = 1
        for recipe in ordered_recipes:
            try:
                self._cook_recipe(recipe, i, len(ordered_recipes))
            except BuildStepError as be:
                if not self.interactive:
                    raise be
                msg = be.msg
                msg += _("Select an action to proceed:")
                action = shell.prompt_multiple(msg, RecoveryActions())
                if action == RecoveryActions.SHELL:
                    shell.enter_build_environment(self.config.target_platform,
                            self.config.target_arch, recipe.build_dir)
                    break
                elif action == RecoveryActions.RETRY_ALL:
                    shutil.rmtree(recipe.build_dir)
                    self.cookbook.reset_recipe_status(recipe.name)
                    self._cook_recipe(recipe, i, len(ordered_recipes))
                elif action == RecoveryActions.RETRY_STEP:
                    self._cook_recipe(recipe, i, len(ordered_recipes))
                elif action == RecoveryActions.SKIP:
                    continue
                elif action == RecoveryActions.ABORT:
                    raise AbortedError()
            i += 1