make debian version_compare available in sql
authorHelmut Grohne <helmut@subdivi.de>
Fri, 16 Aug 2013 20:45:18 +0000 (22:45 +0200)
committerHelmut Grohne <helmut@subdivi.de>
Fri, 16 Aug 2013 20:45:18 +0000 (22:45 +0200)
dedup/utils.py

index 2fae9fd..6fb233b 100644 (file)
@@ -1,3 +1,5 @@
+from debian.debian_support import version_compare
+
 def fetchiter(cursor):
     rows = cursor.fetchmany()
     while rows:
@@ -5,3 +7,6 @@ def fetchiter(cursor):
             yield row
         rows = cursor.fetchmany()
 
+def sql_add_version_compare(db):
+    db.create_collation("debian_version", version_compare)
+    db.create_function("debian_version_compare", 2, version_compare)