diff --git a/CHANGELOG.md b/CHANGELOG.md index fbeaf601..3dc1effb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [0.9.7] 2020 +### Improvements +- Arch + - upgrade summary: displaying the reason a given package must be installed +

+ +

+ ### Fixes - Arch - not able to upgrade a package that explicitly defines a conflict with itself (e.g: grub) diff --git a/bauh/gems/arch/updates.py b/bauh/gems/arch/updates.py index 3187d11d..ee010f8d 100644 --- a/bauh/gems/arch/updates.py +++ b/bauh/gems/arch/updates.py @@ -334,7 +334,7 @@ class UpdatesSummarizer: context.aur_index.update(names) self.logger.info("AUR index loaded on the context") - def _map_requirement(self, pkg: ArchPackage, context: UpdateRequirementsContext, installed_sizes: Dict[str, int] = None) -> UpgradeRequirement: + def _map_requirement(self, pkg: ArchPackage, context: UpdateRequirementsContext, installed_sizes: Dict[str, int] = None, to_install: bool = False, to_upgrade: Set[str] = None) -> UpgradeRequirement: requirement = UpgradeRequirement(pkg) if pkg.repository != 'aur': @@ -347,6 +347,11 @@ class UpdatesSummarizer: if current_size is not None and data['s']: requirement.extra_size = data['s'] - current_size + if to_install and context.pkgs_data and context.to_update: + names = context.pkgs_data[pkg.name].get('p', {pkg.name}) + required_by = ','.join([p for p in to_upgrade if p != pkg.name and context.pkgs_data[p]['d'] and any([n for n in names if n in context.pkgs_data[p]['d']])]) + requirement.reason = '{}: {}'.format(self.i18n['arch.info.required by'].capitalize(), required_by if required_by else '?') + return requirement def summarize(self, pkgs: List[ArchPackage], root_password: str, arch_config: dict) -> UpgradeRequirements: @@ -422,6 +427,7 @@ class UpdatesSummarizer: res.cannot_upgrade = [d for d in context.cannot_upgrade.values()] if context.to_install: - res.to_install = [self._map_requirement(p, context) for p in context.to_install.values()] + to_upgrade = {r.pkg.name for r in res.to_upgrade} if res.to_upgrade else None + res.to_install = [self._map_requirement(p, context, to_install=True, to_upgrade=to_upgrade) for p in context.to_install.values()] return res diff --git a/bauh/view/qt/thread.py b/bauh/view/qt/thread.py index 6915b7d8..7a561002 100644 --- a/bauh/view/qt/thread.py +++ b/bauh/view/qt/thread.py @@ -236,7 +236,7 @@ class UpgradeSelected(AsyncAction): return FormComponent(label=self.i18n['action.update.cannot_update_label'], components=comps) def _gen_to_install_form(self, reqs: List[UpgradeRequirement]) -> Tuple[FormComponent, Tuple[int, int]]: - opts = [self._req_as_option(r) for r in reqs] + opts = [self._req_as_option(r, custom_tooltip=r.reason) for r in reqs] comps = [MultipleSelectComponent(label='', options=opts, default_options=set(opts))] required_size, extra_size = self._sum_pkgs_size(reqs) diff --git a/pictures/releases/0.9.7/arch_install_reason.png b/pictures/releases/0.9.7/arch_install_reason.png new file mode 100644 index 00000000..00850614 Binary files /dev/null and b/pictures/releases/0.9.7/arch_install_reason.png differ