[yum-commits] Branch 'yum-3_2_X' - 4 commits - cli.py output.py yum/misc.py

James Antill james at osuosl.org
Thu Sep 1 13:53:46 UTC 2011


 cli.py      |    4 ++-
 output.py   |   69 +++++++++++++++++++++++++++++++++++++++++++++---------------
 yum/misc.py |    4 ++-
 3 files changed, 58 insertions(+), 19 deletions(-)

New commits:
commit 789093d65d9e34e6c2d750b4eca78b52c9488f28
Author: James Antill <james at and.org>
Date:   Thu Aug 25 12:05:53 2011 -0400

    Don't try to show repos. for skipped packages in history info.

diff --git a/output.py b/output.py
index faffd34..be4e4d9 100755
--- a/output.py
+++ b/output.py
@@ -2081,7 +2081,7 @@ to exit.
         _pkg_states_installed['maxlen'] = maxlen
         _pkg_states_available['maxlen'] = maxlen
         def _simple_pkg(pkg, prefix_len, was_installed=False, highlight=False,
-                        pkg_max_len=0):
+                        pkg_max_len=0, show_repo=True):
             prefix = " " * prefix_len
             if was_installed:
                 _pkg_states = _pkg_states_installed
@@ -2105,9 +2105,11 @@ to exit.
             else:
                 (hibeg, hiend) = self._highlight('normal')
             state = utf8_width_fill(state, _pkg_states['maxlen'])
+            ui_repo = ''
+            if show_repo:
+                ui_repo = self._hpkg2from_repo(hpkg)
             print "%s%s%s%s %-*s %s" % (prefix, hibeg, state, hiend,
-                                        pkg_max_len, hpkg,
-                                        self._hpkg2from_repo(hpkg))
+                                        pkg_max_len, hpkg, ui_repo)
 
         if type(old.tid) == type([]):
             print _("Transaction ID :"), "%u..%u" % (old.tid[0], old.tid[-1])
@@ -2197,7 +2199,9 @@ to exit.
             print _("Packages Skipped:")
             pkg_max_len = max((len(str(hpkg)) for hpkg in old.trans_skip))
         for hpkg in old.trans_skip:
-            _simple_pkg(hpkg, 4, pkg_max_len=pkg_max_len)
+            #  Don't show the repo. here because we can't store it as they were,
+            # by definition, not installed.
+            _simple_pkg(hpkg, 4, pkg_max_len=pkg_max_len, show_repo=False)
 
         if old.rpmdb_problems:
             print _("Rpmdb Problems:")
commit 222e44bbb3d96f0f6d4f61766c0f31f03c0496b9
Author: James Antill <james at and.org>
Date:   Wed Aug 24 17:03:58 2011 -0400

    Fix problems with using old generated data (groups/pkgtag/updateinfo).

diff --git a/yum/misc.py b/yum/misc.py
index 37c572b..04490a6 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -1114,10 +1114,12 @@ def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
         if check_timestamps:
             fi = stat_f(filename)
             fo = stat_f(out)
-            if fi and fo and fo.st_mtime > fi.st_mtime:
+            if fi and fo and fo.st_mtime == fi.st_mtime:
                 return out
 
         _decompress_chunked(filename, out, ztype)
+        if check_timestamps and fi:
+            os.utime(out, (fi.st_mtime, fi.st_mtime))
         
     return out
     
commit 6a7b232ef05d870684aacfbfaeb131cfee7e3cda
Author: James Antill <james at and.org>
Date:   Wed Aug 24 16:15:54 2011 -0400

    Speedup upgrade_requirements_on_install=true significantly.

diff --git a/cli.py b/cli.py
index a1e0e03..ed29ba4 100755
--- a/cli.py
+++ b/cli.py
@@ -763,7 +763,9 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             uret = []
             for req in pkg.requires:
                 for npkg in self.returnInstalledPackagesByDep(req):
-                    uret += self.update(pattern=npkg.name, requiringPo=reqpo)
+                    if npkg.name in done:
+                        continue
+                    uret += self.update(name=npkg.name, requiringPo=reqpo)
                     uret += _pkg2ups(npkg, reqpo=reqpo)
             return uret
 
