[yum-commits] Branch 'yum-3_2_X' - 5 commits - output.py yum/config.py yumcommands.py

James Antill james at osuosl.org
Tue Feb 17 23:56:51 UTC 2009


 output.py      |   27 ++++++++++++++++++++-------
 yum/config.py  |    6 ++++++
 yumcommands.py |   31 +++++++++++++++++++++++++++----
 3 files changed, 53 insertions(+), 11 deletions(-)

New commits:
commit f221c9d694881439aef0f0a793a6294d1bf74724
Author: James Antill <james at and.org>
Date:   Tue Feb 17 14:57:59 2009 -0500

    Fix which line gets sorted in list updates

diff --git a/yumcommands.py b/yumcommands.py
index ce93535..0d4ca47 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -278,9 +278,9 @@ class InfoCommand(YumCommand):
                     if key not in inst_pkgs or pkg.verGT(inst_pkgs[key]):
                         inst_pkgs[key] = pkg
 
-            if highlight and sorted(ypl.updates):
+            if highlight and ypl.updates:
                 # Do the local/remote split we get in "yum updates"
-                for po in ypl.updates:
+                for po in sorted(ypl.updates):
                     if po.repo.id != 'installed' and po.verifyLocalPkg():
                         local_pkgs[(po.name, po.arch)] = po
 
commit b5425e18eb76e0c316a245659c338d9c34589e2b
Author: James Antill <james at and.org>
Date:   Tue Feb 17 11:29:05 2009 -0500

    And do the update highlighting for obsoletes

diff --git a/output.py b/output.py
index 7cc8270..62af285 100755
--- a/output.py
+++ b/output.py
@@ -551,8 +551,12 @@ class YumOutput:
 
         if columns is not None:
             # New style, output all info. for both old/new with old indented
-            self.simpleList(changePkg, columns=columns)
-            self.simpleList(instPkg,   columns=columns, indent=' ' * 4)
+            chi = self.conf.color_update_remote
+            if changePkg.repo.id != 'installed' and changePkg.verifyLocalPkg():
+                chi = self.conf.color_update_local
+            self.simpleList(changePkg, columns=columns, highlight=chi)
+            self.simpleList(instPkg,   columns=columns, indent=' ' * 4,
+                            highlight=self.conf.color_update_installed)
             return
 
         # Old style
commit fdca777f0f0474abf9bee6bc0af73a5f2ccb471b
Author: James Antill <james at and.org>
Date:   Tue Feb 17 11:17:24 2009 -0500

    Do the "yum update" colours for list updates

diff --git a/yumcommands.py b/yumcommands.py
index ae2a411..ce93535 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -251,6 +251,7 @@ class InfoCommand(YumCommand):
         else:
             update_pkgs = {}
             inst_pkgs   = {}
+            local_pkgs  = {}
 
             columns = None
             if basecmd == 'list':
@@ -277,6 +278,12 @@ class InfoCommand(YumCommand):
                     if key not in inst_pkgs or pkg.verGT(inst_pkgs[key]):
                         inst_pkgs[key] = pkg
 
+            if highlight and sorted(ypl.updates):
+                # Do the local/remote split we get in "yum updates"
+                for po in ypl.updates:
+                    if po.repo.id != 'installed' and po.verifyLocalPkg():
+                        local_pkgs[(po.name, po.arch)] = po
+
             # Output the packages:
             clio = base.conf.color_list_installed_older
             clin = base.conf.color_list_installed_newer
@@ -296,8 +303,11 @@ class InfoCommand(YumCommand):
                                                  '=' : clar, 'not in' : clai})
             rep = base.listPkgs(ypl.extras, _('Extra Packages'), basecmd,
                                 columns=columns)
+            cul = base.conf.color_update_local
+            cur = base.conf.color_update_remote
             rup = base.listPkgs(ypl.updates, _('Updated Packages'), basecmd,
-                                columns=columns)
+                                highlight_na=local_pkgs, columns=columns,
+                                highlight_modes={'=' : cul, 'not in' : cur})
 
             # XXX put this into the ListCommand at some point
             if len(ypl.obsoletes) > 0 and basecmd == 'list': 
@@ -572,8 +582,19 @@ class CheckUpdateCommand(YumCommand):
 
             columns = _list_cmd_calc_columns(base, ypl)
             if len(ypl.updates) > 0:
+                local_pkgs = {}
+                highlight = base.term.MODE['bold']
+                if highlight:
+                    # Do the local/remote split we get in "yum updates"
+                    for po in sorted(ypl.updates):
+                        if po.repo.id != 'installed' and po.verifyLocalPkg():
+                            local_pkgs[(po.name, po.arch)] = po
+
+                cul = base.conf.color_update_local
+                cur = base.conf.color_update_remote
                 base.listPkgs(ypl.updates, '', outputType='list',
-                              columns=columns)
+                              highlight_na=local_pkgs, columns=columns,
+                              highlight_modes={'=' : cul, 'not in' : cur})
                 result = 100
             if len(ypl.obsoletes) > 0: # This only happens in verbose mode
                 rop = [0, '']
