work around to correct counter number of installing packages
authorGui Chen <gui.chen@intel.com>
Wed, 16 Oct 2013 05:45:00 +0000 (01:45 -0400)
committerGui Chen <gui.chen@intel.com>
Wed, 16 Oct 2013 05:45:00 +0000 (01:45 -0400)
when two packages are required by each other, their rpm files
are both opened, but they both enter install progress together,
then they use the same counter number

Change-Id: If0632a485afb6c24ed24c2fb9d839ebb15f6fc57
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/utils/rpmmisc.py

index 8d8ecfe..d8467ec 100644 (file)
@@ -35,6 +35,7 @@ class RPMInstallCallback:
         self.callbackfilehandles = {}
         self.total_actions = 0
         self.total_installed = 0
+        self.total_installing = 0
         self.installed_pkg_names = []
         self.total_removed = 0
         self.mark = "+"
@@ -67,7 +68,7 @@ class RPMInstallCallback:
         l = len(str(self.total_actions))
         size = "%s.%s" % (l, l)
         fmt_done = "[%" + size + "s/%" + size + "s]"
-        done = fmt_done % (self.total_installed + self.total_removed,
+        done = fmt_done % (self.total_installing,
                            self.total_actions)
         marks = self.marks - (2 * l)
         width = "%s.%s" % (marks, marks)
@@ -138,6 +139,12 @@ class RPMInstallCallback:
                 #pkgtup = self._dopkgtup(hdr)
                 self.logString.append(self._logPkgString(hdr))
 
+        elif what == rpm.RPMCALLBACK_INST_START:
+            self.total_installing += 1
+
+        elif what == rpm.RPMCALLBACK_UNINST_STOP:
+            pass
+
         elif what == rpm.RPMCALLBACK_INST_PROGRESS:
             if h is not None:
                 percent = (self.total_installed*100L)/self.total_actions