Beispiel #1
0
    def execute(self, ns, _allow_duplicates=False):
        installed_nevras = None
        if software.get_backend(ns) == software.BACKEND_PACKAGEKIT:
            installed_nevras = set(software.get_package_nevra(p)
                for p in software.list_installed_packages(ns))

        for pkg in software.find_package(ns,
                allow_duplicates=_allow_duplicates):
            yield (software.get_package_nevra(pkg), )
Beispiel #2
0
    def execute(self, ns, _allow_duplicates=False):
        installed_nevras = None
        if software.get_backend(ns) == software.BACKEND_PACKAGEKIT:
            installed_nevras = set(
                software.get_package_nevra(p)
                for p in software.list_installed_packages(ns))

        for pkg in software.find_package(ns,
                                         allow_duplicates=_allow_duplicates):
            yield (software.get_package_nevra(pkg), )
Beispiel #3
0
    def execute(self, ns,
            _available=False,
            _all=False,
            _repoid=None,
            _allow_duplicates=False,
            package_array=None):
        properties = (
                ('NEVRA', 'ElementName'),
                ('Summary', 'Caption'))
        if package_array:
            package_generators = []
            for pkg_spec in package_array:
                exact_match = any(reg.match(pkg_spec) for reg in (
                        software.RE_ENVRA, software.RE_NEVRA, software.RE_NA))
                generator = (   i.to_instance()
                            for i in software.find_package(ns,
                                    pkg_spec=pkg_spec,
                                    allow_duplicates=_allow_duplicates,
                                    exact_match=exact_match))
                if _available and not _repoid:
                    # filter out installed packages
                    # if repoid is given, there's no need to filter them out
                    generator = (i for i in generator if i.InstallDate is None)
                elif not _all and not _available:
                    # filter out not installed packages
                    generator = (  i for i in generator
                                if i.InstallDate is not None)
                # else: # _all is given - no need to filter
                package_generators.append(generator)
            instances = itertools.chain(*package_generators)

        elif _all or _available:
            instances = software.list_available_packages(ns,
                    allow_installed=_all,
                    allow_duplicates=_allow_duplicates,
                    repoid=_repoid)

        else:
            instances = software.list_installed_packages(ns)

        return (properties, instances)
Beispiel #4
0
    def execute(self, ns,
            _available=False,
            _all=False,
            _repoid=None,
            _allow_duplicates=False,
            package_array=None):
        properties = (
                ('NEVRA', 'ElementName'),
                ('Summary', 'Caption'))
        if package_array:
            package_generators = []
            for pkg_spec in package_array:
                exact_match = any(reg.match(pkg_spec) for reg in (
                        software.RE_ENVRA, software.RE_NEVRA, software.RE_NA))
                generator = (   i.to_instance()
                            for i in software.find_package(ns,
                                    pkg_spec=pkg_spec,
                                    allow_duplicates=_allow_duplicates,
                                    exact_match=exact_match))
                if _available and not _repoid:
                    # filter out installed packages
                    # if repoid is given, there's no need to filter them out
                    generator = (i for i in generator if i.InstallDate is None)
                elif not _all and not _available:
                    # filter out not installed packages
                    generator = (  i for i in generator
                                if i.InstallDate is not None)
                # else: # _all is given - no need to filter
                package_generators.append(generator)
            instances = itertools.chain(*package_generators)

        elif _all or _available:
            instances = software.list_available_packages(ns,
                    allow_installed=_all,
                    allow_duplicates=_allow_duplicates,
                    repoid=_repoid)

        else:
            instances = software.list_installed_packages(ns)

        return (properties, instances)