Esempio n. 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)
Esempio n. 2
0
File: centos.py Progetto: 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
Esempio n. 3
0
File: centos.py Progetto: 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
Esempio n. 4
0
    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