From 699bafc632cb4f45f43f3cc5e22619d1e876144d Mon Sep 17 00:00:00 2001 From: James Troup Date: Tue, 21 Aug 2001 15:44:27 +0000 Subject: [PATCH] -a/--architecture support --- madison | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/madison b/madison index 02696011..cfbad280 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 -# $Id: madison,v 1.7 2001-06-08 00:22:10 troup Exp $ +# $Id: madison,v 1.8 2001-08-21 15:44:27 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 @@ -52,11 +52,13 @@ def main (): global Cnf, projectB; apt_pkg.init(); - + Cnf = apt_pkg.newConfiguration(); apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); - Arguments = [('s',"suite","Madison::Options::Suite", "HasArg"), + Arguments = [('a',"architecture","Madison::Options::Architecture", "HasArg"), + ('m',"maintainer","Madison::Options::Architecture"), + ('s',"suite","Madison::Options::Suite", "HasArg"), ('D',"debug","Madison::Options::Debug", "IntVal"), ('h',"help","Madison::Options::Help"), ('V',"version","Madison::Options::Version")]; @@ -69,7 +71,7 @@ def main (): if packages == []: utils.fubar("need at least one package name as an argument."); - if Options["Suite"]: + if Options.get("Suite"): con_suites = "AND ("; for suite in string.split(Options["Suite"]): suite_id = db_access.get_suite_id(suite); @@ -81,12 +83,28 @@ def main (): else: con_suites = ""; + if Options.get("Architecture"): + con_architectures = "AND ("; + check_source = 0; + for architecture in string.split(Options["Architecture"]): + if architecture == "source": + check_source = 1; + architecture_id = db_access.get_architecture_id(architecture); + if architecture_id == -1: + utils.warn("architecture '%s' not recognised." % (architecture)); + else: + con_architectures = con_architectures + "a.id = %s OR " % (architecture_id) + con_architectures = con_architectures[:-3] + ")" + else: + con_architectures = ""; + check_source = 1; for package in packages: - q = projectB.query("SELECT b.package, b.version, a.arch_string, su.suite_name FROM binaries b, architecture a, suite su, bin_associations ba WHERE b.package = '%s' AND a.id = b.architecture AND su.id = ba.suite AND b.id = ba.bin %s" % (package, con_suites)); + q = projectB.query("SELECT b.package, b.version, a.arch_string, su.suite_name, m.name FROM binaries b, architecture a, suite su, bin_associations ba, maintainer m WHERE b.package = '%s' AND a.id = b.architecture AND su.id = ba.suite AND b.id = ba.bin AND b.maintainer = m.id %s %s" % (package, con_suites, con_architectures)); ql = q.getresult(); - q = projectB.query("SELECT s.source, s.version, 'source', su.suite_name FROM source s, suite su, src_associations sa WHERE s.source = '%s' AND su.id = sa.suite AND s.id = sa.source %s" % (package, con_suites)); - ql.extend(q.getresult()); + if check_source: + q = projectB.query("SELECT s.source, s.version, 'source', su.suite_name, m.name FROM source s, suite su, src_associations sa, maintainer m WHERE s.source = '%s' AND su.id = sa.suite AND s.id = sa.source AND s.maintainer = m.id %s" % (package, con_suites)); + ql.extend(q.getresult()); d = {}; for i in ql: package = i[0]; @@ -98,7 +116,7 @@ def main (): if not d[version].has_key(suite): d[version][suite] = []; d[version][suite].append(architecture); - + versions = d.keys(); versions.sort(apt_pkg.VersionCompare); for version in versions: -- 2.39.2