def map_all_required_by(self, pkgnames: Iterable[str], to_ignore: Set[str]) -> Set[str]: to_ignore.update(pkgnames) all_requirements = { req for reqs in pacman.map_required_by(pkgnames).values() for req in reqs if req not in to_ignore } if all_requirements: sub_requirements = self.map_all_required_by( all_requirements, to_ignore) if sub_requirements: all_requirements.update(sub_requirements) return all_requirements return all_requirements
def _fill_dependency_breakage(self, context: UpdateRequirementsContext): if bool(context.arch_config['check_dependency_breakage']) and ( context.to_update or context.to_install): ti = time.time() self.logger.info("Begin: checking dependency breakage") required_by = pacman.map_required_by( context.to_update.keys()) if context.to_update else {} if context.to_install: required_by.update( pacman.map_required_by(context.to_install.keys(), remote=True)) reqs_not_in_transaction = set() reqs_in_transaction = set() transaction_pkgs = { *context.to_update.keys(), *context.to_install.keys() } for reqs in required_by.values(): for r in reqs: if r in transaction_pkgs: reqs_in_transaction.add(r) elif r in context.installed_names: reqs_not_in_transaction.add(r) if not reqs_not_in_transaction and not reqs_in_transaction: return provided_versions = {} for p in context.provided_map: pkg_split = p.split('=') if len(pkg_split) > 1: versions = provided_versions.get(pkg_split[0]) if versions is None: versions = set() provided_versions[pkg_split[0]] = versions versions.add(pkg_split[1]) if not provided_versions: return cannot_upgrade = set() for pkg, deps in pacman.map_required_dependencies( *reqs_not_in_transaction).items(): self._add_dependency_breakage( pkgname=pkg, pkgdeps=deps, provided_versions=provided_versions, cannot_upgrade=cannot_upgrade, context=context) for pkg in reqs_in_transaction: data = context.pkgs_data[pkg] if data and data['d']: self._add_dependency_breakage( pkgname=pkg, pkgdeps=data['d'], provided_versions=provided_versions, cannot_upgrade=cannot_upgrade, context=context) if cannot_upgrade: cannot_upgrade.update( self._add_dependents_as_cannot_upgrade( context=context, names=cannot_upgrade, pkgs_available={ *context.to_update.values(), *context.to_install.values() })) for p in cannot_upgrade: if p in context.to_update: del context.to_update[p] if p in context.repo_to_update: del context.repo_to_update[p] if p in context.aur_to_update: del context.aur_to_update[p] if p in context.pkgs_data: del context.pkgs_data[p] if p in context.to_install: del context.to_install[p] if p in context.repo_to_install: del context.repo_to_install[p] if p in context.aur_to_install: del context.aur_to_install[p] tf = time.time() self.logger.info( "End: checking dependency breakage. Time: {0:.2f} seconds". format(tf - ti))