commit c5e7d8e9e04482733b748850d659617e1a4231f9
Author: James Antill <james at and.org>
Date:   Tue Feb 17 11:04:41 2009 -0500

    Add whizbang colorization to update, to show which pkgs are on disk

diff --git a/output.py b/output.py
index 74081d3..7cc8270 100755
--- a/output.py
+++ b/output.py
@@ -897,7 +897,14 @@ class YumOutput:
             if a is None: # gpgkeys are weird
                 a = 'noarch'
 
-            lines.append((n, a, evr, repoid, size, obsoletes))
+            # none, partial, full?
+            if po.repo.id == 'installed':
+                hi = self.conf.color_update_installed
+            elif po.verifyLocalPkg():
+                hi = self.conf.color_update_local
+            else:
+                hi = self.conf.color_update_remote
+            lines.append((n, a, evr, repoid, size, obsoletes, hi))
             #  Create a dict of field_length => number of packages, for
             # each field.
             for (d, v) in (("n",len(n)), ("v",len(evr)), ("r",len(repoid))):
@@ -948,13 +955,15 @@ class YumOutput:
         for (action, lines) in pkglist_lines:
             if lines:
                 totalmsg = u"%s:\n" % action
-            for (n, a, evr, repoid, size, obsoletes) in lines:
-                columns = ((n,   -n_wid), (a,      -a_wid),
+            for (n, a, evr, repoid, size, obsoletes, hi) in lines:
+                columns = ((n,   -n_wid, hi), (a,      -a_wid),
                            (evr, -v_wid), (repoid, -r_wid), (size, s_wid))
                 msg = self.fmtColumns(columns, u" ", u"\n")
+                hibeg, hiend = self._highlight(self.conf.color_update_installed)
                 for obspo in obsoletes:
-                    appended = _('     replacing  %s.%s %s\n\n') % (obspo.name,
-                        obspo.arch, obspo.printVer())
+                    appended = _('     replacing  %s%s%s.%s %s\n\n')
+                    appended %= (hibeg, obspo.name, hiend,
+                                 obspo.arch, obspo.printVer())
                     msg = msg+appended
                 totalmsg = totalmsg + msg
         
diff --git a/yum/config.py b/yum/config.py
index d35477f..ebe4b51 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -683,6 +683,10 @@ class YumConf(StartupConf):
     color_list_available_reinstall = Option('bold,underline,green')
     color_list_available_install = Option('normal')
 
+    color_update_installed = Option('normal')
+    color_update_local     = Option('bold')
+    color_update_remote    = Option('normal')
+
     color_search_match = Option('bold')
     
     _reposlist = []
commit b139f9ef6d3a010771bd7008ba13816af1013211
Author: James Antill <james at and.org>
Date:   Thu Feb 12 20:32:57 2009 -0500

    Add reinstall colour, now we display them

diff --git a/yum/config.py b/yum/config.py
index ae7b2f9..d35477f 100644
--- a/yum/config.py
+++ b/yum/config.py
@@ -675,10 +675,12 @@ class YumConf(StartupConf):
                                     'tty' : 'auto', 'if-tty' : 'auto'})
     color_list_installed_older = Option('bold')
     color_list_installed_newer = Option('bold,yellow')
+    color_list_installed_reinstall = Option('normal')
     color_list_installed_extra = Option('bold,red')
 
     color_list_available_upgrade = Option('bold,blue')
     color_list_available_downgrade = Option('dim,cyan')
+    color_list_available_reinstall = Option('bold,underline,green')
     color_list_available_install = Option('normal')
 
     color_search_match = Option('bold')
diff --git a/yumcommands.py b/yumcommands.py
index 0334b6d..ae2a411 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -280,18 +280,20 @@ class InfoCommand(YumCommand):
             # Output the packages:
             clio = base.conf.color_list_installed_older
             clin = base.conf.color_list_installed_newer
+            clir = base.conf.color_list_installed_reinstall
             clie = base.conf.color_list_installed_extra
             rip = base.listPkgs(ypl.installed, _('Installed Packages'), basecmd,
                                 highlight_na=update_pkgs, columns=columns,
                                 highlight_modes={'>' : clio, '<' : clin,
-                                                 'not in' : clie})
+                                                 '=' : clir, 'not in' : clie})
             clau = base.conf.color_list_available_upgrade
             clad = base.conf.color_list_available_downgrade
+            clar = base.conf.color_list_available_reinstall
             clai = base.conf.color_list_available_install
             rap = base.listPkgs(ypl.available, _('Available Packages'), basecmd,
                                 highlight_na=inst_pkgs, columns=columns,
                                 highlight_modes={'<' : clau, '>' : clad,
-                                                 'not in' : clai})
+                                                 '=' : clar, 'not in' : clai})
             rep = base.listPkgs(ypl.extras, _('Extra Packages'), basecmd,
                                 columns=columns)
             rup = base.listPkgs(ypl.updates, _('Updated Packages'), basecmd,


More information about the Yum-commits mailing list