[arch] feature: able to filter orphan packages by the new 'orphan' category (AUR only)

This commit is contained in:
Vinicius Moreira
2022-03-12 12:02:40 -03:00
parent 1bf45547b2
commit 2ff5aa7f63
12 changed files with 25 additions and 2 deletions

View File

@@ -28,6 +28,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
<img src="https://raw.githubusercontent.com/vinifmor/bauh-files/master/pictures/releases/0.10.0/appim_self.png">
</p>
- Arch
- AUR:
- able to filter orphan packages by the new "orphan" category [#236](https://github.com/vinifmor/bauh/issues/236)
### Improvements
- General
- minor memory improvements

View File

@@ -1,6 +1,6 @@
import logging
import os
from typing import Optional
from typing import Optional, List, Dict
from bauh.api.abstract.model import PackageStatus
from bauh.api.http import HttpClient
@@ -80,7 +80,7 @@ class AURDataMapper:
if res and res.status_code == 200 and res.text:
pkg.pkgbuild = res.text
def map_api_data(self, apidata: dict, pkgs_installed: Optional[dict], categories: dict) -> ArchPackage:
def map_api_data(self, apidata: dict, pkgs_installed: Optional[dict], categories: Dict[str, List[str]]) -> ArchPackage:
data = pkgs_installed.get(apidata.get('Name')) if pkgs_installed else None
app = ArchPackage(name=apidata.get('Name'), installed=bool(data), repository='aur', i18n=self.i18n)
app.status = PackageStatus.LOADING_DATA
@@ -93,6 +93,13 @@ class AURDataMapper:
app.description = data.get('description')
self.fill_api_data(app, apidata, fill_version=not data)
if app.orphan:
if app.categories is None:
app.categories = []
app.categories.append('orphan')
return app
def check_update(self, pkg: ArchPackage, last_modified: Optional[int]) -> bool:

View File

@@ -189,6 +189,9 @@ 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

@@ -302,6 +302,7 @@ arch.warning.aur_missing_dep={} seems not to be installed. It will not be possib
arch_repo.history.1_version=versió
arch_repo.history.2_release=publicació
arch_repo.history.3_date=data
category.orphan=orphan
aur.history.1_version=versió
aur.history.2_release=publicació
aur.history.3_date=data

View File

@@ -305,6 +305,7 @@ arch_repo.history.3_date=Datum
aur.history.1_version=Version
aur.history.2_release=Release
aur.history.3_date=Datum
category.orphan=orphan
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

@@ -305,6 +305,7 @@ arch_repo.history.3_date=date
aur.history.1_version=version
aur.history.2_release=release
aur.history.3_date=date
category.orphan=orphan
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

@@ -305,6 +305,7 @@ arch_repo.history.3_date=fecha
aur.history.1_version=versión
aur.history.2_release=lanzamiento
aur.history.3_date=fecha
category.orphan=huérfano
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

@@ -305,6 +305,7 @@ arch_repo.history.3_date=date
aur.history.1_version=version
aur.history.2_release=livraison
aur.history.3_date=date
category.orphan=orphan
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

@@ -305,6 +305,7 @@ arch_repo.history.3_date=data
aur.history.1_version=versione
aur.history.2_release=rilascio
aur.history.3_date=data
category.orphan=orphan
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

@@ -304,6 +304,7 @@ arch_repo.history.3_date=data
aur.history.1_version=versão
aur.history.2_release=lançamento
aur.history.3_date=data
category.orphan=órfão
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

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

View File

@@ -305,6 +305,7 @@ arch_repo.history.3_date=tarih
aur.history.1_version=sürüm
aur.history.2_release=sürüm inşa
aur.history.3_date=tarih
category.orphan=orphan
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ı