[yum-commits] Branch 'yum-3_2_X' - 2 commits - yumcommands.py

James Antill james at osuosl.org
Tue Aug 11 21:18:58 UTC 2009


 yumcommands.py |   38 +++++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 11 deletions(-)

New commits:
commit 7eaae631092cdd2d09ece8b87b648ca316c909fe
Author: James Antill <james at and.org>
Date:   Tue Aug 11 17:01:07 2009 -0400

    Cleanup whitespace for repolist -v

diff --git a/yumcommands.py b/yumcommands.py
index 488f831..bd73d0c 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -824,15 +824,15 @@ class RepoListCommand(YumCommand):
                         md = repo.repoXML
                     else:
                         md = None
-                    out = [base.fmtKeyValFill(_("Repo-id     : "), repo),
-                           base.fmtKeyValFill(_("Repo-name   : "), repo.name),
-                           base.fmtKeyValFill(_("Repo-status : "), ui_enabled)]
+                    out = [base.fmtKeyValFill(_("Repo-id      : "), repo),
+                           base.fmtKeyValFill(_("Repo-name    : "), repo.name),
+                           base.fmtKeyValFill(_("Repo-status  : "), ui_enabled)]
                     if md and md.revision is not None:
                         out += [base.fmtKeyValFill(_("Repo-revision: "),
                                                    md.revision)]
                     if md and md.tags['content']:
                         tags = md.tags['content']
-                        out += [base.fmtKeyValFill(_("Repo-tags   : "),
+                        out += [base.fmtKeyValFill(_("Repo-tags    : "),
                                                    ", ".join(sorted(tags)))]
 
                     if md and md.tags['distro']:
@@ -843,17 +843,17 @@ class RepoListCommand(YumCommand):
                                                        ", ".join(sorted(tags))))]
 
                     if md:
-                        out += [base.fmtKeyValFill(_("Repo-updated: "),
+                        out += [base.fmtKeyValFill(_("Repo-updated : "),
                                                    time.ctime(md.timestamp)),
-                                base.fmtKeyValFill(_("Repo-pkgs   : "), ui_num),
-                                base.fmtKeyValFill(_("Repo-size   : "),ui_size)]
+                                base.fmtKeyValFill(_("Repo-pkgs    : "),ui_num),
+                                base.fmtKeyValFill(_("Repo-size    : "),ui_size)]
 
                     if hasattr(repo, '_orig_baseurl'):
                         baseurls = repo._orig_baseurl
                     else:
                         baseurls = repo.baseurl
                     if baseurls:
-                        out += [base.fmtKeyValFill(_("Repo-baseurl: "),
+                        out += [base.fmtKeyValFill(_("Repo-baseurl : "),
                                                    ", ".join(baseurls))]
 
                     if enabled:
@@ -868,7 +868,7 @@ class RepoListCommand(YumCommand):
                             out += [base.fmtKeyValFill(_("  Updated    : "),
                                                        time.ctime(ts))]
                     elif repo.mirrorlist:
-                        out += [base.fmtKeyValFill(_("Repo-mirrors: "),
+                        out += [base.fmtKeyValFill(_("Repo-mirrors : "),
                                                    repo.mirrorlist)]
 
                     if not os.path.exists(repo.metadata_cookie):
@@ -885,14 +885,14 @@ class RepoListCommand(YumCommand):
                         num = locale.format("%d", repo.metadata_expire, True)
                         num = _("%s second(s) (last: %s)") % (num, last)
 
-                    out += [base.fmtKeyValFill(_("Repo-expire : "), num)]
+                    out += [base.fmtKeyValFill(_("Repo-expire  : "), num)]
 
                     if repo.exclude:
-                        out += [base.fmtKeyValFill(_("Repo-exclude: "),
+                        out += [base.fmtKeyValFill(_("Repo-exclude : "),
                                                    ", ".join(repo.exclude))]
 
                     if repo.includepkgs:
-                        out += [base.fmtKeyValFill(_("Repo-include: "),
+                        out += [base.fmtKeyValFill(_("Repo-include : "),
                                                    ", ".join(repo.includepkgs))]
 
                     base.verbose_logger.log(logginglevels.DEBUG_3,
commit fd1632c733c47719fb7e69d7e2a9d18f7c05b0ad
Author: James Antill <james at and.org>
Date:   Tue Aug 11 13:33:27 2009 -0400

     Add expire data to repolist -v
    
     This should give enough data to diagnose if there is a problem updating
    the repo metadata ... as we know have:
    
    1. Latest version from metalink.
    2. Version we have.
    3. Last time we checked (and how often / how long until we check again)
    
    ...just use seconds, and need to think about how to get some colour in
    here, for Seth :).

diff --git a/yumcommands.py b/yumcommands.py
index edaddfd..488f831 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -871,6 +871,22 @@ class RepoListCommand(YumCommand):
                         out += [base.fmtKeyValFill(_("Repo-mirrors: "),
                                                    repo.mirrorlist)]
 
+                    if not os.path.exists(repo.metadata_cookie):
+                        last = _("Unknown")
+                    else:
+                        last = os.stat(repo.metadata_cookie).st_mtime
+                        last = time.ctime(last)
+
+                    if repo.metadata_expire <= -1:
+                        num = _("Never (last: %s)") % last
+                    elif not repo.metadata_expire:
+                        num = _("Instant (last: %s)") % last
+                    else:
+                        num = locale.format("%d", repo.metadata_expire, True)
+                        num = _("%s second(s) (last: %s)") % (num, last)
+
+                    out += [base.fmtKeyValFill(_("Repo-expire : "), num)]
+
                     if repo.exclude:
                         out += [base.fmtKeyValFill(_("Repo-exclude: "),
                                                    ", ".join(repo.exclude))]


More information about the Yum-commits mailing list