mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-06 22:54:16 +02:00
[fix][arch] not detecting some installed 'not-signed' repository packages
This commit is contained in:
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Arch
|
||||
- 'clean cache' operation was not working in some scenarios
|
||||
- upgrading progress when conflicting files are detected
|
||||
- not detecting some installed 'not-signed' repository packages
|
||||
|
||||
- upgrade: crashing for scenarios when there are packages that cannot upgrade to be displayed on the summary window
|
||||
- settings: crashing when an empty Qt style is defined [#104](https://github.com/vinifmor/bauh/issues/104)
|
||||
|
||||
@@ -375,8 +375,10 @@ class ArchManager(SoftwareManager):
|
||||
return SearchResult([], [], 0)
|
||||
|
||||
installed = {}
|
||||
repo_map = pacman.map_repositories()
|
||||
read_installed = Thread(target=lambda: installed.update(pacman.map_installed(repositories=arch_config['repositories'],
|
||||
aur=arch_config['aur'])), daemon=True)
|
||||
aur=arch_config['aur'],
|
||||
repo_map=repo_map)), daemon=True)
|
||||
read_installed.start()
|
||||
|
||||
res = SearchResult([], [], 0)
|
||||
@@ -441,14 +443,12 @@ class ArchManager(SoftwareManager):
|
||||
def _fill_repo_updates(self, updates: dict):
|
||||
updates.update(pacman.list_repository_updates())
|
||||
|
||||
def _fill_repo_pkgs(self, signed: dict, pkgs: list, disk_loader: DiskCacheLoader):
|
||||
def _fill_repo_pkgs(self, signed: dict, pkgs: list, repo_map: Dict[str, str], disk_loader: DiskCacheLoader):
|
||||
updates = {}
|
||||
|
||||
thread_updates = Thread(target=self._fill_repo_updates, args=(updates,), daemon=True)
|
||||
thread_updates.start()
|
||||
|
||||
repo_map = pacman.map_repositories(list(signed.keys()))
|
||||
|
||||
if len(repo_map) != len(signed):
|
||||
self.logger.warning("Not mapped all signed packages repositories. Mapped: {}. Total: {}".format(len(repo_map), len(signed)))
|
||||
|
||||
@@ -482,7 +482,8 @@ class ArchManager(SoftwareManager):
|
||||
def read_installed(self, disk_loader: DiskCacheLoader, limit: int = -1, only_apps: bool = False, pkg_types: Set[Type[SoftwarePackage]] = None, internet_available: bool = None) -> SearchResult:
|
||||
self.aur_client.clean_caches()
|
||||
arch_config = read_config()
|
||||
installed = pacman.map_installed(repositories=arch_config['repositories'], aur=arch_config['aur'])
|
||||
repo_map = pacman.map_repositories()
|
||||
installed = pacman.map_installed(repo_map=repo_map, repositories=arch_config['repositories'], aur=arch_config['aur'])
|
||||
|
||||
pkgs = []
|
||||
if installed and (installed['not_signed'] or installed['signed']):
|
||||
@@ -494,7 +495,7 @@ class ArchManager(SoftwareManager):
|
||||
map_threads.append(t)
|
||||
|
||||
if installed['signed']:
|
||||
t = Thread(target=self._fill_repo_pkgs, args=(installed['signed'], pkgs, disk_loader), daemon=True)
|
||||
t = Thread(target=self._fill_repo_pkgs, args=(installed['signed'], pkgs, repo_map, disk_loader), daemon=True)
|
||||
t.start()
|
||||
map_threads.append(t)
|
||||
|
||||
@@ -2082,7 +2083,8 @@ class ArchManager(SoftwareManager):
|
||||
p.size = new_size - p.size
|
||||
|
||||
def upgrade_system(self, root_password: str, watcher: ProcessWatcher) -> bool:
|
||||
installed = pacman.map_installed(repositories=True, aur=False)
|
||||
repo_map = pacman.map_repositories()
|
||||
installed = pacman.map_installed(repo_map=repo_map, repositories=True, aur=False)
|
||||
|
||||
if not installed or not installed['signed']:
|
||||
watcher.show_message(title=self.i18n['arch.custom_action.upgrade_system'],
|
||||
|
||||
@@ -92,7 +92,7 @@ def _fill_ignored(res: dict):
|
||||
res['pkgs'] = list_ignored_packages()
|
||||
|
||||
|
||||
def map_installed(repositories: bool = True, aur: bool = True) -> dict: # returns a dict with with package names as keys and versions as values
|
||||
def map_installed(repo_map: Dict[str, str], repositories: bool = True, aur: bool = True) -> dict: # returns a dict with with package names as keys and versions as values
|
||||
ignored = {}
|
||||
thread_ignored = Thread(target=_fill_ignored, args=(ignored,), daemon=True)
|
||||
thread_ignored.start()
|
||||
@@ -118,6 +118,12 @@ def map_installed(repositories: bool = True, aur: bool = True) -> dict: # retur
|
||||
|
||||
current_pkg = {}
|
||||
|
||||
if pkgs['not_signed']:
|
||||
for name in {*pkgs['not_signed'].keys()}:
|
||||
if repo_map.get(name):
|
||||
pkgs['signed'][name] = pkgs['not_signed'][name]
|
||||
del pkgs['not_signed'][name]
|
||||
|
||||
if pkgs['signed'] or pkgs['not_signed']:
|
||||
thread_ignored.join()
|
||||
|
||||
|
||||
@@ -97,7 +97,8 @@ 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')
|
||||
installed = pacman.map_installed(repositories=self.repositories, aur=self.aur)
|
||||
repo_map = pacman.map_repositories()
|
||||
installed = pacman.map_installed(repositories=self.repositories, aur=self.aur, repo_map=repo_map)
|
||||
|
||||
self.task_man.update_progress(self.task_id, 0, self.i18n['arch.task.disk_cache.reading'])
|
||||
for k in ('signed', 'not_signed'):
|
||||
@@ -106,14 +107,9 @@ class ArchDiskCacheUpdater(Thread):
|
||||
saved = 0
|
||||
pkgs = {*installed['signed'], *installed['not_signed']}
|
||||
|
||||
repo_map = {}
|
||||
|
||||
if installed['not_signed']:
|
||||
repo_map.update({p: 'aur' for p in installed['not_signed']})
|
||||
|
||||
if installed['signed']:
|
||||
repo_map.update(pacman.map_repositories(installed['signed']))
|
||||
|
||||
self.to_index = len(pkgs)
|
||||
self.progress = self.to_index * 2
|
||||
self.update_prepared(None, add=False)
|
||||
|
||||
Reference in New Issue
Block a user