[Yum-devel] [PATCH 2/2] Highlight the running kernel specially

Seth Vidal skvidal at fedoraproject.org
Tue Nov 3 14:24:48 UTC 2009



On Mon, 2 Nov 2009, James Antill wrote:

> ---
> output.py      |    4 +++-
> yum/config.py  |    2 ++
> yumcommands.py |    4 ++++
> 3 files changed, 9 insertions(+), 1 deletions(-)
>
> diff --git a/output.py b/output.py
> index 46168aa..e213b43 100755
> --- a/output.py
> +++ b/output.py
> @@ -588,6 +588,7 @@ class YumOutput:
>            ...also highlight_na can be passed, and we'll highlight
>            pkgs with (names, arch) in that set."""
>
> +        kern_pkgtup = yum.misc.get_running_kernel_pkgtup(self.ts)
>         if outputType in ['list', 'info']:
>             thingslisted = 0
>             if len(lst) > 0:
> @@ -596,7 +597,8 @@ class YumOutput:
>                 for pkg in sorted(lst):
>                     key = (pkg.name, pkg.arch)
>                     highlight = False
> -                    if False: pass
> +                    if pkg.pkgtup == kern_pkgtup:
> +                        highlight = highlight_modes.get('kern','bold,underline')
>                     elif key not in highlight_na:
>                         highlight = highlight_modes.get('not in', 'normal')
>                     elif pkg.verEQ(highlight_na[key]):
> diff --git a/yum/config.py b/yum/config.py
> index 2ae7e89..16f828e 100644
> --- a/yum/config.py
> +++ b/yum/config.py
> @@ -686,11 +686,13 @@ class YumConf(StartupConf):
>     color_list_installed_newer = Option('bold,yellow')
>     color_list_installed_reinstall = Option('normal')
>     color_list_installed_extra = Option('bold,red')
> +    color_list_installed_running_kernel = Option('bold,underline')
>
>     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_list_available_running_kernel = Option('bold,underline')
>
>     color_update_installed = Option('normal')
>     color_update_local     = Option('bold')
> diff --git a/yumcommands.py b/yumcommands.py
> index 1451a36..5204b30 100644
> --- a/yumcommands.py
> +++ b/yumcommands.py
> @@ -288,6 +288,7 @@ class InfoCommand(YumCommand):
>                         local_pkgs[(po.name, po.arch)] = po
>
>             # Output the packages:
> +            kern = base.conf.color_list_installed_running_kernel
>             clio = base.conf.color_list_installed_older
>             clin = base.conf.color_list_installed_newer
>             clir = base.conf.color_list_installed_reinstall
> @@ -295,7 +296,9 @@ class InfoCommand(YumCommand):
>             rip = base.listPkgs(ypl.installed, _('Installed Packages'), basecmd,
>                                 highlight_na=update_pkgs, columns=columns,
>                                 highlight_modes={'>' : clio, '<' : clin,
> +                                                 'kern' : kern,
>                                                  '=' : clir, 'not in' : clie})
> +            kern = base.conf.color_list_available_running_kernel
>             clau = base.conf.color_list_available_upgrade
>             clad = base.conf.color_list_available_downgrade
>             clar = base.conf.color_list_available_reinstall
> @@ -303,6 +306,7 @@ class InfoCommand(YumCommand):
>             rap = base.listPkgs(ypl.available, _('Available Packages'), basecmd,
>                                 highlight_na=inst_pkgs, columns=columns,
>                                 highlight_modes={'<' : clau, '>' : clad,
> +                                                 'kern' : kern,
>                                                  '=' : clar, 'not in' : clai})
>             rep = base.listPkgs(ypl.extras, _('Extra Packages'), basecmd,
>                                 columns=columns)


I'm not in love with this. If only b/c as far i know no one knows what 
any of the colors mean most of the time.

-sv





More information about the Yum-devel mailing list