[Kimchi-devel] [PATCH 2/2] Fix issue #430: Properly list packages update on openSUSE systems

Aline Manera alinefm at linux.vnet.ibm.com
Thu Sep 18 14:55:23 UTC 2014


getPackagesList() is supposed to return a list of dictionaries in which
dict represents a package to be updates in the format:

{'package_name': <string>, 'version': <string>, 'arch': <string>,
'repository': <string>}

But it was retuning a list of packages names that was breaking all the
update logic.
Fix it by returning the right data format on getPackagesList()

Signed-off-by: Aline Manera <alinefm at linux.vnet.ibm.com>
---
 src/kimchi/swupdate.py | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py
index 5b24ce0..85cdfd6 100644
--- a/src/kimchi/swupdate.py
+++ b/src/kimchi/swupdate.py
@@ -238,7 +238,7 @@ class ZypperUpdate(object):
         """
         Update the list of packages to be updated in the system.
         """
-        self._pkgs = {}
+        self._pkgs = []
         cmd = ["zypper", "list-updates"]
         (stdout, stderr, returncode) = run_command(cmd)
 
@@ -250,7 +250,7 @@ class ZypperUpdate(object):
                 info = line.split(' | ')
                 package = {'package_name': info[2], 'version': info[4],
                            'arch': info[5], 'repository': info[1]}
-                self._pkgs[info[2]] = package
+                self._pkgs.append(package)
 
     def getPackagesList(self):
         """
@@ -262,7 +262,4 @@ class ZypperUpdate(object):
         kimchiLock.acquire()
         self._refreshUpdateList()
         kimchiLock.release()
-        pkg_list = []
-        for pkg in self._pkgs:
-            pkg_list.append(pkg)
-        return pkg_list
+        return self._pkgs
-- 
1.9.3




More information about the Kimchi-devel mailing list