[Yum-devel] [PATCH 1/2] Add expire data to repolist -v
James Antill
james at and.org
Tue Aug 11 17:39:30 UTC 2009
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)
---
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
More information about the Yum-devel
mailing list