Exemplo n.º 1
0
    def _get_provides_from_rpm(self, pkg):
        """Gets the package provides from YumPackage.

        :param pkg: the YumPackage Instance
        :return: list of PackageRelation objects
        """
        provides = self._parse_package_relations(pkg.provides)
        append = provides.append
        for filename in pkg.returnFileEntries('file', True):
            append(PackageRelation(filename))
        return provides
Exemplo n.º 2
0
    def _parse_package_relations(relations):
        """Parses yum package relations.

        :param relations: list of tuples
                          (name, flags, (epoch, version, release))
        :return: list of PackageRelation objects
        """
        return [
            PackageRelation(
                x[0],
                VersionRange(_OPERATORS_MAPPING[x[1]], x[1]
                             and RpmPackageVersion(*x[2]))) for x in relations
        ]
Exemplo n.º 3
0
    def _get_provides_from_xml(self, pkg_tag):
        """Gets the package provides from package tag.

        Tag provides contains virtual packages.
        Tag files contains binary files that is provided by package.

        :param pkg_tag: the xml-tag with package description
        :return: list of PackageRelation objects
        """
        provides = self._get_relations(pkg_tag, "provides")
        files_iter = pkg_tag.iterfind("./main:format/main:file", _NAMESPACES)
        append = provides.append
        for file_tag in files_iter:
            append(PackageRelation(file_tag.text))
        return provides