On Tue, 11 Aug 2009, James Antill wrote:
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)
Can't wait for the colors coded repolist -v ;)
Would it be ridiculous to just list the expiration time in seconds
remaining and forego all the %weeks/seconds/hours/ code?
considering how it will be used I think knowing how many weeks 75000000
seconds is kinda unnecessary.
What do you think? just show the seconds?
-sv
---
yumcommands.py | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/yumcommands.py b/yumcommands.py
index edaddfd..d6845e8 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -871,6 +871,31 @@ class RepoListCommand(YumCommand):
out += [base.fmtKeyValFill(_("Repo-mirrors: "),
repo.mirrorlist)]
+ if not os.path.exists(repo.metadata_cookie):
+ last = _("Unkown")
+ 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 = repo.metadata_expire
+ num2time = {(7*24*60*60) : _("%s week(s) (last: %s)"),
+ ( 24*60*60) : _("%s day(s) (last: %s)"),
+ ( 60*60) : _("%s hour(s) (last: %s)"),
+ ( 60) : _("%s minute(s) (last:
%s)"),
+ ( 0) : _("%s second(s) (last:
%s)")}
+ for cnum in reversed(sorted(num2time)):
+ if num > (cnum * 1.5):
+ num /= cnum
+ num = locale.format("%d", num, True)
+ num = num2time[cnum] % (num, last)
+ break
+ out += [base.fmtKeyValFill(_("Repo-expire : "), num)]
+
if repo.exclude:
out += [base.fmtKeyValFill(_("Repo-exclude: "),
", ".join(repo.exclude))]
--
1.6.2.5
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel
_______________________________________________
Yum-devel mailing list
Yum-devel@lists.baseurl.org
http://lists.baseurl.org/mailman/listinfo/yum-devel