[Kimchi-devel] [PATCH] [PATCH] bug fix: instantiate the apt-get manager when update the apt-get packages list

shaohef at linux.vnet.ibm.com shaohef at linux.vnet.ibm.com
Tue Mar 18 03:16:50 UTC 2014


From: ShaoHe Feng <shaohef at linux.vnet.ibm.com>

I have not test this patch on ubuntu.

I just test the yum patch.

We should make sure:
1. apt-get packages list can be updated after apt-get update a package.

2. there should not be a apt-get lock conflict when get apt-get packages list and
update apt-get packages.

Signed-off-by: ShaoHe Feng <shaohef at linux.vnet.ibm.com>
---
 src/kimchi/swupdate.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/kimchi/swupdate.py b/src/kimchi/swupdate.py
index dc48153..6ab968f 100644
--- a/src/kimchi/swupdate.py
+++ b/src/kimchi/swupdate.py
@@ -170,16 +170,17 @@ class AptUpdate(object):
     """
     def __init__(self):
         self._pkgs = {}
-        self._apt_cache = getattr(__import__('apt'), 'Cache')()
+        self._apt_cache = getattr(__import__('apt'), 'Cache')
         self.update_cmd = ['apt-get', 'upgrade', '-y']
 
     def _refreshUpdateList(self):
         """
         Update the list of packages to be updated in the system.
         """
-        self._apt_cache.update()
-        self._apt_cache.upgrade()
-        self._pkgs = self._apt_cache.get_changes()
+        apt_cache = self._apt_cache()
+        apt_cache.update()
+        apt_cache.upgrade()
+        self._pkgs = apt_cache.get_changes()
 
     def getPackagesList(self):
         """
-- 
1.8.5.3




More information about the Kimchi-devel mailing list