virt-manager/0012-packageutils-Fix-install-when-one-package-is-already.patch
Cole Robinson 8d445c7717 filesystem: Fix target validation when editing device (bz #1089422)
details: Explicit warn that 'format' doesn't change image format (bz #1089457)
snapshots: Fix screenshot with qxl+spice (bz #1089780)
Fix using storage when the directory name contains whitespace (bz #1091384)
packageutils: Fix install when one package is already installed (bz #1090181)
2014-04-29 14:40:46 -04:00

47 lines
1.7 KiB
Diff

From aa9a8aedfbbca635eb34f168b8e04ba9730584f5 Mon Sep 17 00:00:00 2001
From: Cole Robinson <crobinso@redhat.com>
Date: Tue, 29 Apr 2014 14:34:31 -0400
Subject: [PATCH] packageutils: Fix install when one package is already
installed (bz 1090181)
(cherry picked from commit 15449eb12601ec1b88aa6d8ee52986ef5ab41ae2)
---
virtManager/packageutils.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/virtManager/packageutils.py b/virtManager/packageutils.py
index 34478b7..bb84f45 100644
--- a/virtManager/packageutils.py
+++ b/virtManager/packageutils.py
@@ -53,7 +53,12 @@ def check_packagekit(parent, errbox, packages):
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, packages):
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,