Ejemplo n.º 1
0
 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())
Ejemplo n.º 2
0
 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())
Ejemplo n.º 3
0
class BuildHawkeyTest(RpgTestCase):

    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))
Ejemplo n.º 4
0
class MavenBuildTest(RpgTestCase):
    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))
Ejemplo n.º 5
0
 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())
Ejemplo n.º 6
0
class BuildTest(RpgTestCase):

    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 tearDown(self):
        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))
Ejemplo n.º 7
0
class BuildTest(RpgTestCase):
    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 tearDown(self):
        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))
Ejemplo n.º 8
0
class BuildTest(RpgTestCase):

    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 tearDown(self):
        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))
Ejemplo n.º 9
0
class BuildHawkeyTest(RpgTestCase):
    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))
Ejemplo n.º 10
0
class BuildTest(RpgTestCase):

    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)

    def tearDown(self):
        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))
Ejemplo n.º 11
0
class MavenBuildTest(RpgTestCase):

    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))
Ejemplo n.º 12
0
class BuildTest(RpgTestCase):
    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)

    def tearDown(self):
        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))