예제 #1
0
    def test_list_packages(self):
        """
        Test whether list_packages lists our ad-hoc
        repository correctly.
        """

        rpm = "sample_rpms/sample-1.0-1.fc18.noarch.rpm"

        tmpdir = tempfile.mkdtemp()
        shutil.copyfile(rpm, os.path.join(tmpdir, os.path.basename(rpm)))

        proc = popen("createrepo_c", "--verbose", tmpdir)
        self.assertTrue(b"Workers Finished" in proc.stdout
                        or b"Pool finished" in proc.stdout)

        dnf = Dnf("test_repo_name", tmpdir)
        pkgs = dnf.list_packages(["noarch"])
        self.assertEqual(len(pkgs), 1)
        pkg = pkgs.pop()
        self.assertEqual(pkg["name"], "sample")
        self.assertEqual(pkg["base_package_name"], "sample")
        self.assertEqual(pkg["version"], "1.0")
        self.assertEqual(pkg["release"], "1.fc18")
        self.assertEqual(pkg["arch"], "noarch")

        self.assertEqual(pkg["filename"], os.path.basename(rpm))
        self.assertEqual(
            pkg["url"],
            "file://{0}".format(os.path.join(tmpdir, os.path.basename(rpm))))

        self.assertEqual(pkg["type"], "rpm")

        shutil.rmtree(tmpdir)
예제 #2
0
파일: centos.py 프로젝트: abrt/faf
 def get_components(self, release):
     urls = [repo.replace("$releasever", release)
             for repo in [self.base_repo_url, self.updates_repo_url]]
     components = []
     if "dnf" in repo_types:
         from pyfaf.repos.dnf import Dnf
         dnf = Dnf(self.name, *urls)
         components.extend(list(set(pkg["name"]
                                    for pkg in dnf.list_packages(["src"]))))
     else:
         raise FafError("No repo type available")
     return components
예제 #3
0
파일: centos.py 프로젝트: coyang/faf
 def get_components(self, release):
     urls = [
         repo.replace("$releasever", release)
         for repo in [self.base_repo_url, self.updates_repo_url]
     ]
     components = []
     if "dnf" in repo_types:
         from pyfaf.repos.dnf import Dnf
         dnf = Dnf(self.name, *urls)
         components.extend(
             list(set(pkg["name"] for pkg in dnf.list_packages(["src"]))))
     else:
         raise FafError("No repo type available")
     return components
예제 #4
0
파일: centos.py 프로젝트: mkutlak/faf
    def get_components(self, release) -> List[str]:
        if not self.repo_urls:
            self.log_info("No repository URLs were found.")
            return []

        urls = [repo.replace("$releasever", release) for repo in self.repo_urls]
        components = []
        if "dnf" in repo_types:
            from pyfaf.repos.dnf import Dnf
            dnf = Dnf(self.name, *urls)
            components.extend(list(set(pkg["name"]
                                       for pkg in dnf.list_packages(["src"]))))
        else:
            raise FafError("No repo type available")
        return components