X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=madison;h=58c7463356a6cdcaa3fb16abd5257912f0dea9fd;hb=3686a00f1001f2d5692fa5e706b898053e39191a;hp=93eaa922b609c88fb6c61d2408dc1d4a13b6b179;hpb=3b1db67cb8543a44274eb3b4f2ada15a25a73641;p=dak.git diff --git a/madison b/madison index 93eaa922..58c74633 100755 --- a/madison +++ b/madison @@ -1,8 +1,8 @@ #!/usr/bin/env python # Display information about package(s) (suite, version, etc.) -# Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: madison,v 1.27 2003-03-14 19:04:07 troup Exp $ +# Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup +# $Id: madison,v 1.29 2004-01-21 03:20:13 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 @@ -42,13 +42,15 @@ def usage (exit_code=0): print """Usage: madison [OPTION] PACKAGE[...] Display information about PACKAGE(s). - -a, --architecture=ARCH only show info for this architecture + -a, --architecture=ARCH only show info for ARCH(s) + -b, --binary-type=TYPE only show info for binary TYPE(s) + -c, --component=COMPONENT only show info for COMPONENT(s) -h, --help show this help and exit -r, --regex treat PACKAGE as a regex -s, --suite=SUITE only show info for this suite -S, --source-and-binary show info for the binary children of source pkgs -Both ARCH and SUITE can be comma (or space) seperated lists, e.g. +ARCH, COMPONENT and SUITE can be comma (or space) separated lists, e.g. --architecture=m68k,i386""" sys.exit(exit_code) @@ -60,13 +62,15 @@ def main (): Cnf = utils.get_conf() Arguments = [('a', "architecture", "Madison::Options::Architecture", "HasArg"), + ('b', "binarytype", "Madison::Options::BinaryType", "HasArg"), ('c', "component", "Madison::Options::Component", "HasArg"), + ('f', "format", "Madison::Options::Format", "HasArg"), ('r', "regex", "Madison::Options::Regex"), ('s', "suite", "Madison::Options::Suite", "HasArg"), ('S', "source-and-binary", "Madison::Options::Source-And-Binary"), ('h', "help", "Madison::Options::Help")]; - for i in [ "architecture", "component", "regex", "suite", - "source-and-binary", "help" ]: + for i in [ "architecture", "binarytype", "component", "format", "regex", + "suite", "source-and-binary", "help" ]: if not Cnf.has_key("Madison::Options::%s" % (i)): Cnf["Madison::Options::%s" % (i)] = ""; @@ -85,10 +89,20 @@ def main (): if os.path.exists(os.path.join(Cnf["Dir::Root"], "Archive_Maintenance_In_Progress")): utils.warn("Archive maintenance is in progress; database inconsistencies are possible."); - # Parse -a/--architecture, -s/--suite + # Parse -a/--architecture, -c/--component and -s/--suite (con_suites, con_architectures, con_components, check_source) = \ utils.parse_args(Options); + if Options["BinaryType"]: + if Options["BinaryType"] != "udeb" and Options["BinaryType"] != "deb": + utils.fubar("Invalid binary type. 'udeb' and 'deb' recognised."); + con_bintype = "AND b.type = '%s'" % (Options["BinaryType"]); + # REMOVE ME TRAMP + if Options["BinaryType"] == "udeb": + check_source = 0; + else: + con_bintype = ""; + if Options["Regex"]: comparison_operator = "~"; else: @@ -105,7 +119,7 @@ def main (): results = 0; for package in packages: - 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 '%s' AND a.id = b.architecture AND su.id = ba.suite AND b.id = ba.bin AND b.maintainer = m.id %s %s" % (comparison_operator, package, con_suites, con_architectures)); + 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 '%s' AND a.id = b.architecture AND su.id = ba.suite AND b.id = ba.bin AND b.maintainer = m.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, m.name FROM source s, suite su, src_associations sa, maintainer m WHERE s.source %s '%s' AND su.id = sa.suite AND s.id = sa.source AND s.maintainer = m.id %s" % (comparison_operator, package, con_suites)); @@ -134,11 +148,15 @@ def main (): suites = d[pkg][version].keys(); suites.sort(); for suite in suites: - sys.stdout.write("%10s | %10s | %13s | " % (pkg, version, suite)); arches = d[pkg][version][suite]; arches.sort(utils.arch_compare_sw); - sys.stdout.write(", ".join(arches)); - sys.stdout.write('\n'); + if Options["Format"] == "": #normal + sys.stdout.write("%10s | %10s | %13s | " % (pkg, version, suite)); + sys.stdout.write(", ".join(arches)); + sys.stdout.write('\n'); + elif Options["Format"] == "heidi": + for arch in arches: + sys.stdout.write("%s %s %s\n" % (pkg, version, arch)); if not results: sys.exit(1);