From ab9a8e8058315ff4ab4e0f17b13afce00192ec2c Mon Sep 17 00:00:00 2001 From: James Troup Date: Thu, 2 Jan 2003 18:10:02 +0000 Subject: [PATCH] Add usage() and use it. --- alyson | 23 ++++++++++++++++++++--- andrea | 23 ++++++++++++++++++++--- ashley | 29 +++++++++++++++++++++++++++-- cindy | 29 ++++++++++++++++++++++++----- denise | 21 +++++++++++++++++---- helena | 27 +++++++++++++++++++++++---- rene | 27 +++++++++++++++++++++++---- rose | 21 +++++++++++++++++++-- 8 files changed, 173 insertions(+), 27 deletions(-) diff --git a/alyson b/alyson index 831f54c4..a64c59dc 100755 --- a/alyson +++ b/alyson @@ -2,7 +2,7 @@ # Sync the ISC configuartion file and the SQL database # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: alyson,v 1.10 2002-10-16 02:47:32 troup Exp $ +# $Id: alyson,v 1.11 2003-01-02 18:10:02 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 @@ -31,6 +31,15 @@ projectB = None; ################################################################################ +def usage(exit_code=0): + print """Usage: alyson +Initalizes some tables in the projectB database based on the config file. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ + def get (c, i): if c.has_key(i): return "'%s'" % (c[i]); @@ -41,8 +50,16 @@ def main (): global Cnf, projectB; Cnf = utils.get_conf() + Arguments = [('h',"help","Alyson::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Alyson::Options::%s" % (i)): + Cnf["Alyson::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + Options = Cnf.SubTree("Alyson::Options") + if Options["Help"]: + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); @@ -156,7 +173,7 @@ def main (): projectB.query("INSERT INTO section (section) VALUES ('%s%s%s')" % (prefix, section, suffix)); projectB.query("COMMIT WORK"); -####################################################################################### +################################################################################ if __name__ == '__main__': main() diff --git a/andrea b/andrea index 8e3bb5c7..97a1a557 100755 --- a/andrea +++ b/andrea @@ -2,7 +2,7 @@ # Check for fixable discrepancies between stable and unstable # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: andrea,v 1.8 2002-10-16 02:47:32 troup Exp $ +# $Id: andrea,v 1.9 2003-01-02 18:10:02 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 @@ -32,12 +32,29 @@ projectB = None; ################################################################################ +def usage(exit_code=0): + print """Usage: andrea +Looks for fixable descrepancies between stable and unstable. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ + def main (): global Cnf, projectB; - Cnf = utils.get_conf() + Cnf = utils.get_conf(); + Arguments = [('h',"help","Andrea::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Andrea::Options::%s" % (i)): + Cnf["Andrea::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + Options = Cnf.SubTree("Andrea::Options") + if Options["Help"]: + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); diff --git a/ashley b/ashley index cce91ce5..756ea5eb 100755 --- a/ashley +++ b/ashley @@ -2,7 +2,7 @@ # Dump variables from a .katie file to stdout # Copyright (C) 2001, 2002 James Troup -# $Id: ashley,v 1.7 2002-10-16 02:47:32 troup Exp $ +# $Id: ashley,v 1.8 2003-01-02 18:10:02 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 @@ -21,7 +21,7 @@ ################################################################################ # ooooooooooooooohhhhhhhhhhhhhhhhhhhhhhhhh dddddddddeeeeeeeaaaaaaaarrrrrrrrrrr -# iiiiiiiiiiiii tttttttttthhhhhhhhiiiiiiiiiiiinnnnnnnnnkkkkkkkkkkkkk iiiiiiiiiiiiii mmmmmmmmmmiiiiiiiisssssssssssssssseeeeeeeddd uuuupppppppppppp ttttttttthhhhhhhheeeeeeee xxxxxxxssssssseeeeeeeeettttttttttttt aaaaaaaarrrrrrrggggggsssssssss +# iiiiiiiiiiiii tttttttttthhhhhhhhiiiiiiiiiiiinnnnnnnnnkkkkkkkkkkkkk iiiiiiiiiiiiii mmmmmmmmmmeeeeeeeesssssssssssssssseeeeeeeddd uuuupppppppppppp ttttttttthhhhhhhheeeeeeee xxxxxxxssssssseeeeeeeeettttttttttttt aaaaaaaarrrrrrrggggggsssssssss # # ['xset r rate 30 250' bad, mmkay] @@ -29,9 +29,33 @@ import sys; import katie, utils; +import apt_pkg; + + +################################################################################ + +def usage(exit_code=0): + print """Usage: ashley FILE... +Dumps the info in .katie FILE(s). + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ def main(): Cnf = utils.get_conf() + Arguments = [('h',"help","Ashley::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Ashley::Options::%s" % (i)): + Cnf["Ashley::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + + Options = Cnf.SubTree("Ashley::Options") + if Options["Help"]: + usage(); + k = katie.Katie(Cnf); for arg in sys.argv[1:]: arg = utils.validate_changes_file_arg(arg); @@ -100,6 +124,7 @@ def main(): if dsc_files[file]: utils.warn("dsc_files[%s] still has following unrecognised keys: %s" % (file, dsc_files[file].keys())); +################################################################################ if __name__ == '__main__': main() diff --git a/cindy b/cindy index 35382033..420f9227 100755 --- a/cindy +++ b/cindy @@ -2,7 +2,7 @@ # Cruft checker for overrides # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: cindy,v 1.10 2002-05-23 09:54:23 troup Exp $ +# $Id: cindy,v 1.11 2003-01-02 18:10:02 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 @@ -23,8 +23,8 @@ ###################################################################### # NB: cindy is not a good idea with New Incoming as she doesn't take # # into account accepted. You can minimize the impact of this by # -# running her immediately after katie but that's still racy because # -# lisa doesn't lock with katie. A better long term fix is the evil # +# running her immediately after kelly but that's still racy because # +# lisa doesn't lock with kelly. A better long term fix is the evil # # plan for accepted to be in the DB. # ###################################################################### @@ -42,6 +42,16 @@ override = {} ################################################################################ +def usage (exit_code=0): + print """Usage: cindy +Check for cruft in overrides. + + -h, --help show this help and exit""" + + sys.exit(exit_code) + +################################################################################ + def process(suite, component, type): global override; @@ -102,7 +112,16 @@ def main (): global Cnf, projectB, override; Cnf = utils.get_conf() - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + + Arguments = [('h',"help","Cindy::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Cindy::Options::%s" % (i)): + Cnf["Cindy::Options::%s" % (i)] = ""; + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + Options = Cnf.SubTree("Cindy::Options") + + if Options["Help"]: + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); @@ -116,7 +135,7 @@ def main (): print "Processing %s [%s - %s]..." % (suite, component, type); process(suite, component, type); -####################################################################################### +################################################################################ if __name__ == '__main__': main() diff --git a/denise b/denise index 1566cb95..4b0f5847 100755 --- a/denise +++ b/denise @@ -2,7 +2,7 @@ # Output override files for apt-ftparchive and indices/ # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: denise,v 1.14 2002-10-16 02:47:32 troup Exp $ +# $Id: denise,v 1.15 2003-01-02 18:10:02 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 @@ -38,6 +38,15 @@ override = {} ################################################################################ +def usage(exit_code=0): + print """Usage: denise +Outputs the override tables to text files. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ + def list(file, suite, component, type): global override; @@ -78,10 +87,14 @@ def main (): global Cnf, projectB, override; Cnf = utils.get_conf() - Arguments = [('D',"debug","Denise::Options::Debug", "IntVal"), - ('h',"help","Denise::Options::Help"), - ('V',"version","Denise::Options::Version")]; + Arguments = [('h',"help","Denise::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Denise::Options::%s" % (i)): + Cnf["Denise::Options::%s" % (i)] = ""; apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); + Options = Cnf.SubTree("Denise::Options") + if Options["Help"]: + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); diff --git a/helena b/helena index 18cfbc39..969d625d 100755 --- a/helena +++ b/helena @@ -2,7 +2,7 @@ # Produces a report on NEW and BYHAND packages # Copyright (C) 2001, 2002 James Troup -# $Id: helena,v 1.3 2002-12-08 17:25:47 troup Exp $ +# $Id: helena,v 1.4 2003-01-02 18:10:02 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 @@ -44,7 +44,16 @@ Katie = None; ################################################################################ -def plural (x): +def usage(exit_code=0): + print """Usage: helena +Prints a report of packages in queue directories (usually new and byhand). + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ + +def plural(x): if x > 1: return "s"; else: @@ -189,12 +198,22 @@ def main(): global Cnf, Katie; Cnf = utils.get_conf(); - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + Arguments = [('h',"help","Helena::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Helena::Options::%s" % (i)): + Cnf["Helena::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + + Options = Cnf.SubTree("Helena::Options") + if Options["Help"]: + usage(); + Katie = katie.Katie(Cnf); directories = Cnf.ValueList("Helena::Directories"); if not directories: - directories = [ "byhand", "new"] + directories = [ "byhand", "new" ]; for directory in directories: changes_files = glob.glob("%s/*.changes" % (Cnf["Dir::Queue::%s" % (directory)])); diff --git a/rene b/rene index 7cc6cf31..e9a9c04b 100755 --- a/rene +++ b/rene @@ -2,7 +2,7 @@ # Check for obsolete binary packages # Copyright (C) 2000, 2001, 2002 James Troup -# $Id: rene,v 1.15 2002-10-16 02:47:32 troup Exp $ +# $Id: rene,v 1.16 2003-01-02 18:10:02 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 @@ -37,12 +37,31 @@ projectB = None; ################################################################################ +def usage(exit_code=0): + print """Usage: rene +Check for obsolete or duplicated packages. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ + def main (): global Cnf, projectB; - Cnf = utils.get_conf() + Cnf = utils.get_conf(); + + Arguments = [('h',"help","Rene::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Rene::Options::%s" % (i)): + Cnf["Rene::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + + Options = Cnf.SubTree("Rene::Options") + if Options["Help"]: + usage(); - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); @@ -161,7 +180,7 @@ SELECT s.source, s.version AS experimental, s2.version AS unstable print print q -#################################################################################################### +################################################################################ if __name__ == '__main__': main() diff --git a/rose b/rose index 7e68b768..37deb505 100755 --- a/rose +++ b/rose @@ -2,7 +2,7 @@ # Initial setup of an archive # Copyright (C) 2002 James Troup -# $Id: rose,v 1.2 2002-11-22 04:07:10 troup Exp $ +# $Id: rose,v 1.3 2003-01-02 18:10:02 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 @@ -31,6 +31,14 @@ AptCnf = None; ################################################################################ +def usage(exit_code=0): + print """Usage: rose +Creates directories for an archive based on katie.conf configuration file. + + -h, --help show this help and exit.""" + sys.exit(exit_code) + +################################################################################ def do_dir(target, config_name): if os.path.exists(target): @@ -94,7 +102,16 @@ def main (): global AptCnf, Cnf, projectB; Cnf = utils.get_conf() - apt_pkg.ParseCommandLine(Cnf,[],sys.argv); + Arguments = [('h',"help","Rose::Options::Help")]; + for i in [ "help" ]: + if not Cnf.has_key("Rose::Options::%s" % (i)): + Cnf["Rose::Options::%s" % (i)] = ""; + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv); + + Options = Cnf.SubTree("Rose::Options") + if Options["Help"]: + usage(); AptCnf = apt_pkg.newConfiguration(); apt_pkg.ReadConfigFileISC(AptCnf,utils.which_apt_conf_file()); -- 2.39.5