From 5bef9e16e19b728ff29652954b96f572418853fb Mon Sep 17 00:00:00 2001
From: James Troup <james@nocrew.org>
Date: Wed, 21 Mar 2001 06:26:19 +0000
Subject: [PATCH] Sort versions correctly.

---
 madison | 37 ++++++++++++++++++++-----------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/madison b/madison
index 36c0e9a0..7774daec 100755
--- 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');
 
 #######################################################################################
 
-- 
2.39.5