[PATCH] - Create a PackageKitYumBackend.updateMetadata property, which parses the updateinfo.xml.gz from the repodata on the fly. - Dynamically update the rebootpkgs list with any updates that are flagged with reboot_suggested in the updateinfo.
lmacken at redhat.com
lmacken at redhat.com
Mon Nov 19 08:46:37 PST 2007
---
backends/yum/helpers/yumBackend.py | 47 +++++++++++++++++++++--------------
1 files changed, 28 insertions(+), 19 deletions(-)
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 5b8fe18..e523b8b 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -201,9 +201,9 @@ def sigquit(signum, frame):
class PackageKitYumBackend(PackageKitBaseBackend):
# Packages there require a reboot
- rebootpkgs = ("kernel", "kernel-smp", "kernel-xen-hypervisor", "kernel-PAE",
- "kernel-xen0", "kernel-xenU", "kernel-xen", "kernel-xen-guest",
- "glibc", "hal", "dbus", "xen")
+ rebootpkgs = ["kernel", "kernel-smp", "kernel-xen-hypervisor", "kernel-PAE",
+ "kernel-xen0", "kernel-xenU", "kernel-xen", "kernel-xen-guest",
+ "glibc", "hal", "dbus", "xen"]
def __init__(self,args,lock=True):
signal.signal(signal.SIGQUIT, sigquit)
@@ -836,8 +836,12 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"No available updates")
def _check_for_reboot(self):
+ md = self.updateMetadata
for txmbr in self.yumbase.tsInfo:
pkg = txmbr.po
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ if notice and notice['reboot_suggested']:
+ self.rebootpkgs.append(pkg.name)
# check if package is in reboot list and is installed/updated etc
print pkg.name,txmbr.output_state
if pkg.name in self.rebootpkgs and txmbr.ts_state in TS_INSTALL_STATES:
@@ -982,14 +986,7 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.allow_interrupt(True)
self.percentage(None)
self.status(STATUS_INFO)
- md = UpdateMetadata()
- # Added extra Update Metadata
- for repo in self.yumbase.repos.listEnabled():
- try:
- md.add(repo)
- except:
- pass # No updateinfo.xml.gz in repo
-
+ md = self.updateMetadata
ygl = self.yumbase.doPackageLists(pkgnarrow='updates')
for pkg in ygl.updates:
# Get info about package in updates info
@@ -1043,15 +1040,27 @@ class PackageKitYumBackend(PackageKitBaseBackend):
else:
return ""
+ def _get_update_metadata(self):
+ if not self._updateMetadata:
+ self._updateMetadata = UpdateMetadata()
+ for repo in self.yumbase.repos.listEnabled():
+ try:
+ md.add(repo)
+ except:
+ pass # No updateinfo.xml.gz in repo
+ return self._updateMetadata
+
+ _updateMetadata = None
+ updateMetadata = property(fget=_get_update_metadata)
+
def _get_update_extras(self,pkg):
- md = UpdateMetadata()
- if md:
- notice = md.get_notice((pkg.name, pkg.version, pkg.release))
- if notice:
- desc = notice['description']
- url = notice['references']
- reboot = notice['reboot_suggested']
- return desc.replace('\n',';'),url,reboot
+ md = self.updateMetadata
+ notice = md.get_notice((pkg.name, pkg.version, pkg.release))
+ if notice:
+ desc = notice['description']
+ url = notice['references']
+ reboot = notice['reboot_suggested']
+ return desc.replace('\n',';'),url,reboot
return "","",""
def get_update_detail(self,package):
--
1.5.3.4
--/04w6evG8XlLl3ft--
More information about the PackageKit
mailing list