def test_maven_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( r"https://github.com/apache/commons-compress/archive/rel/1.10.zip") self.base.spec.Name = "commonsCompress" self.base.spec.Version = "1.10" self.base.spec.Release = "1" self.base.spec.License = "ASL 2.0" self.base.spec.Summary = ( "Commons Compress is a Java library for working with various" "compression and archiving formats.") self.base.spec.description = ( "The Apache Commons Compress library defines an API for working " "with ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200, bzip2, " "7z, arj, lzma, snappy, DEFLATE and Z files.") self.base.spec.URL = ( r"http://commons.apache.org/proper/commons-compress/") self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover(self.base.target_distro, self.base.target_arch) os.remove(str(self.base.srpm_path)) os.remove(str(self.base.spec_path))
def test_libhif(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( "https://github.com/rpm-software-management/libhif/" "archive/libhif_0_2_1.zip") self.base.spec.Name = "LibHif" self.base.spec.Version = "0.6.11" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "Library ..." self.base.spec.description = ("LibHif ...") self.base.spec.URL =\ "https://github.com/rpm-software-management/libhif" self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover(self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path)
class BaseTest(RpgTestCase): def setUp(self): self.base = Base() def test_checksum(self): shasum = self.base.compute_checksum(self.test_project_dir / "patch") self.assertEqual("11cd391", shasum) shasum2 = self.base.compute_checksum(self.test_project_dir / "patch" / "0.patch") self.assertEqual("db72099", shasum2) def test_base_dir(self): self.assertRaises(RuntimeError, getattr, self.base, "base_dir") self.base.process_archive_or_dir(self.test_project_dir / "c") self.assertEqual("/tmp/rpg-c-2fd57e1", str(self.base.base_dir))
def main(): base = Base() app = QApplication(sys.argv) base.conf.parse_cmdline() base.load_plugins() wiz = Wizard(base) wiz.setObjectName("RPG") wiz.resize(850, 650) wiz.setMinimumSize(QtCore.QSize(850, 650)) wiz.setMaximumSize(QtCore.QSize(850, 650)) wiz.setBaseSize(QtCore.QSize(850, 650)) wiz.show() logging.info('GUI loaded') sys.exit(app.exec_())
def test_libhif(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( "https://github.com/rpm-software-management/libhif/" "archive/libhif_0_2_1.zip") self.base.spec.Name = "LibHif" self.base.spec.Version = "0.6.11" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "Library ..." self.base.spec.description = ( "LibHif ...") self.base.spec.URL =\ "https://github.com/rpm-software-management/libhif" self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path)
class BaseTest(RpgTestCase): def setUp(self): self.base = Base() def test_checksum(self): shasum = self.base._compute_checksum(self.test_project_dir / "patch") self.assertTrue(re.match(r"^[0-9a-fA-F]{7}$", shasum)) shasum2 = self.base._compute_checksum(self.test_project_dir / "patch" / "0.patch") self.assertTrue(re.match(r"^[0-9a-fA-F]{7}$", shasum2)) def test_base_dir(self): self.assertRaises(RuntimeError, getattr, self.base, "base_dir") self.base.load_project_from_url(self.test_project_dir / "c") self.assertTrue( re.match(r"^\/tmp\/rpg-c-[0-9a-fA-F]+$", str(self.base.base_dir)))
def test_hawkey_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( r"https://github.com/rpm-software-management/" "hawkey/archive/hawkey-0.5.7-1.tar.gz") self.base.spec.Name = "hawkey" self.base.spec.Version = "0.6.0" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "LGPLv2+" self.base.spec.Summary = ("Library providing simplified " "C and Python API to libsolv") self.base.spec.description = ("A Library providing simplified " "C and Python API to libsolv.") self.base.spec.URL = (r"https://github.com/rpm-" "software-management/%{name}") self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.spec.build.append(["make doc-man"]) self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) os.remove(str(self.base.srpm_path)) os.remove(str(self.base.spec_path))
def test_maven_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( r"https://github.com/apache/commons-compress/archive/rel/1.10.zip") self.base.spec.Name = "commonsCompress" self.base.spec.Version = "1.10" self.base.spec.Release = "1" self.base.spec.License = "ASL 2.0" self.base.spec.Summary = ( "Commons Compress is a Java library for working with various" "compression and archiving formats.") self.base.spec.description = ( "The Apache Commons Compress library defines an API for working " "with ar, cpio, Unix dump, tar, zip, gzip, XZ, Pack200, bzip2, " "7z, arj, lzma, snappy, DEFLATE and Z files.") self.base.spec.URL = ( r"http://commons.apache.org/proper/commons-compress/") self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) os.remove(str(self.base.srpm_path)) os.remove(str(self.base.spec_path))
class GuessTest(RpgTestCase): def setUp(self): self.base = Base() def test_guess_name(self): self.base._input_name = self.test_project_dir self.assertEqual(str(self.base.guess_name()), str(self.test_project_dir)) self.base._input_name = "vec.zip" self.assertEqual(str(self.base.guess_name()), "vec") self.base._input_name = "vec.tar.gz" self.assertEqual(str(self.base.guess_name()), "vec") self.base._input_name = "vec.zip.zip" self.assertEqual(str(self.base.guess_name()), "vec.zip") def test_guess_name_fail(self): self.base._input_name = self.test_project_dir / "NotADir" self.assertEqual(str(self.base.guess_name()), str(""))
class BaseTest(RpgTestCase): def setUp(self): self.base = Base() def test_checksum(self): shasum = self.base.compute_checksum(self.test_project_dir / "patch") self.assertTrue(re.match(r"^[0-9a-fA-F]{7}$", shasum)) shasum2 = self.base.compute_checksum(self.test_project_dir / "patch" / "0.patch") self.assertTrue(re.match(r"^[0-9a-fA-F]{7}$", shasum2)) def test_base_dir(self): self.assertRaises(RuntimeError, getattr, self.base, "base_dir") self.base.load_project_from_url(self.test_project_dir / "c") self.assertTrue(re.match(r"^\/tmp\/rpg-c-[0-9a-fA-F]+$", str(self.base.base_dir)))
def test_hawkey_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( r"https://github.com/rpm-software-management/" "hawkey/archive/hawkey-0.5.7-1.tar.gz") self.base.spec.Name = "hawkey" self.base.spec.Version = "0.6.0" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "LGPLv2+" self.base.spec.Summary = ("Library providing simplified " "C and Python API to libsolv") self.base.spec.description = ("A Library providing simplified " "C and Python API to libsolv.") self.base.spec.URL = (r"https://github.com/rpm-" "software-management/%{name}") self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.spec.build.append(["make doc-man"]) self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.spec.BuildRequires.update( set([ 'expat-devel', 'rpm-devel', 'zlib-devel', 'check-devel', 'libsolv-tools', 'python-nose', 'python-devel' ])) self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover(self.base.target_distro, self.base.target_arch) os.remove(str(self.base.srpm_path)) os.remove(str(self.base.spec_path))
def test_rpg_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url("https://github.com/openSUSE/libsolv") self.base.spec.Name = "LibSolv" self.base.spec.Version = "0.6.11" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "Library for solving repository info" self.base.spec.description = ( "This is libsolv, a free package dependency solver " "using a satisfiability algorithm.") self.base.spec.URL = "https://github.com/openSUSE/libsolv" self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.spec.build = Command([ r'cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo ' r'-DENABLE_PERL=1 ' r'-DENABLE_PYTHON=1 ' r'-DENABLE_RUBY=1 ' r'-DUSE_VENDORDIRS=1 ' r'-DFEDORA=1 ' r'-DENABLE_LZMA_COMPRESSION=1' "make" ]) self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover(self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path)
def test_rpg_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( "https://github.com/rh-lab-q/rpg/archive/master.zip") self.base.spec.Name = "rpg" self.base.spec.Version = "0.0.2" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "RPM Package Generator" self.base.spec.description = ( "RPG is tool, that guides people through" "the creation of a RPM package. RPG makes packaging much easier" "due to the automatic analysis of packaged files. Beginners can" "get familiar with packaging process or the advanced users can" "use our tool for a quick creation of a package.") self.base.spec.URL = "https://github.com/rh-lab-q/rpg" self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.spec.Requires.update(['makedepend', 'mock']) self.base.spec.BuildRequires.update(['makedepend', 'mock', 'python3-nose']) self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.spec.check = Command(["make test-unit"]) self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path)
def __init__(self, parent=None): super(Wizard, self).__init__(parent) self.base = Base() self.setWindowTitle(self.tr("RPG")) self.setWizardStyle(self.ClassicStyle) # Setting pages to wizard self.setPage(self.PageGreetings, GreetingsPage()) self.setPage(self.PageImport, ImportPage(self)) self.setPage(self.PageScripts, ScriptsPage(self)) self.setPage(self.PagePatches, PatchesPage(self)) self.setPage(self.PageRequires, RequiresPage(self)) self.setPage(self.PageScriplets, ScripletsPage(self)) self.setPage(self.PageSubpackages, SubpackagesPage(self)) self.setPage(self.PageDocsChangelog, DocsChangelogPage(self)) self.setPage(self.PageBuild, BuildPage(self)) self.setPage(self.PageCopr, CoprPage(self)) self.setPage(self.PageFinal, FinalPage(self)) self.setStartId(self.PageGreetings)
def test_rpg_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( self.test_project_dir / "archives/rpg-0.0.2-1.tar.gz") self.base.spec.Name = "rpg" self.base.spec.Version = "0.0.2" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "RPM Package Generator" self.base.spec.description = ( "RPG is tool, that guides people through" "the creation of a RPM package. RPG makes packaging much easier" "due to the automatic analysis of packaged files. Beginners can" "get familiar with packaging process or the advanced users can" "use our tool for a quick creation of a package.") self.base.spec.URL = "https://github.com/rh-lab-q/rpg" self.base.target_arch = "i386" self.base.target_distro = "fedora-22" self.base.spec.check.append(["make test"]) self.base.spec.Requires.update(['makedepend', 'mock']) self.base.spec.BuildRequires.update(['makedepend', 'mock', 'python3-nose']) self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path) for _rpm in self.base.rpm_path: os.remove(str(_rpm)) os.remove(str(self.base.srpm_path)) os.remove(str(self.base.spec_path))
def main(): base = Base() app = QApplication(sys.argv) base.conf.parse_cmdline() if base.conf.load_dnf: base.sack = base.load_dnf_sack() base.load_plugins() wiz = Wizard(base) wiz.setObjectName("RPG") wiz.resize(850, 650) wiz.setMinimumSize(QtCore.QSize(850, 650)) wiz.setMaximumSize(QtCore.QSize(850, 650)) wiz.setBaseSize(QtCore.QSize(850, 650)) wiz.show() logging.info('GUI loaded') sys.exit(app.exec_())
def test_rpg_project(self): self.base = Base() self.base.sack = self.base.load_dnf_sack() self.base.load_plugins() self.base.load_project_from_url( "https://github.com/openSUSE/libsolv") self.base.spec.Name = "LibSolv" self.base.spec.Version = "0.6.11" self.base.spec.Release = "1%{?snapshot}%{?dist}" self.base.spec.License = "GPLv2" self.base.spec.Summary = "Library for solving repository info" self.base.spec.description = ( "This is libsolv, a free package dependency solver " "using a satisfiability algorithm.") self.base.spec.URL = "https://github.com/openSUSE/libsolv" self.base.target_arch = "x86_64" self.base.target_distro = "fedora-22" self.base.fetch_repos(self.base.target_distro, self.base.target_arch) self.base.run_extracted_source_analysis() self.base.run_patched_source_analysis() self.base.spec.build = Command([ r'cmake . -DCMAKE_BUILD_TYPE=RelWithDebInfo ' r'-DENABLE_PERL=1 ' r'-DENABLE_PYTHON=1 ' r'-DENABLE_RUBY=1 ' r'-DUSE_VENDORDIRS=1 ' r'-DFEDORA=1 ' r'-DENABLE_LZMA_COMPRESSION=1' "make"]) self.base.build_project() self.base.run_compiled_source_analysis() self.base.install_project() self.base.run_installed_source_analysis() self.base.build_srpm() self.assertTrue(self.base.srpm_path.exists()) self.base.build_rpm_recover( self.base.target_distro, self.base.target_arch) self.assertTrue(self.base.rpm_path)
def test_c_project(self): base = Base() base.load_plugins() base.load_project_from_url(self.test_project_dir / "hello_project/hello-1.4.tar.gz") base.spec.Name = "hello" base.spec.Version = "1.4" base.spec.Release = "1%{?dist}" base.spec.License = "GPLv2" base.spec.Summary = "Hello World test program" base.spec.description = "desc" base.spec.build = "make" base.run_extracted_source_analysis() base.run_patched_source_analysis() expected = { '/usr/include/stdio.h', } dirs = ["Makefile", "hello.c", "hello"] base.run_installed_source_analysis() self.assertEqual(set(["make"]), base.spec.BuildRequires) self.assertTrue( [ele for ele in base.spec.required_files if ele in expected]) self.assertTrue( [ele for ele in base.spec.build_required_files if ele in expected]) self.assertExistInDir(["Makefile", "hello.c"], base.extracted_dir) base.build_project() self.assertExistInDir(dirs, base.compiled_dir) base.run_compiled_source_analysis() base.install_project() base.run_installed_source_analysis() self.assertEqual(set([("/hello", None, None)]), base.spec.files) base.build_srpm() self.assertTrue(base.srpm_path.exists())
def test_c_project(self): base = Base() base.load_plugins() base.load_project_from_url(self.test_project_dir / "hello_project/hello-1.4.tar.gz") base.spec.Name = "hello" base.spec.Version = "1.4" base.spec.Release = "1%{?dist}" base.spec.License = "GPLv2" base.spec.Summary = "Hello World test program" base.spec.description = "desc" base.spec.build = "make" base.run_extracted_source_analysis() base.run_patched_source_analysis() expected = {"/usr/include/stdio.h"} dirs = ["Makefile", "hello.c", "hello"] base.run_installed_source_analysis() self.assertEqual(set(["make"]), base.spec.BuildRequires) self.assertTrue([ele for ele in base.spec.required_files if ele in expected]) self.assertTrue([ele for ele in base.spec.build_required_files if ele in expected]) self.assertExistInDir(["Makefile", "hello.c"], base.extracted_dir) base.build_project() self.assertExistInDir(dirs, base.compiled_dir) base.run_compiled_source_analysis() base.install_project() base.run_installed_source_analysis() self.assertEqual(set([("/hello", None, None)]), base.spec.files) base.build_srpm() self.assertTrue(base.srpm_path.exists())
def setUp(self): self.base = Base() self.base.load_plugins()
def test_c_project(self): base = Base() base.load_plugins() base.load_project_from_url( self.test_project_dir / "hello_project/hello-1.4.tar.gz") base.spec.Name = "hello" base.spec.Version = "1.4" base.spec.Release = "1%{?dist}" base.spec.License = "GPLv2" base.spec.Summary = "Hello World test program" base.spec.description = "desc" base.spec.build = "make" base.run_raw_sources_analysis() base.run_patched_sources_analysis() expected_required_files = { "/usr/include/gnu", "/usr/include", "/usr/include/sys", "/usr/include/bits" } expected_build_required_files = { "/usr/include/gnu", "/usr/include", "/usr/include/sys", "/usr/include/bits" } dirs = [ "Makefile", "hello.c", "hello" ] base.run_installed_analysis() self.assertEqual(set(["make"]), base.spec.BuildRequires) self.assertEqual(expected_required_files, set(base.spec.required_files)) self.assertEqual(expected_build_required_files, set(base.spec.build_required_files)) self.assertExistInDir(["Makefile", "hello.c"], base.extracted_dir) base.build_project() self.assertExistInDir(dirs, base.compiled_dir) base.run_compiled_analysis() base.install_project() base.run_installed_analysis() self.assertEqual([ ("/hello", None, None), ("/__pycache__/", r"%exclude", None) ].sort(), base.spec.files.sort()) base.build_srpm() self.assertTrue(base.srpm_path.exists())
def setUp(self): self.base = Base()