From 4b859f0eb6517e9c710dc0558eb28ea832820161 Mon Sep 17 00:00:00 2001 From: guinux Date: Sat, 26 Jan 2013 16:10:11 +0100 Subject: [PATCH] some improvements --- pamac/manager.py | 3 +-- pamac/pamac-daemon.py | 22 +++++++++++-------- pamac/transaction.py | 49 +++++++++++++++++++++++++------------------ 3 files changed, 43 insertions(+), 31 deletions(-) diff --git a/pamac/manager.py b/pamac/manager.py index 0736ff5..1613370 100755 --- a/pamac/manager.py +++ b/pamac/manager.py @@ -99,12 +99,11 @@ def refresh_packages_list(): global packages_list packages_list.clear() if not pkg_name_list: - packages_list.append([" ", False, False]) + packages_list.append(["No package found", False, False]) else: for name in pkg_name_list: if name in config.holdpkg: packages_list.append([name, pkg_installed_dict[name], False]) - break elif transaction_type is "install": if pkg_installed_dict[name] is True: packages_list.append([name, pkg_installed_dict[name], False]) diff --git a/pamac/pamac-daemon.py b/pamac/pamac-daemon.py index deff79b..42365b5 100755 --- a/pamac/pamac-daemon.py +++ b/pamac/pamac-daemon.py @@ -49,34 +49,38 @@ class PamacDBusService(dbus.service.Object): def cb_event(self, ID, event, tupel): if ID is 1: - self.action = 'Checking dependencies' + self.action = 'Checking dependencies...' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' elif ID is 3: - self.action = 'Checking file conflicts' + self.action = 'Checking file conflicts...' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' elif ID is 5: - self.action = 'Resolving dependencies' + self.action = 'Resolving dependencies...' self.icon = '/usr/share/pamac/icons/24x24/status/setup.png' elif ID is 7: - self.action = 'Checking inter conflicts' + self.action = 'Checking inter conflicts...' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' elif ID is 9: - self.action = 'Installing packages' + self.action = 'Installing...' self.icon = '/usr/share/pamac/icons/24x24/status/package-add.png' elif ID is 11: - self.action = 'Removing packages' + self.action = 'Removing...' self.icon = '/usr/share/pamac/icons/24x24/status/package-delete.png' elif ID is 13: - self.action = 'Upgrading packages' + self.action = 'Upgrading...' self.icon = '/usr/share/pamac/icons/24x24/status/package-update.png' elif ID is 15: - self.action = 'Checking integrity' + self.action = 'Checking integrity...' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' self.already_transferred = 0 elif ID is 17: - self.action = 'Checking signatures' + self.action = 'Checking signatures...' self.icon = '/usr/share/pamac/icons/24x24/status/package-search.png' print('Checking signatures') + elif ID is 26: + self.action = 'Configuring...' + self.icon = '/usr/share/pamac/icons/24x24/status/setup.png' + print('Configuring a package') elif ID is 27: print('Downloading a file') else : diff --git a/pamac/transaction.py b/pamac/transaction.py index 2a1a4e4..e16f2af 100755 --- a/pamac/transaction.py +++ b/pamac/transaction.py @@ -92,6 +92,9 @@ def check_conflicts(): global to_add global to_remove to_check = [] + installed_pkg_name = [] + syncdbs_pkg_name = [] + depends = [] warning = '' for pkgname in to_add: for repo in handle.get_syncdbs(): @@ -99,16 +102,20 @@ def check_conflicts(): if pkg: to_check.append(pkg) break + for installed_pkg in handle.get_localdb().pkgcache: + installed_pkg_name.append(installed_pkg.name) for target in to_check: + if target.depends: + for name in target.depends: + depends.append(name) if target.replaces: for name in target.replaces: - pkg = handle.get_localdb().get_pkg(name) - if pkg: - if not pkg.name in to_remove: - to_remove.append(pkg.name) + if name in installed_pkg_name: + if not name in to_remove: + to_remove.append(name) if warning: warning = warning+'\n' - warning = warning+pkg.name+' will be replaced by '+target.name + warning = warning+name+' will be replaced by '+target.name if target.conflicts: for name in target.conflicts: if name in to_add: @@ -117,13 +124,12 @@ def check_conflicts(): if warning: warning = warning+'\n' warning = warning+name+' conflicts with '+target.name+'\nNone of them will be installed' - pkg = handle.get_localdb().get_pkg(name) - if pkg: - if not pkg.name in to_remove: - to_remove.append(pkg.name) + if name in installed_pkg_name: + if not name in to_remove: + to_remove.append(name) if warning: warning = warning+'\n' - warning = warning+pkg.name+' conflicts with '+target.name + warning = warning+name+' conflicts with '+target.name for installed_pkg in handle.get_localdb().pkgcache: if installed_pkg.conflicts: for name in installed_pkg.conflicts: @@ -133,20 +139,23 @@ def check_conflicts(): if warning: warning = warning+'\n' warning = warning+installed_pkg.name+' conflicts with '+target.name + if installed_pkg.name in depends: + depends.remove(installed_pkg.name) for repo in handle.get_syncdbs(): for pkg in repo.pkgcache: if pkg.replaces: for name in pkg.replaces: - for installed_pkg in handle.get_localdb().pkgcache: - if name == installed_pkg.name: - if not name in to_remove: - to_remove.append(installed_pkg.name) - if warning: - warning = warning+'\n' - warning = warning+installed_pkg.name+' will be replaced by '+pkg.name - print(name) - if not pkg.name in to_add: - to_add.append(pkg.name) + if name == installed_pkg_name: + if not name in to_remove: + to_remove.append(name) + if warning: + warning = warning+'\n' + warning = warning+name+' will be replaced by '+pkg.name + if not pkg.name in to_add: + to_add.append(pkg.name) + if pkg.name in depends: + depends.remove(pkg.name) + print(depends) if warning: WarningDialog.format_secondary_text(warning) response = WarningDialog.run()