[yum] Revert the use of float timestamps as it triggers repomd != metalink.

Zdeněk Pavlas zpavlas at fedoraproject.org
Fri Dec 6 13:45:55 UTC 2013


commit aa666c668e6cc09156e5c2bc60d058c5ed90bfd2
Author: Zdenek Pavlas <zpavlas at redhat.com>
Date:   Fri Dec 6 14:45:47 2013 +0100

    Revert the use of float timestamps as it triggers repomd != metalink.

 yum-HEAD.patch |   36 ++++++++++--------------------------
 yum.spec       |    5 ++++-
 2 files changed, 14 insertions(+), 27 deletions(-)
---
diff --git a/yum-HEAD.patch b/yum-HEAD.patch
index 93e91b1..d2e5114 100644
--- a/yum-HEAD.patch
+++ b/yum-HEAD.patch
@@ -196995,7 +196995,7 @@ index bfc49b7..f34ea19 100644
      b = parsever(b)
  
 diff --git a/yum/repoMDObject.py b/yum/repoMDObject.py
-index 31b1080..23fc067 100755
+index 31b1080..97e6797 100755
 --- a/yum/repoMDObject.py
 +++ b/yum/repoMDObject.py
 @@ -15,6 +15,7 @@
@@ -197006,19 +197006,7 @@ index 31b1080..23fc067 100755
  from Errors import RepoMDError
  
  import sys
-@@ -25,6 +26,11 @@ 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):
-@@ -38,6 +44,7 @@ class RepoData:
+@@ -38,6 +39,7 @@ class RepoData:
          self.dbversion = None
          self.size      = None
          self.opensize  = None
@@ -197026,7 +197014,7 @@ index 31b1080..23fc067 100755
  
          if elem:
              self.parse(elem)
-@@ -69,6 +76,10 @@ class RepoData:
+@@ -69,6 +71,10 @@ class RepoData:
                  self.size = child.text
              elif child_name == 'open-size':
                  self.opensize = child.text
@@ -197037,7 +197025,7 @@ index 31b1080..23fc067 100755
  
      def dump_xml(self):
          msg = ""
-@@ -102,10 +113,21 @@ class RepoData:
+@@ -102,10 +108,21 @@ class RepoData:
                                                   xmlname)
                  msg += d_xml
  
@@ -197051,15 +197039,15 @@ index 31b1080..23fc067 100755
          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:
      """represents the repomd xml file"""
      
-@@ -133,6 +155,7 @@ class RepoMD:
+@@ -133,6 +150,7 @@ class RepoMD:
          else:
              # srcfile is a file object
              infile = srcfile
@@ -197067,7 +197055,7 @@ index 31b1080..23fc067 100755
  
          # We trust any of these to mean the repomd.xml is valid.
          infile = AutoFileChecksums(infile, ['sha256', 'sha512'],
-@@ -145,9 +168,16 @@ class RepoMD:
+@@ -145,6 +163,13 @@ class RepoMD:
                  
                  if elem_name == "data":
                      thisdata = RepoData(elem=elem)
@@ -197080,12 +197068,8 @@ index 31b1080..23fc067 100755
 +                        thisdata = old
                      self.repoData[thisdata.type] = thisdata
                      try:
--                        nts = int(thisdata.timestamp)
-+                        nts = _ts_int(thisdata.timestamp)
-                         if nts > self.timestamp: # max() not in old python
-                             self.timestamp = nts
-                     except:
-@@ -225,13 +255,19 @@ class RepoMD:
+                         nts = int(thisdata.timestamp)
+@@ -225,13 +250,19 @@ class RepoMD:
              for item in self.tags['repo']:
                  tag = """   <repo>%s</repo>\n""" % (to_xml(item))
                  tags += tag
diff --git a/yum.spec b/yum.spec
index 434191b..b537722 100644
--- a/yum.spec
+++ b/yum.spec
@@ -60,7 +60,7 @@ BuildRequires: bash-completion
 Summary: RPM package installer/updater/manager
 Name: yum
 Version: 3.4.3
-Release: 119%{?dist}
+Release: 120%{?dist}
 License: GPLv2+
 Group: System Environment/Base
 Source0: http://yum.baseurl.org/download/3.4/%{name}-%{version}.tar.gz
@@ -444,6 +444,9 @@ exit 0
 %endif
 
 %changelog
+* Fri Dec  6 2013 Zdenek Pavlas <zpavlas at redhat.com> - 3.4.3-120
+- Revert the use of float timestamps as it triggers repomd != metalink.
+
 * Wed Dec  4 2013 Zdenek Pavlas <zpavlas at redhat.com> - 3.4.3-119
 - docs only: group_command=objects is the distro default.
 - Parse float timestamps as valid, for global timestamp.


More information about the scm-commits mailing list