Exemple #1
0
    def __fill_provided_map(self,
                            context: UpdateRequirementsContext,
                            pkgs: Dict[str, ArchPackage],
                            fill_installed: bool = True):
        if pkgs:
            ti = time.time()
            self.logger.info("Filling provided names")

            if not context.installed_names:
                context.installed_names = pacman.list_installed_names()

            installed_to_ignore = set()

            for pkgname in pkgs:
                pacman.fill_provided_map(pkgname, pkgname,
                                         context.provided_map)

                if fill_installed:
                    installed_to_ignore.add(pkgname)

                pdata = context.pkgs_data.get(pkgname)
                if pdata and pdata['p']:
                    pacman.fill_provided_map(
                        '{}={}'.format(pkgname, pdata['v']), pkgname,
                        context.provided_map)

                    ver_split = pdata['v'].split('-')

                    if len(ver_split) > 1:
                        pacman.fill_provided_map(
                            '{}={}'.format(pkgname, '-'.join(ver_split[0:-1])),
                            pkgname, context.provided_map)

                    for p in pdata['p']:
                        pacman.fill_provided_map(p, pkgname,
                                                 context.provided_map)
                        split_provided = p.split('=')

                        if len(split_provided) > 1 and split_provided[0] != p:
                            pacman.fill_provided_map(split_provided[0],
                                                     pkgname,
                                                     context.provided_map)

            if installed_to_ignore:  # filling the provided names of the installed
                installed_to_query = context.installed_names.difference(
                    installed_to_ignore)

                if installed_to_query:
                    context.provided_map.update(
                        pacman.map_provided(remote=False,
                                            pkgs=installed_to_query))

            tf = time.time()
            self.logger.info(
                "Filling provided names took {0:.2f} seconds".format(tf - ti))
Exemple #2
0
    def __fill_provided_map(self, context: UpdateRequirementsContext):
        ti = time.time()
        self.logger.info("Filling provided names")
        context.installed_names = pacman.list_installed_names()
        installed_to_ignore = set()

        for pkgname in context.to_update:
            pacman.fill_provided_map(pkgname, pkgname, context.provided_map)
            installed_to_ignore.add(pkgname)

            pdata = context.pkgs_data.get(pkgname)
            if pdata and pdata['p']:
                pacman.fill_provided_map('{}={}'.format(pkgname, pdata['v']), pkgname, context.provided_map)
                for p in pdata['p']:
                    pacman.fill_provided_map(p, pkgname, context.provided_map)
                    split_provided = p.split('=')

                    if len(split_provided) > 1 and split_provided[0] != p:
                        pacman.fill_provided_map(split_provided[0], pkgname, context.provided_map)

        if installed_to_ignore:  # filling the provided names of the installed
            installed_to_query = context.installed_names.difference(installed_to_ignore)

            if installed_to_query:
                context.provided_map.update(pacman.map_provided(remote=False, pkgs=installed_to_query))

        tf = time.time()
        self.logger.info("Filling provided names took {0:.2f} seconds".format(tf - ti))