[PATCH] * backends/apt/pk-backend-apt.c: - add get_update_detail() with helper * backends/apt/helpers/aptBackend.py: - add simple get_update_detail * backends/apt/helpers/get-update-detail.py: - helper script * backends/apt/helpers/get-updates.py: - fix copyright
Michael Vogt
mvo at ubuntu.com
Wed Feb 13 09:02:32 PST 2008
---
backends/apt/helpers/aptBackend.py | 26 ++++++++++++++++++++++++++
backends/apt/helpers/get-update-detail.py | 18 ++++++++++++++++++
backends/apt/helpers/get-updates.py | 17 +++++++++++++++++
backends/apt/pk-backend-apt.c | 13 ++++++++++++-
4 files changed, 73 insertions(+), 1 deletions(-)
create mode 100755 backends/apt/helpers/get-update-detail.py
create mode 100755 backends/apt/helpers/get-updates.py
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 2c1da14..c3d1938 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -426,6 +426,32 @@ class PackageKitAptBackend(PackageKitBaseBackend):
except IOError,e:
self.error(ERROR_INTERNAL_ERROR, "Problem while trying to save repo settings to %s: %s"%(e.filename,e.strerror))
+ def get_updates(self):
+ self._apt_cache.upgrade(False)
+ for pkg in self._apt_cache.getChanges():
+ self._emit_package(Package(self, pkg))
+
+ def get_update_detail(self, package):
+ self.allow_cancel(True)
+ self.percentage(None)
+ self.status(STATUS_INFO)
+ name, version, flavor = self.get_package_from_id(id)
+ installed = self._apt_cache[name].isInstalled
+ #update = self._get_updated(pkg)
+ update = ""
+ obsolete = ""
+ #desc,urls,reboot = self._get_update_extras(id)
+ #cve_url = self._format_list(urls['cve'])
+ cve_url = ""
+ #bz_url = self._format_list(urls['jira'])
+ bz_url = ""
+ #vendor_url = self._format_list(urls['vendor'])
+ vendor_url = ""
+ reboot = "none"
+ desc = self._apt_cache[name].description
+ self.update_detail(id,update,obsolete,vendor_url,bz_url,cve_url,reboot,desc)
+
+
def install_file (self, inst_file):
'''
Implement the {backend}-install_file functionality
diff --git a/backends/apt/helpers/get-update-detail.py b/backends/apt/helpers/get-update-detail.py
new file mode 100755
index 0000000..5524d9a
--- /dev/null
+++ b/backends/apt/helpers/get-update-detail.py
@@ -0,0 +1,18 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2008 Michael Vogt <mvo at ubuntu.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+
+from aptBackend import PackageKitAptBackend
+package=sys.argv[1]
+backend = PackageKitAptBackend(sys.argv[2:])
+backend.get_update_detail(package)
+sys.exit(0)
diff --git a/backends/apt/helpers/get-updates.py b/backends/apt/helpers/get-updates.py
new file mode 100755
index 0000000..5c9d26e
--- /dev/null
+++ b/backends/apt/helpers/get-updates.py
@@ -0,0 +1,17 @@
+#!/usr/bin/python
+#
+# Copyright (C) 2008 Michael Vogt <mvo at ubuntu.com>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+from aptBackend import PackageKitAptBackend
+
+backend = PackageKitAptBackend(sys.argv[1:])
+backend.get_updates()
+sys.exit(0)
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index a477137..5371163 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -131,6 +131,17 @@ backend_get_updates (PkBackend *backend)
}
/**
+ * backend_get_update_detail:
+ */
+static void
+backend_get_update_detail (PkBackend *backend)
+{
+ g_return_if_fail (backend != NULL);
+ g_return_if_fail (spawn != NULL);
+ pk_backend_spawn_helper (spawn, "get-update-detail.py", NULL);
+}
+
+/**
* backend_install_package:
*/
static void
@@ -243,7 +254,7 @@ PK_BACKEND_OPTIONS (
backend_get_description, /* get_description */
NULL, /* get_files */
NULL, /* get_requires */
- NULL, /* get_update_detail */
+ backend_get_update_detail, /* get_update_detail */
backend_get_updates, /* get_updates */
backend_install_package, /* install_package */
NULL, /* install_file */
--
1.5.3.7
--GRPZ8SYKNexpdSJ7
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-backends-apt-helpers-aptBackend.py.patch"
More information about the PackageKit
mailing list