[PATCH] * backends/apt/helpers/get-updates.py: - add updates helper * backends/apt/helpers/aptBackend.py: - add get_updates() method

Michael Vogt mvo at ubuntu.com
Wed Feb 13 08:01:16 PST 2008


---
 backends/apt/helpers/aptBackend.py  |    5 +++++
 backends/apt/helpers/get-updates.py |   17 +++++++++++++++++
 2 files changed, 22 insertions(+), 0 deletions(-)
 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..cc4cfa3 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -426,6 +426,11 @@ 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 install_file (self, inst_file):
         '''
         Implement the {backend}-install_file functionality
diff --git a/backends/apt/helpers/get-updates.py b/backends/apt/helpers/get-updates.py
new file mode 100755
index 0000000..038d099
--- /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)
-- 
1.5.3.7


--Qxx1br4bt0+wmkIi--


More information about the PackageKit mailing list