Exemplo n.º 1
0
    def _handle_dirty(self, part, step, dirty_report):
        if step not in constants.STEPS_TO_AUTOMATICALLY_CLEAN_IF_DIRTY:
            raise errors.StepOutdatedError(
                step=step,
                part=part.name,
                dirty_properties=dirty_report.dirty_properties,
                dirty_project_options=dirty_report.dirty_project_options)

        staged_state = self.config.get_project_state('stage')
        primed_state = self.config.get_project_state('prime')

        # We need to clean this step, but if it involves cleaning the stage
        # step and it has dependents that have been built, we need to ask for
        # them to first be cleaned (at least back to the build step).
        index = common.COMMAND_ORDER.index(step)
        dependents = self.parts_config.get_dependents(part.name)
        if (index <= common.COMMAND_ORDER.index('stage')
                and not part.is_clean('stage') and dependents):
            for dependent in self.config.all_parts:
                if (dependent.name in dependents
                        and not dependent.is_clean('build')):
                    raise errors.StepOutdatedError(step=step,
                                                   part=part.name,
                                                   dependents=dependents)

        part.clean(staged_state, primed_state, step, '(out of date)')
Exemplo n.º 2
0
    def _handle_dirty(self, part, step, dirty_report, cli_config):
        dirty_action = cli_config.get_outdated_step_action()
        if step not in constants.STEPS_TO_AUTOMATICALLY_CLEAN_IF_DIRTY:
            if dirty_action == config.OutdatedStepAction.ERROR:
                raise errors.StepOutdatedError(
                    step=step,
                    part=part.name,
                    dirty_properties=dirty_report.dirty_properties,
                    dirty_project_options=dirty_report.dirty_project_options)

        staged_state = self.config.get_project_state('stage')
        primed_state = self.config.get_project_state('prime')

        # We need to clean this step, but if it involves cleaning the stage
        # step and it has dependents that have been built, the dependents need
        # to first be cleaned (at least back to the build step). Do it
        # automatically if configured to do so.
        index = common.COMMAND_ORDER.index(step)
        dependents = self.parts_config.get_dependents(part.name)
        if (index <= common.COMMAND_ORDER.index('stage')
                and not part.is_clean('stage') and dependents):
            for dependent in self.config.all_parts:
                if (dependent.name in dependents
                        and not dependent.is_clean('build')):
                    if dirty_action == config.OutdatedStepAction.ERROR:
                        raise errors.StepOutdatedError(step=step,
                                                       part=part.name,
                                                       dependents=dependents)
                    else:
                        dependent.clean(staged_state, primed_state, 'build',
                                        '(out of date)')

        part.clean(staged_state, primed_state, step, '(out of date)')
Exemplo n.º 3
0
    def _handle_outdated(self, part, step, outdated_report, cli_config):
        dirty_action = cli_config.get_outdated_step_action()
        if not step.clean_if_dirty:
            if dirty_action == config.OutdatedStepAction.ERROR:
                raise errors.StepOutdatedError(
                    step=step, part=part.name, outdated_report=outdated_report
                )

        update_function = getattr(part, "update_{}".format(step.name), None)
        if update_function:
            self._prepare_step(step=step, part=part)
            notify_part_progress(
                part,
                "Updating {} step for".format(step.name),
                "({})".format(outdated_report.get_summary()),
            )
            update_function()

            # We know we just ran this step, so rather than check, manually
            # twiddle the cache
            self._complete_step(part, step)
        else:
            getattr(self, "_re{}".format(step.name))(
                part, "({})".format(outdated_report.get_summary())
            )
Exemplo n.º 4
0
    def _handle_dirty(self, part, step, dirty_report, cli_config):
        dirty_action = cli_config.get_outdated_step_action()
        if not step.clean_if_dirty:
            if dirty_action == config.OutdatedStepAction.ERROR:
                raise errors.StepOutdatedError(step=step,
                                               part=part.name,
                                               dirty_report=dirty_report)

        getattr(self, "_re{}".format(step.name))(
            part, hint="({})".format(dirty_report.get_summary()))
Exemplo n.º 5
0
    def _handle_dirty(self, part, step, dirty_report, cli_config):
        dirty_action = cli_config.get_outdated_step_action()
        if not step.clean_if_dirty:
            if dirty_action == config.OutdatedStepAction.ERROR:
                raise errors.StepOutdatedError(
                    step=step, part=part.name,
                    dirty_properties=dirty_report.dirty_properties,
                    dirty_project_options=dirty_report.dirty_project_options,
                    changed_dependencies=dirty_report.changed_dependencies)

        getattr(self, '_re{}'.format(step.name))(part, hint='(out of date)')