]> git.decadent.org.uk Git - dak.git/commitdiff
Sort versions correctly.
authorJames Troup <james@nocrew.org>
Wed, 21 Mar 2001 06:26:19 +0000 (06:26 +0000)
committerJames Troup <james@nocrew.org>
Wed, 21 Mar 2001 06:26:19 +0000 (06:26 +0000)
madison

diff --git a/madison b/madison
index 36c0e9a0a6affe5b12e76b4ce828b19bc46dbfd3..7774daec7fd450cf8838d6ac287ebb00aaf6f1b9 100755 (executable)
--- a/madison
+++ b/madison
@@ -2,7 +2,7 @@
 
 # 'Fix' stable to make debian-cd and dpkg -BORGiE users happy
 # Copyright (C) 2000, 2001  James Troup <james@nocrew.org>
-# $Id: madison,v 1.4 2001-03-20 00:28:11 troup Exp $
+# $Id: madison,v 1.5 2001-03-21 06:26:19 troup Exp $
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -62,23 +62,26 @@ def main ():
             version = i[1];
             architecture = i[2];
             suite = i[3];
-            key = (version, suite);
-            if not d.has_key(key):
-                d[key] = [];
-            d[key].append(architecture);
+            if not d.has_key(version):
+                d[version] = {};
+            if not d[version].has_key(suite):
+                d[version][suite] = [];
+            d[version][suite].append(architecture);
             
-        keys = d.keys();
-        keys.sort();
-        for i in keys:
-            (version, suite) = i;
-            sys.stdout.write("%10s | %10s | %13s | " % (package, version, suite));
-            count = 0;
-            for arch in d[i]:
-                if count > 0:
-                    sys.stdout.write(', ');
-                sys.stdout.write(arch);
-                count = count + 1;
-            sys.stdout.write('\n');
+        versions = d.keys();
+        versions.sort(apt_pkg.VersionCompare);
+        for version in versions:
+            suites = d[version].keys();
+            suites.sort();
+            for suite in suites:
+                sys.stdout.write("%10s | %10s | %13s | " % (package, version, suite));
+                count = 0;
+                for arch in d[version][suite]:
+                    if count > 0:
+                        sys.stdout.write(', ');
+                    sys.stdout.write(arch);
+                    count = count + 1;
+                sys.stdout.write('\n');
 
 #######################################################################################