From 983e3b9fcf6d1410396e16bb0141e21939e69da7 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sun, 28 Oct 2012 20:09:32 -0400 Subject: [PATCH] Fix package install with PackageKit 0.8.4 (cherry picked from commit 35bab2cc98ee4aef87f8a908c4951f2717455c8c) --- src/virtManager/packageutils.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/virtManager/packageutils.py b/src/virtManager/packageutils.py index 6478360..736b98c 100644 --- a/src/virtManager/packageutils.py +++ b/src/virtManager/packageutils.py @@ -135,7 +135,15 @@ def packagekit_install(package_list): timeout=timeout) def packagekit_search(session, pk_control, package_name, packages): - tid = pk_control.GetTid() + newstyle = False + try: + tid = pk_control.GetTid() + except dbus.exceptions.DBusException, e: + if e.get_dbus_name() != "org.freedesktop.DBus.Error.UnknownMethod": + raise + newstyle = True + tid = pk_control.CreateTransaction() + pk_trans = dbus.Interface( session.get_object("org.freedesktop.PackageKit", tid), "org.freedesktop.PackageKit.Transaction") @@ -160,7 +168,10 @@ def packagekit_search(session, pk_control, package_name, packages): pk_trans.connect_to_signal('ErrorCode', error) pk_trans.connect_to_signal('Package', package) try: - pk_trans.SearchNames("installed", [package_name]) + searchtype = "installed" + if newstyle: + searchtype = 2 ** 2 + pk_trans.SearchNames(searchtype, [package_name]) except dbus.exceptions.DBusException, e: if e.get_dbus_name() != "org.freedesktop.DBus.Error.UnknownMethod": raise -- 1.7.12.1