mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 14:24:15 +02:00
[fix][arch] actually fixing some installed 'not-signed' repository packages
This commit is contained in:
@@ -15,7 +15,6 @@ from bauh.commons.system import run_cmd, new_root_subprocess, ProcessHandler
|
||||
from bauh.gems.arch import pacman, disk, CUSTOM_MAKEPKG_FILE, CONFIG_DIR, BUILD_DIR, \
|
||||
AUR_INDEX_FILE, get_icon_path, database, mirrors
|
||||
from bauh.gems.arch.aur import URL_INDEX
|
||||
from bauh.gems.arch.model import ArchPackage
|
||||
from bauh.view.util.translation import I18n
|
||||
|
||||
URL_INFO = 'https://aur.archlinux.org/rpc/?v=5&type=info&arg={}'
|
||||
@@ -60,7 +59,7 @@ class AURIndexUpdater(Thread):
|
||||
|
||||
class ArchDiskCacheUpdater(Thread):
|
||||
|
||||
def __init__(self, task_man: TaskManager, arch_config: dict, i18n: I18n, logger: logging.Logger):
|
||||
def __init__(self, task_man: TaskManager, arch_config: dict, i18n: I18n, logger: logging.Logger, controller: "ArchManager", internet_available: bool):
|
||||
super(ArchDiskCacheUpdater, self).__init__(daemon=True)
|
||||
self.logger = logger
|
||||
self.task_man = task_man
|
||||
@@ -74,6 +73,8 @@ class ArchDiskCacheUpdater(Thread):
|
||||
self.progress = 0 # progress is defined by the number of packages prepared and indexed
|
||||
self.repositories = arch_config['repositories']
|
||||
self.aur = bool(arch_config['aur'])
|
||||
self.controller = controller
|
||||
self.internet_available = internet_available
|
||||
|
||||
def update_prepared(self, pkgname: str, add: bool = True):
|
||||
if add:
|
||||
@@ -97,24 +98,20 @@ class ArchDiskCacheUpdater(Thread):
|
||||
self.task_man.register_task(self.task_id, self.i18n['arch.task.disk_cache'], get_icon_path())
|
||||
|
||||
self.logger.info('Pre-caching installed Arch packages data to disk')
|
||||
repo_map = pacman.map_repositories()
|
||||
installed = pacman.map_installed(repositories=self.repositories, aur=self.aur, repo_map=repo_map)
|
||||
|
||||
installed = self.controller.read_installed(disk_loader=None, internet_available=self.internet_available,
|
||||
only_apps=False, pkg_types=None, limit=-1).installed
|
||||
|
||||
self.task_man.update_progress(self.task_id, 0, self.i18n['arch.task.disk_cache.reading'])
|
||||
for k in ('signed', 'not_signed'):
|
||||
installed[k] = {p for p in installed[k] if not os.path.exists(ArchPackage.disk_cache_path(p))}
|
||||
|
||||
saved = 0
|
||||
pkgs = {*installed['signed'], *installed['not_signed']}
|
||||
|
||||
if installed['not_signed']:
|
||||
repo_map.update({p: 'aur' for p in installed['not_signed']})
|
||||
pkgs = {p.name: p for p in installed if not os.path.exists(p.get_disk_cache_path())}
|
||||
|
||||
self.to_index = len(pkgs)
|
||||
self.progress = self.to_index * 2
|
||||
self.update_prepared(None, add=False)
|
||||
|
||||
saved += disk.save_several(pkgs, repo_map, when_prepared=self.update_prepared, after_written=self.update_indexed)
|
||||
saved += disk.save_several(pkgs, when_prepared=self.update_prepared, after_written=self.update_indexed)
|
||||
self.task_man.update_progress(self.task_id, 100, None)
|
||||
self.task_man.finish_task(self.task_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user