Example #1
0
    def bundle(self):
        # If not devel wanted, we make a clean bundle with only
        # file needed to execute
        steps = [("prepare-install-dir", [
            (_("Copy install path"), self._copy_installdir, True),
            (_("Installing bundle files"), self._install_bundle_specific_files,
             True),
            (_("Make all paths relatives"), self._make_paths_relative, True),
        ]),
                 ("generate-tarball", [(_("Running AppImageAssistant"),
                                        self._generate_bundle, True),
                                       (_("Generating md5"),
                                        self._generate_md5sum, True)]),
                 ("clean-install-dir", [(_("Clean tmp dirs"), self._clean_tmps,
                                         not self.keep_temp)])]

        for step in steps:
            shell.set_logfile_output(
                "%s/%s-bundle-%s.log" %
                (self.config.logs, self.package.name, step[0]))
            for substep in step[1]:
                m.build_step('1', '1', self.package.name + " linux bundle",
                             substep[0])
                if substep[2] is True:
                    substep[1]()
                else:
                    m.action(_("Step not wanted"))
            shell.close_logfile_output()
Example #2
0
    def _cook_recipe(self, recipe, count, total):
        if not self.cookbook.recipe_needs_build(recipe.name) and \
                not self.force:
            m.build_step(count, total, recipe.name, _("already built"))
            return

        if self.missing_files:
            # create a temp file that will be used to find newer files
            tmp = tempfile.NamedTemporaryFile()

        recipe.force = self.force
        for desc, step in recipe.steps:
            m.build_step(count, total, recipe.name, step)
            # check if the current step needs to be done
            if self.cookbook.step_done(recipe.name, step) and not self.force:
                m.action(_("Step done"))
                continue
            try:
                # call step function
                stepfunc = getattr(recipe, step)
                if not stepfunc:
                    raise FatalError(_('Step %s not found') % step)
                shell.set_logfile_output("%s/%s-%s.log" %
                                         (recipe.config.logs, recipe, step))
                stepfunc()
                # update status successfully
                self.cookbook.update_step_status(recipe.name, step)
                shell.close_logfile_output()
            except FatalError, e:
                shell.close_logfile_output(dump=True)
                self._handle_build_step_error(recipe, step, e.arch)
            except Exception:
                shell.close_logfile_output(dump=True)
                raise BuildStepError(recipe, step, traceback.format_exc())
Example #3
0
    def bundle(self):
        # If not devel wanted, we make a clean bundle with only
        # file needed to execute
        steps = [
            ("prepare-install-dir",
             [(_("Copy install path"), self._copy_installdir, True),
              (_("Installing bundle files"), self._install_bundle_specific_files, True),
              (_("Make all paths relatives"), self._make_paths_relative, True),
              ]
            ),
            ("generate-tarball",
             [(_("Running AppImageAssistant"), self._generate_bundle, True),
              (_("Generating md5"), self._generate_md5sum, True)
             ]
            ),
            ("clean-install-dir",
             [(_("Clean tmp dirs"), self._clean_tmps, not self.keep_temp)]
            )
        ]

        for step in steps:
            shell.set_logfile_output("%s/%s-bundle-%s.log" % (self.config.logs, self.package.name, step[0]))
            for substep in step[1]:
                m.build_step('1', '1', self.package.name + " linux bundle", substep[0])
                if substep[2] is True:
                    substep[1]()
                else:
                    m.action(_("Step not wanted"))
            shell.close_logfile_output()
Example #4
0
    def _cook_recipe(self, recipe, count, total):
        if not self.cookbook.recipe_needs_build(recipe.name) and \
                not self.force:
            m.build_step(count, total, recipe.name, _("already built"))
            return

        if self.missing_files:
            # create a temp file that will be used to find newer files
            tmp = tempfile.NamedTemporaryFile()

        recipe.force = self.force
        for desc, step in recipe.steps:
            m.build_step(count, total, recipe.name, step)
            # check if the current step needs to be done
            if self.cookbook.step_done(recipe.name, step) and not self.force:
                m.action(_("Step done"))
                continue
            try:
                # call step function
                stepfunc = getattr(recipe, step)
                if not stepfunc:
                    raise FatalError(_('Step %s not found') % step)
                shell.set_logfile_output("%s/%s-%s.log" % (recipe.config.logs, recipe, step))
                stepfunc()
                # update status successfully
                self.cookbook.update_step_status(recipe.name, step)
                shell.close_logfile_output()
            except FatalError, e:
                shell.close_logfile_output(dump=True)
                self._handle_build_step_error(recipe, step, e.arch)
            except Exception:
                shell.close_logfile_output(dump=True)
                raise BuildStepError(recipe, step, traceback.format_exc())
Example #5
0
    def _cook_recipe(self, recipe, count, total):
        if not self.cookbook.recipe_needs_build(recipe.name) and \
                not self.force:
            m.build_step(count, total, recipe.name, _("already built"))
            return

        if self.missing_files:
            # create a temp file that will be used to find newer files
            tmp = tempfile.NamedTemporaryFile()

        recipe.force = self.force
        for desc, step in recipe.steps:
            m.build_step(count, total, recipe.name, step)
            # check if the current step needs to be done
            if self.cookbook.step_done(recipe.name, step) and not self.force:
                m.action(_("Step done"))
                continue
            try:
                # call step function
                stepfunc = getattr(recipe, step)
                if not stepfunc:
                    raise FatalError(_('Step %s not found') % step)
                shell.set_logfile_output("%s/%s-%s.log" %
                                         (recipe.config.logs, recipe, step))
                stepfunc()
                # update status successfully
                self.cookbook.update_step_status(recipe.name, step)
                shell.close_logfile_output()
            except FatalError as e:
                shell.close_logfile_output(dump=True)
                exc_traceback = sys.exc_info()[2]
                trace = ''
                # Don't print trace if the FatalError is merely that the
                # subprocess exited with a non-zero status. The traceback
                # is just confusing and useless in that case.
                if not isinstance(e.__context__, CalledProcessError):
                    tb = traceback.extract_tb(exc_traceback)[-1]
                    if tb.filename.endswith('.recipe'):
                        # Print the recipe and line number of the exception
                        # if it starts in a recipe
                        trace += 'Exception at {}:{}\n'.format(
                            tb.filename, tb.lineno)
                    trace += e.args[0] + '\n'
                self._handle_build_step_error(recipe, step, trace, e.arch)
            except Exception:
                shell.close_logfile_output(dump=True)
                raise BuildStepError(recipe, step, traceback.format_exc())
        self.cookbook.update_build_status(recipe.name, recipe.built_version())

        if self.missing_files:
            self._print_missing_files(recipe, tmp)
            tmp.close()