[arch] feature: able to filter outdated packages by the new 'out of date' category (AUR only)

This commit is contained in:
Vinicius Moreira
2022-03-12 12:17:22 -03:00
parent 2ff5aa7f63
commit 3e13b64e4c
12 changed files with 29 additions and 5 deletions

View File

@@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Arch
- AUR:
- able to filter orphan packages by the new "orphan" category [#236](https://github.com/vinifmor/bauh/issues/236)
- able to filter outdated packages by the new "out of date" category [#236](https://github.com/vinifmor/bauh/issues/236)
### Improvements
- General

View File

@@ -94,12 +94,16 @@ class AURDataMapper:
self.fill_api_data(app, apidata, fill_version=not data)
if app.orphan:
if app.orphan or app.out_of_date:
if app.categories is None:
app.categories = []
if app.orphan:
app.categories.append('orphan')
if app.out_of_date:
app.categories.append('out_of_date')
return app
def check_update(self, pkg: ArchPackage, last_modified: Optional[int]) -> bool:

View File

@@ -14,6 +14,7 @@ class ArchPackage(SoftwarePackage):
__action_reinstall: Optional[CustomSoftwareAction] = None
__action_ignore_rebuild_check: Optional[CustomSoftwareAction] = None
__cached_attrs: Optional[Tuple[str, ...]] = None
__dynamic_categories: Optional[Tuple[str, ...]] = None
@classmethod
def action_allow_rebuild_check(cls) -> CustomSoftwareAction:
@@ -88,6 +89,13 @@ class ArchPackage(SoftwarePackage):
return cls.__cached_attrs
@classmethod
def dynamic_categories(cls) -> Tuple[str, ...]:
if cls.__dynamic_categories is None:
cls.__dynamic_categories = ('orphan', 'out_of_date')
return cls.__dynamic_categories
def __init__(self, name: str = None, version: str = None, latest_version: str = None, description: str = None,
package_base: str = None, votes: int = None, popularity: float = None,
first_submitted: Optional[int] = None, last_modified: Optional[int] = None,
@@ -180,6 +188,11 @@ class ArchPackage(SoftwarePackage):
val = getattr(self, a)
if val:
if a == 'categories' and isinstance(val, list):
for cat in self.dynamic_categories():
if cat in val:
val.remove(cat)
cache[a] = val
return cache
@@ -189,9 +202,6 @@ class ArchPackage(SoftwarePackage):
for a in self.cached_attrs():
val = data.get(a)
if val:
if a == 'categories' and isinstance(val, list) and 'orphan' in val:
val.remove('orphan')
setattr(self, a, val)
if a == 'icon_path':

View File

@@ -303,6 +303,7 @@ arch_repo.history.1_version=versió
arch_repo.history.2_release=publicació
arch_repo.history.3_date=data
category.orphan=orphan
category.out_of_date=out of date
aur.history.1_version=versió
aur.history.2_release=publicació
aur.history.3_date=data

View File

@@ -306,6 +306,7 @@ aur.history.1_version=Version
aur.history.2_release=Release
aur.history.3_date=Datum
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Software packages available for distributions based on Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Repository

View File

@@ -306,6 +306,7 @@ aur.history.1_version=version
aur.history.2_release=release
aur.history.3_date=date
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Software packages available for distributions based on Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Repository

View File

@@ -306,6 +306,7 @@ aur.history.1_version=versión
aur.history.2_release=lanzamiento
aur.history.3_date=fecha
category.orphan=huérfano
category.out_of_date=desactualizado
gem.arch.info=Paquetes de software disponibles para distribuciones basadas en Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Repositorio

View File

@@ -306,6 +306,7 @@ aur.history.1_version=version
aur.history.2_release=livraison
aur.history.3_date=date
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Paquets logiciels disponibles pour les distributions basées sur Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Dépôt

View File

@@ -306,6 +306,7 @@ aur.history.1_version=versione
aur.history.2_release=rilascio
aur.history.3_date=data
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Software packages available for distributions based on Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Deposito

View File

@@ -305,6 +305,7 @@ aur.history.1_version=versão
aur.history.2_release=lançamento
aur.history.3_date=data
category.orphan=órfão
category.out_of_date=desatualizado
gem.arch.info=Pacotes de software disponíveis para distribuições baseadas em Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Repositório

View File

@@ -306,6 +306,7 @@ aur.history.1_version=Версия
aur.history.2_release=Выпуск
aur.history.3_date=Дата
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Пакеты программного обеспечения, доступные для дистрибутивов на базе Arch Linux
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Repository

View File

@@ -306,6 +306,7 @@ aur.history.1_version=sürüm
aur.history.2_release=sürüm inşa
aur.history.3_date=tarih
category.orphan=orphan
category.out_of_date=out of date
gem.arch.info=Arch Linux tabanlı dağıtımlar için mevcut yazılım paketleri
gem.arch.label=Arch
gem.arch.type.arch_repo.label=Arch - Depoları