Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"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 md5Tar(self, t):
mdsum = Command(
"tar --list -f " + path_to_str(t) + " 2>/dev/null | "
"awk -F/ '{ if($NF != \"\") print $NF }' | "
r'sed -e "s/.*\///gm" | sort | md5sum'
).execute()
self.assertNotEqual(self.FNF_MD5, mdsum)
return mdsum
def test_new_line(self):
cmd = Command("a\nb\n")
self.assertEqual("a\nb", str(cmd))
def setUp(self):
self._source_loader = SourceLoader()
self._tar = None
self._tar_dir = self.test_project_dir / "archives"
self._tar_gz = self.test_project_dir / "archives" / "sample.tar.gz"
self._tar_xz = self.test_project_dir / "archives" / "sample.tar.xz"
self._tar_temp = Path("/var/tmp/rpg_test/")
self._tar_extracted = self._tar_temp / "extracted"
self._download = self._tar_temp / "download.tar.gz"
if path.isdir(path_to_str(self._tar_temp)):
rmtree(path_to_str(self._tar_temp))
makedirs(path_to_str(self._tar_temp))
makedirs(path_to_str(self._tar_extracted))
def md5Tar(self, t):
mdsum = Command(
"tar --list -f " + path_to_str(t) + " 2>/dev/null | "
"awk -F/ '{ if($NF != \"\") print $NF }' | "
r'sed -e "s/.*\///gm" | sort | md5sum'
).execute()
self.assertNotEqual(self.FNF_MD5, mdsum)
return mdsum
def tearDown(self):
if self._tar:
remove(path_to_str(self._tar))
if path.isdir(path_to_str(self._tar_temp)):
rmtree(path_to_str(self._tar_temp))
def setUp(self):
self._source_loader = SourceLoader()
self._tar = None
self._tar_dir = self.test_project_dir / "archives"
self._tar_gz = self.test_project_dir / "archives" / "sample.tar.gz"
self._tar_xz = self.test_project_dir / "archives" / "sample.tar.xz"
self._tar_temp = Path("/var/tmp/rpg_test/")
self._tar_extracted = self._tar_temp / "extracted"
self._download = self._tar_temp / "download.tar.gz"
if path.isdir(path_to_str(self._tar_temp)):
rmtree(path_to_str(self._tar_temp))
makedirs(path_to_str(self._tar_temp))
makedirs(path_to_str(self._tar_extracted))
def md5Dir(self, d):
md5sum = Command(
"find " + path_to_str(d) +
r' -type f | sed -e "s/.*\///gm" | sort | md5sum'
).execute()
self.assertNotEqual(self.FNF_MD5, md5sum)
return md5sum
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)
from tests.support import RpgTestCase
from rpg import Base
from rpg.package_builder import PackageBuilder
from rpg.spec import Spec
from pathlib import Path
import os
class FakeBase(Base):
base_dir = Path(RpgTestCase.test_project_dir / "hello_project")
project_name = "hello"
def __init__(self):
self._package_builder = PackageBuilder()
self.spec = Spec()
self.spec.Name = "hello"
self.spec.Version = "1.4"
self.spec.Release = "1%{?dist}"
self.spec.Summary = "Hello World test program"
self.spec.License = "GPLv2"
self.spec.Source = "hello-1.4.tar.gz"
self.spec.description = "Hello World C project for testing RPG."
self.spec.prep = r'%autosetup'
self.spec.build = "make"