[Yum-devel] [PATCH] Hack the changelog timestamps, so that ordering by timestamps alone will always preserve the original rpm order.

James Antill james at and.org
Fri Jan 29 17:58:30 UTC 2010


 Atm. if you have:

 * Thu Jan 28 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 2.2-10
 - Fix tuple_copy() further (it was completely broken as the mowgli

 * Thu Jan 28 2010 Michael Schwendt <mschwendt at fedoraproject.org> - 2.2-9
 - Let set_tuple_cb() work on a copied tuple

...it can come out in any order (and often comes out backwards atm.)
this hacks the changelog timestamps so the time is one second later for the
2.2-10 update.

 Fixes trac ticket 7, at least one BZ and lots of annoying threads on f-d-l.

 Not 100% on what this will do on the output side, but it's very likely
to be fine adding a couple of seconds (and everything should just be
printing the date).
---
 yum/packages.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/yum/packages.py b/yum/packages.py
index 3455fab..73c0eee 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1062,7 +1062,15 @@ class YumAvailablePackage(PackageObject, RpmBase):
             clogs = self.changelog
         else:
             clogs = self.changelog[:clog_limit]
+        last_ts = 0
+        hack_ts = 0
         for (ts, author, content) in reversed(clogs):
+            if ts != last_ts:
+                hack_ts = 0
+            else:
+                hack_ts += 1
+            last_ts = ts
+            ts += hack_ts
             msg += """<changelog author="%s" date="%s">%s</changelog>\n""" % (
                         misc.to_xml(author, attrib=True), misc.to_xml(str(ts)), 
                         misc.to_xml(content))
-- 
1.6.6



More information about the Yum-devel mailing list