[yum-commits] Branch 'yum-3_2_X' - 3 commits - cli.py yum/packages.py yum/sqlitesack.py

James Antill james at osuosl.org
Mon Feb 1 20:35:07 UTC 2010


 cli.py            |    4 +++-
 yum/packages.py   |    8 ++++++++
 yum/sqlitesack.py |    9 ++++++++-
 3 files changed, 19 insertions(+), 2 deletions(-)

New commits:
commit 5563e70d85216ab162ce157b89c05114a1d3ed55
Author: James Antill <james at and.org>
Date:   Fri Jan 29 13:27:11 2010 -0500

    Remove the extra seconds in the .sqlite loading (sucks to be apt ;)

diff --git a/yum/sqlitesack.py b/yum/sqlitesack.py
index 501fa59..bf0cea9 100644
--- a/yum/sqlitesack.py
+++ b/yum/sqlitesack.py
@@ -331,7 +331,14 @@ class YumAvailablePackageSqlite(YumAvailablePackage, PackageObject, RpmBase):
             # Check count(pkgId) here, the same way we do in searchFiles()?
             # Failure mode is much less of a problem.
             for ob in cur:
-                c_date = ob['date']
+                # Note: Atm. rpm only does days, where (60 * 60 * 24) == 86400
+                #       and we have the hack in _dump_changelog() to keep the
+                #       order the same, so this is a quick way to get rid of
+                #       any extra "seconds".
+                #       We still leak the seconds if there are 100 updates in
+                #       a day ... but don't do that. It also breaks if rpm ever
+                #       gets fixed (but that is unlikely).
+                c_date = 100 * (ob['date'] / 100)
                 c_author = to_utf8(ob['author'])
                 c_log = to_utf8(ob['changelog'])
                 result.append((c_date, _share_data(c_author), c_log))
commit fc54390b0c06f2b1e504b1d37344aa3778a25e61
Author: James Antill <james at and.org>
Date:   Fri Jan 29 13:26:47 2010 -0500

    Only show dates for commits, in --version

diff --git a/cli.py b/cli.py
index 53025cc..f5ed53d 100644
--- a/cli.py
+++ b/cli.py
@@ -211,6 +211,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             done = False
             def sm_ui_time(x):
                 return time.strftime("%Y-%m-%d %H:%M", time.gmtime(x))
+            def sm_ui_date(x): # For changelogs, there is no time
+                return time.strftime("%Y-%m-%d", time.gmtime(x))
             for pkg in sorted(self.rpmdb.returnPackages(patterns=yum_progs)):
                 # We should only have 1 version of each...
                 if done: print ""
@@ -227,7 +229,7 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
                 print _("  Built    : %s at %s") % (pkg.packager,
                                                     sm_ui_time(pkg.buildtime))
                 print _("  Committed: %s at %s") % (pkg.committer,
-                                                    sm_ui_time(pkg.committime))
+                                                    sm_ui_date(pkg.committime))
             sys.exit(0)
 
         if opts.sleeptime is not None:
commit 83ea015350e40b11013dd8d03f07558ea4f4cad9
Author: James Antill <james at and.org>
Date:   Fri Jan 29 12:54:07 2010 -0500

     Hack the changelog timestamps, so that ordering by timestamps alone
    will always preserve the original rpm order.
    
     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).

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))


More information about the Yum-commits mailing list