mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-08 21:14:15 +02:00
[aur] initial retrievement of update requirements implementation
This commit is contained in:
@@ -446,3 +446,28 @@ class GenericSoftwareManager(SoftwareManager):
|
||||
sorted_list.extend(pkgs)
|
||||
|
||||
return sorted_list
|
||||
|
||||
def get_update_requirements(self, pkgs: List[SoftwarePackage], watcher: ProcessWatcher) -> List[SoftwarePackage]:
|
||||
by_manager = {}
|
||||
for pkg in pkgs:
|
||||
man = self._get_manager_for(pkg)
|
||||
|
||||
if man:
|
||||
man_pkgs = by_manager.get(man)
|
||||
|
||||
if man_pkgs is None:
|
||||
man_pkgs = []
|
||||
by_manager[man] = man_pkgs
|
||||
|
||||
man_pkgs.append(pkg)
|
||||
|
||||
required = []
|
||||
|
||||
if by_manager:
|
||||
for man, pkgs in by_manager.items():
|
||||
ti = time.time()
|
||||
required.extend(man.get_update_requirements(pkgs, watcher))
|
||||
tf = time.time()
|
||||
self.logger.info(man.__class__.__name__ + " took {0:.2f} seconds".format(tf - ti))
|
||||
|
||||
return required
|
||||
|
||||
@@ -107,11 +107,14 @@ class UpdateSelectedApps(AsyncAction):
|
||||
|
||||
app_config = config.read_config()
|
||||
|
||||
models = [view.model for view in self.pkgs]
|
||||
required_pkgs = self.manager.get_update_requirements(models, self)
|
||||
|
||||
if bool(app_config['updates']['sort_packages']):
|
||||
self.change_substatus(self.i18n['action.update.status.sorting'])
|
||||
sorted_pkgs = self.manager.sort_update_order([view.model for view in self.pkgs])
|
||||
sorted_pkgs = self.manager.sort_update_order()
|
||||
else:
|
||||
sorted_pkgs = [view.model for view in self.pkgs]
|
||||
sorted_pkgs = models
|
||||
|
||||
for pkg in sorted_pkgs:
|
||||
self.change_substatus('')
|
||||
|
||||
Reference in New Issue
Block a user