From d2bcd21737b5b10291e18bc45aa8b3c35b2c0e29 Mon Sep 17 00:00:00 2001 From: Gui Chen Date: Wed, 16 Oct 2013 01:45:00 -0400 Subject: [PATCH] work around to correct counter number of installing packages 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 --- mic/utils/rpmmisc.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py index 8d8ecfe..d8467ec 100644 --- a/mic/utils/rpmmisc.py +++ b/mic/utils/rpmmisc.py @@ -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 -- 2.7.4