[aur] caching the package categories to the disk

This commit is contained in:
Vinicius Moreira
2019-10-22 17:24:39 -03:00
parent 64e4822b2d
commit 5df45627ee
4 changed files with 8 additions and 5 deletions

View File

@@ -16,10 +16,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- AUR:
- showing a "user-friendly" popup when there are integrity issues with the source-files of a building package
- not waiting for the categories file to be retrieved from the cloud during application boot ( reduces boot time )
- caching cloud to categories to the disk so they can be used in scenarios when it is not possible to retrieve them ( e.g: internet is off )
- caching cloud categories to the disk so they can be used in scenarios when it is not possible to retrieve them ( e.g: internet is off )
- Snap:
- not waiting for the categories file to be retrieved from the cloud during application boot ( reduces boot time )
- caching cloud to categories to the disk so they can be used in scenarios when it is not possible to retrieve them ( e.g: internet is off )
- caching cloud categories to the disk so they can be used in scenarios when it is not possible to retrieve them ( e.g: internet is off )
- minor thread improvements
### Fixes

View File

@@ -568,7 +568,7 @@ class ArchManager(SoftwareManager):
if installed and self.context.disk_cache:
handler.watcher.change_substatus(self.i18n['status.caching_data'].format(bold(pkgname)))
if self.context.disk_cache:
disk.save_several({pkgname}, mirror=mirror, maintainer=maintainer, overwrite=True)
disk.save_several({pkgname}, mirror=mirror, maintainer=maintainer, overwrite=True, categories=self.categories)
self._update_progress(handler.watcher, 100, change_progress)

View File

@@ -47,7 +47,7 @@ def set_icon_path(app: ArchPackage, icon_name: str = None):
break
def save_several(pkgnames: Set[str], mirror: str, overwrite: bool = True, maintainer: str = None) -> int:
def save_several(pkgnames: Set[str], mirror: str, overwrite: bool = True, maintainer: str = None, categories: dict = None) -> int:
to_cache = {n for n in pkgnames if overwrite or not os.path.exists(ArchPackage.disk_cache_path(n, mirror))}
desktop_files = pacman.list_desktop_entries(to_cache)
@@ -138,6 +138,9 @@ def save_several(pkgnames: Set[str], mirror: str, overwrite: bool = True, mainta
if to_write:
for p in to_write:
if categories:
p.categories = categories.get(p.name)
p.maintainer = maintainer
write(p)
return len(to_write)

View File

@@ -5,7 +5,7 @@ from bauh.api.abstract.model import SoftwarePackage
from bauh.commons import resource
from bauh.gems.arch import ROOT_DIR, ARCH_CACHE_PATH
CACHED_ATTRS = {'command', 'icon_path', 'mirror', 'maintainer', 'desktop_entry'}
CACHED_ATTRS = {'command', 'icon_path', 'mirror', 'maintainer', 'desktop_entry', 'categories'}
class ArchPackage(SoftwarePackage):