Re: Zero epoch vs no epoch (patch)

Panu Matilainen <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
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 -

_______________________________________________
Rpm-metadata mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
createrepo-noepoch.patch (text/plain, 2 KB)
--- 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()
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.