[yum-commits] yum/repoMDObject.py

zpavlas at osuosl.org zpavlas at osuosl.org
Fri Dec 6 13:41:22 UTC 2013


 yum/repoMDObject.py |   11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

New commits:
commit 8164f4316569618899ed78e60a6c73ae45ce7484
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri Dec 6 14:36:57 2013 +0100

    Revert "Parse float timestamps as valid, for global timestamp."
    
    This reverts commit e08a0de36ba49075ee9802a9586b49dbd9c3d805.
    
    The float timestamps are assigned to *_db types, and these are
    the ones created last, thus having the largest timestamps.
    
    Before this patch, we ignored them, but now they are used and
    actually change the global repomd.xml timestamp, that no longer
    matches the one from metalink.
    
    We need to keep the old behavior for compatibility.

diff --git a/yum/repoMDObject.py b/yum/repoMDObject.py
index 23fc067..97e6797 100755
--- a/yum/repoMDObject.py
+++ b/yum/repoMDObject.py
@@ -26,11 +26,6 @@ def ns_cleanup(qn):
     if qn.find('}') == -1: return qn 
     return qn.split('}')[1]
 
-def _ts_int(timestamp):
-    """ Timestamps are floats in the wild, and int("1.1") is a failure state in
-    python. So this hack ... """
-    return int(timestamp.split('.', 1)[0])
-
 class RepoData:
     """represents anything beneath a <data> tag"""
     def __init__(self, elem=None):
@@ -123,9 +118,9 @@ class RepoData:
         return msg
         
     def getDelta(self, old_timestamp):
-        old_timestamp = _ts_int(old_timestamp)
+        old_timestamp = int(old_timestamp)
         for deltamd in self.deltas:
-            if _ts_int(deltamd.timestamp) <= old_timestamp:
+            if int(deltamd.timestamp) <= old_timestamp:
                 return deltamd
 
 class RepoMD:
@@ -177,7 +172,7 @@ class RepoMD:
                         thisdata = old
                     self.repoData[thisdata.type] = thisdata
                     try:
-                        nts = _ts_int(thisdata.timestamp)
+                        nts = int(thisdata.timestamp)
                         if nts > self.timestamp: # max() not in old python
                             self.timestamp = nts
                     except:


More information about the Yum-commits mailing list