On Thu, May 6, 2010 at 9:12 PM, James Antill <ja...@and.org> wrote:

> ---
>  output.py      |   12 +++++++++---
>  yum/history.py |   15 +++++++++++----
>  2 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/output.py b/output.py
> index 484fd5e..7a3cfb0 100755
> --- a/output.py
> +++ b/output.py
> @@ -1440,7 +1440,7 @@ to exit.
>     def _historyInfoCmd(self, old, pats=[]):
>         name = self._pwd_ui_username(old.loginuid)
>
> -        def _simple_pkg(pkg, prefix_len):
> +        def _simple_pkg(pkg, prefix_len, highlight=False):
>             prefix = " " * prefix_len
>             state  = _('Installed')
>             ipkgs = self.rpmdb.searchNames([hpkg.name])
> @@ -1455,7 +1455,13 @@ to exit.
>                 state  = _('Newer')
>             else:
>                 assert False, "Impossible, installed not newer and not
> older"
> -            print "%s%s %s" % (prefix, utf8_width_fill(state, 12), hpkg)
> +            if highlight:
> +                (hibeg, hiend) = self._highlight('bold')
> +            else:
> +                (hibeg, hiend) = self._highlight('normal')
> +            print "%s%s %s%s%s" % (prefix,
> +                                   hibeg, utf8_width_fill(state, 12),
> hiend,
> +                                   hpkg)
>
>         print _("Transaction ID :"), old.tid
>         begtm = time.ctime(old.beg_timestamp)
> @@ -1526,7 +1532,7 @@ to exit.
>             key = "%s%s: " % (" " * 4, prob.problem)
>             print self.fmtKeyValFill(key, prob.text)
>             for hpkg in prob.packages:
> -                _simple_pkg(hpkg, 8)
> +                _simple_pkg(hpkg, 8, highlight=hpkg.main)
>
>         if old.output:
>             print _("Scriptlet output:")
> diff --git a/yum/history.py b/yum/history.py
> index 8983261..50dee0b 100644
> --- a/yum/history.py
> +++ b/yum/history.py
> @@ -431,10 +431,14 @@ class YumHistory:
>
>         for pkg in pkgs.values():
>             pid = self.pkg2pid(pkg)
> +            if pkg.pkgtup == problem.pkg.pkgtup:
> +                main = 'TRUE'
> +            else:
> +                main = 'FALSE'
>             res = executeSQL(cur,
>                              """INSERT INTO trans_prob_pkgs
> -                             (rpid, pkgtupid)
> -                             VALUES (?, ?)""", (rpid, pid))
> +                             (rpid, pkgtupid, main)
> +                             VALUES (?, ?, ?)""", (rpid, pid, main))
>
>         return rpid
>
> @@ -609,13 +613,14 @@ class YumHistory:
>         if cur is None or not self._update_db_file_2():
>             return []
>         executeSQL(cur,
> -                   """SELECT name, arch, epoch, version, release, checksum
> +                   """SELECT name, arch, epoch, version, release,
> checksum, main
>                       FROM trans_prob_pkgs JOIN pkgtups USING(pkgtupid)
>                       WHERE rpid = ?
>                       ORDER BY name ASC, epoch ASC""", (rpid,))
>         ret = []
>         for row in cur:
>             obj = YumHistoryPackage(row[0],row[1],row[2],row[3],row[4],
> row[5])
> +            obj.main = row[6] == 'TRUE'
>             ret.append(obj)
>         return ret
>
> @@ -809,7 +814,8 @@ class YumHistory:
>  \
>  CREATE TABLE trans_prob_pkgs (
>      rpid INTEGER NOT NULL REFERENCES trans_rpmdb_problems,
> -     pkgtupid INTEGER NOT NULL REFERENCES pkgtups);
> +     pkgtupid INTEGER NOT NULL REFERENCES pkgtups,
> +     main BOOL NOT NULL DEFAULT FALSE);
>  ''', '''\
>  \
>  CREATE VIEW vtrans_data_pkgs AS
> @@ -839,6 +845,7 @@ class YumHistory:
>  \
>  CREATE VIEW vtrans_prob_pkgs AS
>      SELECT tid,rpid,name,epoch,version,release,arch,pkgtupid,
> +            main,
>             name || '-' || epoch || ':' ||
>             version || '-' || release || '.' || arch AS nevra
>      FROM (trans_prob_pkgs JOIN trans_rpmdb_problems USING(rpid))
> --
> 1.7.0.1
>
> _______________________________________________
> Yum-devel mailing list
> Yum-devel@lists.baseurl.org
> http://lists.baseurl.org/mailman/listinfo/yum-devel
>

ACK
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel

Reply via email to