virt-manager/535ff0b7-fix-install-when-one-package-is-already-installed.patch

42 lines
1.5 KiB
Diff
Raw Normal View History

Subject: packageutils: Fix install when one package is already installed (bz 1090181)
From: Cole Robinson crobinso@redhat.com Tue Apr 29 14:34:31 2014 -0400
Date: Tue Apr 29 14:34:31 2014 -0400:
Git: 15449eb12601ec1b88aa6d8ee52986ef5ab41ae2
Index: virt-manager-1.0.1/virtManager/packageutils.py
===================================================================
--- virt-manager-1.0.1.orig/virtManager/packageutils.py
+++ virt-manager-1.0.1/virtManager/packageutils.py
@@ -53,7 +53,12 @@ def check_packagekit(parent, errbox, pac
return
try:
- packagekit_install(parent, packages)
+ for package in packages[:]:
+ if packagekit_isinstalled(package):
+ packages.remove(package)
+
+ if packages:
+ packagekit_install(parent, packages)
except Exception, e:
# PackageKit frontend should report an error for us, so just log
# the actual error
@@ -63,6 +68,16 @@ def check_packagekit(parent, errbox, pac
return True
+def packagekit_isinstalled(package):
+ bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
+ pk_control = Gio.DBusProxy.new_sync(bus, 0, None,
+ "org.freedesktop.PackageKit",
+ "/org/freedesktop/PackageKit",
+ "org.freedesktop.PackageKit.Query", None)
+
+ return pk_control.IsInstalled("(ss)", package, "")
+
+
def packagekit_install(parent, package_list):
bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
pk_control = Gio.DBusProxy.new_sync(bus, 0, None,