commit 523d4e21f523fef676083efcfcb78815e5e6ce7b
Author: James Antill <james at and.org>
Date:   Wed Aug 24 16:04:20 2011 -0400

    Tweak the output for transaction summary some more, use dynamic legnths.

diff --git a/output.py b/output.py
index eefcd69..faffd34 100755
--- a/output.py
+++ b/output.py
@@ -1417,7 +1417,7 @@ class YumOutput:
 Transaction Summary
 %s
 """) % ('=' * self.term.columns))
-        for action, count, depcount in (
+        summary_data =  (
             (_('Install'), len(self.tsInfo.installed),
              len(self.tsInfo.depinstalled)),
             (_('Upgrade'), len(self.tsInfo.updated),
@@ -1429,25 +1429,56 @@ Transaction Summary
             (_('Skipped (dependency problems)'), len(self.skipped_packages), 0),
             (_('Not installed'), len(self._not_found_i.values()), 0),
             (_('Not available'), len(self._not_found_a.values()), 0),
-        ):
+        )
+        max_msg_action   = 0
+        max_msg_count    = 0
+        max_msg_pkgs     = 0
+        max_msg_depcount = 0
+        for action, count, depcount in summary_data:
+            if not count and not depcount:
+                continue
+
+            msg_pkgs = P_('Package', 'Packages', count)
+            len_msg_action   = utf8_width(action)
+            len_msg_count    = utf8_width(str(count))
+            len_msg_pkgs     = utf8_width(msg_pkgs)
+
+            if depcount:
+                len_msg_depcount = utf8_width(str(depcount))
+            else:
+                len_msg_depcount = 0
+
+            # dito. max() by hand, due to RHEL-5
+            if len_msg_action > max_msg_action:
+                max_msg_action = len_msg_action
+            if len_msg_count > max_msg_count:
+                max_msg_count = len_msg_count
+            if len_msg_pkgs > max_msg_pkgs:
+                max_msg_pkgs = len_msg_pkgs
+            if len_msg_depcount > max_msg_depcount:
+                max_msg_depcount = len_msg_depcount
+
+        for action, count, depcount in summary_data:
             msg_pkgs = P_('Package', 'Packages', count)
             if depcount:
                 msg_deppkgs = P_('Dependent package', 'Dependent packages',
                                  depcount)
-                max_msg_pkgs  = utf8_width(_('Package'))
-                max_msg_pkgs2 = utf8_width(_('Packages'))
-                if max_msg_pkgs2 > max_msg_pkgs:
-                    max_msg_pkgs = max_msg_pkgs2
                 if count:
-                    msg = '%-9s %5d %-*s (+%5d %s)\n'
-                    out.append(msg % (action, count, max_msg_pkgs, msg_pkgs,
-                                      depcount, msg_deppkgs))
+                    msg = '%s  %*d %s (+%*d %s)\n'
+                    out.append(msg % (utf8_width_fill(action, max_msg_action),
+                                      max_msg_count, count,
+                                      utf8_width_fill(msg_pkgs, max_msg_pkgs),
+                                      max_msg_depcount, depcount, msg_deppkgs))
                 else:
-                    msg = '%-9s %5s %-*s ( %5d %s)\n'
-                    out.append(msg % (action, '', max_msg_pkgs, '',
-                                      depcount, msg_deppkgs))
+                    msg = '%s  %*s %s ( %*d %s)\n'
+                    out.append(msg % (utf8_width_fill(action, max_msg_action),
+                                      max_msg_count, '',
+                                      utf8_width_fill('', max_msg_pkgs),
+                                      max_msg_depcount, depcount, msg_deppkgs))
             elif count:
-                out.append('%-9s %5d %s\n' % (action, count, msg_pkgs))
+                msg = '%s  %*d %s\n'
+                out.append(msg % (utf8_width_fill(action, max_msg_action),
+                                  max_msg_count, count, msg_pkgs))
         return ''.join(out)
         
     def postTransactionOutput(self):


More information about the Yum-commits mailing list