[svn] r5403 - in trunk/tools/mrepo: . tests

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Mon May 14 18:48:45 CEST 2007


Author: dag
Date: 2007-05-14 18:48:45 +0200 (Mon, 14 May 2007)
New Revision: 5403

Added:
   trunk/tools/mrepo/tests/createrepo_version.py
Modified:
   trunk/tools/mrepo/mrepo
Log:
Small improvements.

Modified: trunk/tools/mrepo/mrepo
===================================================================
--- trunk/tools/mrepo/mrepo	2007-05-14 16:43:56 UTC (rev 5402)
+++ trunk/tools/mrepo/mrepo	2007-05-14 16:48:45 UTC (rev 5403)
@@ -967,7 +967,7 @@
             return -1
         elif cmp(al[i], bl[i]) > 0:
             return 1
-    return 0
+    return cmp(len(al), len(bl))
 
 def symlinkglob(str, *targets):
     "Symlink files to multiple targets"

Added: trunk/tools/mrepo/tests/createrepo_version.py
===================================================================
--- trunk/tools/mrepo/tests/createrepo_version.py	                        (rev 0)
+++ trunk/tools/mrepo/tests/createrepo_version.py	2007-05-14 16:48:45 UTC (rev 5403)
@@ -0,0 +1,26 @@
+#! /usr/bin/python
+
+import sys
+
+def vercmp(a, b):
+    al = a.split('.')
+    bl = b.split('.')
+    length = min(len(al), len(bl))
+    for i in range(1, length):
+        if cmp(al[i], bl[i]) < 0:
+            return -1
+        elif cmp(al[i], bl[i]) > 0:
+            return 1
+    return cmp(len(al), len(bl))
+
+sys.path.append("/usr/share/createrepo")
+import genpkgmetadata
+print genpkgmetadata.__version__
+sys.path.remove("/usr/share/createrepo")
+del genpkgmetadata
+
+print vercmp('0.4.4', '0.4.6')
+print vercmp('0.4.8', '0.4.6')
+print vercmp('0.4.6', '0.4.6')
+print vercmp('0.4.6.0', '0.4.6')
+print vercmp('0.4.6.1', '0.4.6')


Property changes on: trunk/tools/mrepo/tests/createrepo_version.py
___________________________________________________________________
Name: svn:executable
   + *




More information about the commits mailing list