How to use the rpg.package_builder.BuildException function in rpg

To help you get started, we’ve selected a few rpg 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 rh-lab-q / rpg / tests / mock_build / test_build_rpm.py View on Github external
def test_build_rpm_fail(self):
        with self.assertRaises(BuildException) as be:
            self.package_builder.build_rpm(self.fail_srpm,
                                           PackageBuilderTest.distro,
                                           PackageBuilderTest.arch,
                                           self.srpm)
            self.assertNotEqual(
                be.errors,
                [])
github rh-lab-q / rpg / tests / unit / test_build_rpm.py View on Github external
def test_rpm_build_err_parse(self):
        with self.assertRaises(BuildException) as be:
            PackageBuilder().build_rpm(
                "", "", "", Path(""))
            self.assertEqual(
                sorted(be.errors),
                sorted([text.decode("utf-8")
                        for text in MockedSubprocess.ErrorText]))
github rh-lab-q / rpg / tests / mock_build / test_build_rpm.py View on Github external
def test_build_rpm(self):
        with self.assertRaises(BuildException) as be:
            self.package_builder.build_rpm(self.test_srpm,
                                           PackageBuilderTest.distro,
                                           PackageBuilderTest.arch,
                                           self.srpm)
            self.assertEqual(
                be.errors,
                [])
github rh-lab-q / rpg / rpg / package_builder.py View on Github external
[
                        "mock", "--no-clean",
                        "--verbose",
                        "--root", distro + '-' + arch,
                        "--rebuild", path_to_str(srpm),
                        "--resultdir=" + path_to_str(self.temp_dir)
                    ],
                    stdout=subprocess.PIPE,
                    stderr=subprocess.STDOUT
                )
            )
        ) + list(self._check_logs(self.temp_dir))
        self._move_files(output_dir, self.temp_dir.glob("*.rpm"))
        self.mock_logs = output_dir / "mock_logs"
        self._move_files(self.mock_logs, self.temp_dir.glob("*.log"))
        raise BuildException(_ret, self.build_ret_code)
github rh-lab-q / rpg / rpg / __init__.py View on Github external
May raise RuntimeError on failed recover. """

        def build():
            self.build_srpm()
            self.build_rpm(distro, arch)

        def analyse():
            _files_to_pkgs.installed(self.base_dir, self.spec, self.sack)
            self.write_spec()

        _files_to_pkgs = FilesToPkgsPlugin()
        analyse()
        while True:
            try:
                build()
            except BuildException as be:
                if not self._plugin_engine.execute_mock_recover(be.errors):
                    if be.return_code:
                        raise RuntimeError(
                            "Build failed! See logs in '{}'"
                            .format(self._package_builder.mock_logs))
                    break
            Command("rm -rf {}".format(path_to_str(self.spec_path))).execute()
            analyse()