mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[arch] improvement -> upgrade summary: displaying the reason a given package must be installed
This commit is contained in:
@@ -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
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/vinifmor/bauh/staging/pictures/releases/0.9.7/arch_install_reason.png">
|
||||
</p>
|
||||
|
||||
### Fixes
|
||||
- Arch
|
||||
- not able to upgrade a package that explicitly defines a conflict with itself (e.g: grub)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
BIN
pictures/releases/0.9.7/arch_install_reason.png
Normal file
BIN
pictures/releases/0.9.7/arch_install_reason.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 31 KiB |
Reference in New Issue
Block a user