X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=cindy;h=fe2e7272c99921f4f251cd709f5ca55d00de4d6c;hb=9a89f745ed13e05507dd5297fa4a860c4fdc2b2e;hp=a963ea4c174bcf23e5470390bec64df34e24d038;hpb=0ae0a3896e77f8e07a43d2a8b368466f4edabedd;p=dak.git diff --git a/cindy b/cindy index a963ea4c..fe2e7272 100755 --- a/cindy +++ b/cindy @@ -1,8 +1,8 @@ #!/usr/bin/env python # Output override files for apt-ftparchive and indices/ -# Copyright (C) 2000, 2001 James Troup -# $Id: cindy,v 1.3 2001-03-20 00:28:11 troup Exp $ +# Copyright (C) 2000, 2001, 2002 James Troup +# $Id: cindy,v 1.9 2002-05-14 15:28:53 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 @@ -18,13 +18,14 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +################################################################################ # X-Listening-To: Sanitarium / Master of the Puppets - Metallica ################################################################################ -import pg, sys, string -import utils, db_access, natalie +import pg, sys; +import utils, db_access; import apt_pkg; ################################################################################ @@ -37,21 +38,18 @@ override = {} def process(suite, component, type): global override; - + suite_id = db_access.get_suite_id(suite); if suite_id == -1: - sys.stderr.write("Suite '%s' not recognised.\n" % (suite)); - sys.exit(2); + utils.fubar("Suite '%s' not recognised." % (suite)); component_id = db_access.get_component_id(component); if component_id == -1: - sys.stderr.write("Component '%s' not recognised.\n" % (component)); - sys.exit(2); + utils.fubar("Component '%s' not recognised." % (component)); type_id = db_access.get_override_type_id(type); if type_id == -1: - sys.stderr.write("Type '%s' not recognised. (Valid types are deb, udeb and dsc.)\n" % (type)); - sys.exit(2); + utils.fubar("Type '%s' not recognised. (Valid types are deb, udeb and dsc)" % (type)); dsc_type_id = db_access.get_override_type_id("dsc"); if type == "deb" or type == "udeb": @@ -81,7 +79,7 @@ def process(suite, component, type): #% (package, suite_id, component_id, type_id)); # Then if source doesn't already have a copy, insert it into source q = projectB.query("SELECT package FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" % (package, suite_id, component_id, dsc_type_id)); - if q.getresult() == []: + if not q.getresult(): #projectB.query("INSERT INTO override (package, suite, component, priority, section, type, maintainer) VALUES ('%s', %s, %s, %s, %s, %s, '%s')" % (package, suite_id, component_id, i[1], i[2], dsc_type_id, i[3])); print "(nop)" else: # dsc @@ -90,31 +88,25 @@ def process(suite, component, type): #projectB.query("DELETE FROM override WHERE package = '%s' AND suite = %s AND component = %s AND type = %s" #% (package, suite_id, component_id, type_id)); projectB.query("COMMIT WORK"); - + ################################################################################ def main (): global Cnf, projectB, override; - apt_pkg.init(); - - Cnf = apt_pkg.newConfiguration(); - apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); - Arguments = [('D',"debug","Denise::Options::Debug", "IntVal"), - ('h',"help","Denise::Options::Help"), - ('V',"version","Denise::Options::Version")]; - apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); + Cnf = utils.get_conf() + apt_pkg.ParseCommandLine(Cnf,[],sys.argv); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); for suite in [ "stable", "unstable" ]: - sys.stderr.write("Processing %s...\n" % (suite)); + print "Processing %s..." % (suite); for component in Cnf.SubTree("Component").List(): if component == "mixed": continue; # Ick - for type in Cnf.SubTree("OverrideType").List(): + for type in Cnf.ValueList("OverrideType"): print "Processing %s [%s - %s]..." % (suite, component, type); process(suite, component, type);