autoimport: skip old versions entirely
authorHelmut Grohne <helmut@subdivi.de>
Fri, 22 Feb 2013 18:55:31 +0000 (19:55 +0100)
committerHelmut Grohne <helmut@subdivi.de>
Fri, 22 Feb 2013 18:55:31 +0000 (19:55 +0100)
Presumably this is responsible for the blocking curl processes, since
importpkg will terminate early when processing an old version.

autoimport.py

index 6ce7146..f80c57d 100755 (executable)
@@ -8,6 +8,7 @@ import sys
 import urllib
 
 from debian import deb822
+from debian.debian_support import version_compare
 
 def main():
     urlbase = sys.argv[1]
@@ -22,7 +23,7 @@ def main():
     for pkg in deb822.Packages.iter_paragraphs(io.BytesIO(pkglist)):
         name = pkg["Package"]
         distpkgs.add(name)
-        if pkg["Version"] == knownpkgs.get(name, ()):
+        if version_compare(pkg["Version"], knownpkgs.get(name, ())) < 0:
             continue
         pkgurl = "%s/%s" % (urlbase, pkg["Filename"])
         print("importing %s" % name)