How to use the rebasehelper.helpers.path_helper.PathHelper.find_all_files function in rebasehelper

To help you get started, we’ve selected a few rebasehelper examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github rebase-helper / rebase-helper / rebasehelper / plugins / build_tools / srpm / rpmbuild.py View on Github external
spec_loc, spec_name = os.path.split(spec)
        output = os.path.join(results_dir, "build.log")

        cmd = [cls.CMD, '-bs', spec_name]

        if srpm_builder_options is not None:
            cmd.extend(srpm_builder_options)

        ret = ProcessHelper.run_subprocess_cwd_env(cmd,
                                                   cwd=spec_loc,
                                                   env={'HOME': workdir},
                                                   output_file=output)

        build_log_path = os.path.join(srpm_results_dir, 'build.log')
        logs = []
        for l in PathHelper.find_all_files(results_dir, '*.log'):
            logs.append(os.path.join(srpm_results_dir, os.path.basename(l)))

        if ret == 0:
            return PathHelper.find_first_file(workdir, '*.src.rpm'), logs
        # An error occurred, raise an exception
        raise SourcePackageBuildError("Building SRPM failed!", logfile=build_log_path, logs=logs)
github rebase-helper / rebase-helper / rebasehelper / plugins / build_tools / rpm / rpmbuild.py View on Github external
output = os.path.join(results_dir, "build.log")

        cmd = [cls.CMD, '--rebuild', srpm]
        if builder_options is not None:
            cmd.extend(builder_options)
        ret = ProcessHelper.run_subprocess_cwd_env(cmd,
                                                   env={'HOME': workdir},
                                                   output_file=output)

        build_log_path = os.path.join(rpm_results_dir, 'build.log')
        logs = []
        for log in PathHelper.find_all_files(results_dir, '*.log'):
            logs.append(os.path.join(rpm_results_dir, os.path.basename(log)))

        if ret == 0:
            return [f for f in PathHelper.find_all_files(workdir, '*.rpm') if not f.endswith('.src.rpm')], logs
        # An error occurred, raise an exception
        raise BinaryPackageBuildError("Building RPMs failed!", results_dir, logfile=build_log_path, logs=logs)
github rebase-helper / rebase-helper / rebasehelper / build_helper.py View on Github external
def _build_env_exit_callback(self, results_dir, **kwargs):
        """
        The function that is called just before the destruction of the TemporaryEnvironment.
        It copies packages and logs into the results directory.

        :param results_dir: absolute path to results directory
        :return:
        """
        os.makedirs(results_dir)
        log_message = "Copying '%s' '%s' to '%s'"
        # copy logs
        for log in PathHelper.find_all_files(kwargs[self.TEMPDIR_RESULTS], '*.log'):
            logger.debug(log_message, 'log', log, results_dir)
            shutil.copy(log, results_dir)
        # copy packages
        for package in PathHelper.find_all_files(kwargs[self.TEMPDIR], '*.rpm'):
            logger.debug(log_message, 'package', package, results_dir)
            shutil.copy(package, results_dir)
github rebase-helper / rebase-helper / rebasehelper / plugins / build_tools / rpm / rpmbuild.py View on Github external
the second is a list of paths to logs.

        """
        logger.info("Building RPMs")
        output = os.path.join(results_dir, "build.log")

        cmd = [cls.CMD, '--rebuild', srpm]
        if builder_options is not None:
            cmd.extend(builder_options)
        ret = ProcessHelper.run_subprocess_cwd_env(cmd,
                                                   env={'HOME': workdir},
                                                   output_file=output)

        build_log_path = os.path.join(rpm_results_dir, 'build.log')
        logs = []
        for log in PathHelper.find_all_files(results_dir, '*.log'):
            logs.append(os.path.join(rpm_results_dir, os.path.basename(log)))

        if ret == 0:
            return [f for f in PathHelper.find_all_files(workdir, '*.rpm') if not f.endswith('.src.rpm')], logs
        # An error occurred, raise an exception
        raise BinaryPackageBuildError("Building RPMs failed!", results_dir, logfile=build_log_path, logs=logs)
github rebase-helper / rebase-helper / rebasehelper / build_helper.py View on Github external
def _build_env_exit_callback(self, results_dir, **kwargs):
        """
        The function that is called just before the destruction of the TemporaryEnvironment.
        It copies packages and logs into the results directory.

        :param results_dir: absolute path to results directory
        :return:
        """
        os.makedirs(results_dir)
        log_message = "Copying '%s' '%s' to '%s'"
        # copy logs
        for log in PathHelper.find_all_files(kwargs[self.TEMPDIR_RESULTS], '*.log'):
            logger.debug(log_message, 'log', log, results_dir)
            shutil.copy(log, results_dir)
        # copy packages
        for package in PathHelper.find_all_files(kwargs[self.TEMPDIR], '*.rpm'):
            logger.debug(log_message, 'package', package, results_dir)
            shutil.copy(package, results_dir)
github rebase-helper / rebase-helper / rebasehelper / plugins / build_tools / srpm / mock.py View on Github external
cmd.extend(['--sources', path_to_sources])
        cmd.extend(['--resultdir', results_dir])

        if not check_mock_privileges():
            cmd = ['pkexec'] + cmd

        ret = ProcessHelper.run_subprocess_cwd_env(cmd,
                                                   cwd=spec_loc,
                                                   env={'HOME': workdir},
                                                   output_file=output)

        build_log_path = os.path.join(srpm_results_dir, 'build.log')
        mock_log_path = os.path.join(srpm_results_dir, 'mock_output.log')
        root_log_path = os.path.join(srpm_results_dir, 'root.log')
        logs = []
        for log in PathHelper.find_all_files(results_dir, '*.log'):
            logs.append(os.path.join(srpm_results_dir, os.path.basename(log)))

        if ret == 0:
            return PathHelper.find_first_file(workdir, '*.src.rpm'), logs
        if ret == 1:
            if not os.path.exists(build_log_path) and os.path.exists(mock_log_path):
                logfile = mock_log_path
            else:
                logfile = build_log_path
        else:
            logfile = root_log_path
        raise SourcePackageBuildError("Building SRPM failed!", logfile=logfile, logs=logs)
github rebase-helper / rebase-helper / rebasehelper / plugins / build_tools / rpm / mock.py View on Github external
output = os.path.join(results_dir, "mock_output.log")

        cmd = [cls.CMD, '--old-chroot', '--rebuild', srpm, '--resultdir', results_dir]
        if root is not None:
            cmd.extend(['--root', root])
        if arch is not None:
            cmd.extend(['--arch', arch])
        if builder_options is not None:
            cmd.extend(builder_options)

        if not check_mock_privileges():
            cmd = ['pkexec'] + cmd

        ret = ProcessHelper.run_subprocess(cmd, output_file=output)
        logs = []
        for log in PathHelper.find_all_files(results_dir, '*.log'):
            logs.append(os.path.join(rpm_results_dir, os.path.basename(log)))

        if ret == 0:
            return [f for f in PathHelper.find_all_files(results_dir, '*.rpm') if not f.endswith('.src.rpm')], logs
        else:
            logfile = get_mock_logfile_path(ret, rpm_results_dir, tmp_path=results_dir)
        raise BinaryPackageBuildError("Building RPMs failed!", rpm_results_dir, logfile=logfile, logs=logs)