[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

madison showing source also



Hi,

a small hack from me allows madison to show the source package also (see
below). The remaining file sits in ~aba/bin/smadison on spohr currently.


Cheers,
Andi


--- /org/ftp.debian.org/katie/madison	2005-11-27 22:19:12.000000000 -0800
+++ bin/smadison	2006-04-29 02:33:00.885163173 -0700
@@ -132,17 +133,17 @@
     results = 0;
     for package in packages:
         q = projectB.query("""
-SELECT b.package, b.version, a.arch_string, su.suite_name, c.name, m.name
+SELECT b.package, b.version, a.arch_string, su.suite_name, c.name, m.name, s.source
   FROM binaries b, architecture a, suite su, bin_associations ba,
-       files f, location l, component c, maintainer m
+       files f, location l, component c, maintainer m, source s
  WHERE b.package %s '%s' AND a.id = b.architecture AND su.id = ba.suite
    AND b.id = ba.bin AND b.file = f.id AND f.location = l.id
-   AND l.component = c.id AND b.maintainer = m.id %s %s %s
+   AND l.component = c.id AND b.maintainer = m.id AND b.source = s.id %s %s %s
 """ % (comparison_operator, package, con_suites, con_architectures, con_bintype));
         ql = q.getresult();
         if check_source:
             q = projectB.query("""
-SELECT s.source, s.version, 'source', su.suite_name, c.name, m.name
+SELECT s.source, s.version, 'source', su.suite_name, c.name, m.name, s.source
   FROM source s, suite su, src_associations sa, files f, location l,
        component c, maintainer m
  WHERE s.source %s '%s' AND su.id = sa.suite AND s.id = sa.source
@@ -154,7 +155,7 @@
         highver = {};
         for i in ql:
             results += 1;
-            (pkg, version, architecture, suite, component, maintainer) = i;
+            (pkg, version, architecture, suite, component, maintainer, source) = i;
             if component != "main":
                 suite = "%s/%s" % (suite, component);
             if not d.has_key(pkg):
@@ -165,8 +166,10 @@
                 if apt_pkg.VersionCompare(version, highver[pkg]) > 0:
                     highver[pkg] = version;
             if not d[pkg][version].has_key(suite):
-                d[pkg][version][suite] = [];
-            d[pkg][version][suite].append(architecture);
+                d[pkg][version][suite] = {};
+            if not d[pkg][version][suite].has_key(source):
+                d[pkg][version][suite][source] = [];
+            d[pkg][version][suite][source].append(architecture);
 
         packages = d.keys();
         packages.sort();
@@ -177,10 +180,13 @@
                 suites = d[pkg][version].keys();
                 suites.sort();
                 for suite in suites:
-                    arches = d[pkg][version][suite];
+                  sources = d[pkg][version][suite].keys()
+                  sources.sort()
+                  for source in sources:
+                    arches = d[pkg][version][suite][source];
                     arches.sort(utils.arch_compare_sw);
                     if Options["Format"] == "": #normal
-                        sys.stdout.write("%10s | %10s | %13s | " % (pkg, version, suite));
+                        sys.stdout.write("%10s | %10s | %10s | %13s | " % (pkg, source, version, suite));
                         sys.stdout.write(", ".join(arches));
                         sys.stdout.write('\n');
                     elif Options["Format"] == "heidi":

-- 
  http://home.arcor.de/andreas-barth/



Reply to: