[Rpm-metadata] Zero epoch vs no epoch (patch)

Panu Matilainen pmatilai at laiskiainen.org
Sat Apr 29 18:43:07 UTC 2006


On Sat, 29 Apr 2006, Panu Matilainen wrote:
> Attached quick hack of a patch adds a switch to turn off adding those 
> artificial zero epochs, using this as necessary this should be enough to 
> allow using repodata with full rpm 3.0.x - 4.4.x range.

Duh, and now with the actual patch...

 	- Panu -
-------------- next part --------------
--- createrepo-0.4.4/dumpMetadata.py.epoch	2006-04-27 12:28:01.000000000 +0300
+++ createrepo-0.4.4/dumpMetadata.py	2006-04-27 12:29:13.000000000 +0300
@@ -323,7 +323,7 @@
         if i != -1:
             epoch = strng[:i]
         else:
-            epoch = '0'
+            epoch = None
         j = strng.find('-')
         if j != -1:
             if strng[i + 1:j] == '':
@@ -438,7 +438,7 @@
         
     def epoch(self):
         if self.hdr['epoch'] is None:
-            return 0
+            return None
         else:
             return self.tagByName('epoch')
             
@@ -592,7 +592,8 @@
     pkgNode.newChild(None, 'name', rpmObj.tagByName('name'))
     pkgNode.newChild(None, 'arch', rpmObj.arch())
     version = pkgNode.newChild(None, 'version', None)
-    version.newProp('epoch', str(rpmObj.epoch()))
+    if rpmObj.epoch():
+        version.newProp('epoch', str(rpmObj.epoch()))
     version.newProp('ver', str(rpmObj.tagByName('version')))
     version.newProp('rel', str(rpmObj.tagByName('release')))
     csum = pkgNode.newChild(None, 'checksum', rpmObj.pkgid)
@@ -696,7 +697,8 @@
     pkg.newProp('name', rpmObj.tagByName('name'))
     pkg.newProp('arch', rpmObj.arch())
     version = pkg.newChild(None, 'version', None)
-    version.newProp('epoch', str(rpmObj.epoch()))
+    if rpmObj.epoch():
+        version.newProp('epoch', str(rpmObj.epoch()))
     version.newProp('ver', str(rpmObj.tagByName('version')))
     version.newProp('rel', str(rpmObj.tagByName('release')))
     for file in rpmObj.filenames:
@@ -721,7 +723,8 @@
     pkg.newProp('name', rpmObj.tagByName('name'))
     pkg.newProp('arch', rpmObj.arch())
     version = pkg.newChild(None, 'version', None)
-    version.newProp('epoch', str(rpmObj.epoch()))
+    if rpmObj.epoch():
+        version.newProp('epoch', str(rpmObj.epoch()))
     version.newProp('ver', str(rpmObj.tagByName('version')))
     version.newProp('rel', str(rpmObj.tagByName('release')))
     clogs = rpmObj.changelogLists()


More information about the Rpm-metadata mailing list