X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=melanie;h=b412a540d619d60f09757aae0e6ef36aa0fe116c;hb=a092f0aa8e82394e25a16da9e87263ee26b8de0e;hp=5a5a20582b445e6f9ddb72aab5adcd56a4a805ea;hpb=04ec8563154737822485748f4a46bdf5eb9c6c84;p=dak.git diff --git a/melanie b/melanie index 5a5a2058..b412a540 100755 --- a/melanie +++ b/melanie @@ -1,8 +1,8 @@ #!/usr/bin/env python -# General purpose archive tool for ftpmaster +# General purpose package removal tool for ftpmaster # Copyright (C) 2000, 2001 James Troup -# $Id: melanie,v 1.15 2001-08-11 22:04:27 rmurray Exp $ +# $Id: melanie,v 1.17 2001-09-27 01:23:41 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,10 +37,10 @@ projectB = None; ################################################################################ -def usage (exit_code): - print """Usage: melanie [OPTIONS] package[...] - -D, --debug=VALUE turn on debugging - -h, --help show this help and exit +def usage (exit_code=0): + print """Usage: melanie [OPTIONS] PACKAGE[...] +Remove PACKAGE(s) from suite(s). + -a, --architecture=ARCH only act on this architecture -b, --binary remove binaries only -c, --component=COMPONENT act on this component @@ -50,7 +50,12 @@ def usage (exit_code): -n, --no-action don't do anything -p, --partial don't affect override files -s, --suite=SUITE act on this suite - -S, --source-only remove source only""" + -S, --source-only remove source only + -h, --help show this help and exit + +ARCH, BUG#, COMPONENT and SUITE can be space seperated lists, e.g. + --architecture=\"m68k i386\"""" + sys.exit(exit_code) ################################################################################ @@ -71,13 +76,11 @@ def main (): global Cnf, projectB; apt_pkg.init(); - + Cnf = apt_pkg.newConfiguration(); apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); - Arguments = [('D',"debug","Melanie::Options::Debug", "IntVal"), - ('h',"help","Melanie::Options::Help"), - ('V',"version","Melanie::Options::Version"), + Arguments = [('h',"help","Melanie::Options::Help"), ('a',"architecture","Melanie::Options::Architecture", "HasArg"), ('b',"binary", "Melanie::Options::Binary-Only"), ('c',"component", "Melanie::Options::Component", "HasArg"), @@ -90,11 +93,15 @@ def main (): ('S',"source-only", "Melanie::Options::Source-Only"), ]; + for i in ["help", "architecture", "binary", "component", "carbon-copy", "done", "reason", "no-action", "partial", "source-only" ]: + Cnf["Melanie::Options::%s" % (i)] = ""; + Cnf["Melanie::Options::Suite"] = "unstable"; + arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); Options = Cnf.SubTree("Melanie::Options") if Options["Help"]: - usage(0) + usage(); projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])); db_access.init(Cnf, projectB); @@ -149,7 +156,7 @@ def main (): suite_ids_list = []; con_suites = "AND ("; for suite in string.split(Options["Suite"]): - + if not Options["No-Action"] and suite == "stable": print "**WARNING** About to remove from the stable suite!" print "This should only be done just prior to a (point) release and not at" @@ -160,7 +167,7 @@ def main (): print "There's no need to do this normally as removals from unstable will" print "propogate to testing automagically." game_over(); - + suite_id = db_access.get_suite_id(suite); if suite_id == -1: utils.warn("suite '%s' not recognised." % (suite)); @@ -185,7 +192,7 @@ def main (): con_components = con_components[:-3] + ")" over_con_components = over_con_components[:-3] + ")"; else: - con_components = ""; + con_components = ""; over_con_components = ""; if Options["Architecture"]: @@ -319,7 +326,7 @@ def main (): # If -n/--no-action, drop out here if Options["No-Action"]: sys.exit(0); - + game_over(); whoami = utils.whoami(); @@ -335,10 +342,10 @@ def main (): logfile.write("\n------------------- Reason -------------------\n%s\n" % (Options["Reason"])); logfile.write("----------------------------------------------\n"); logfile.flush(); - + dsc_type_id = db_access.get_override_type_id('dsc'); deb_type_id = db_access.get_override_type_id('deb'); - + # Do the actual deletion print "Deleting...", sys.stdout.flush(); @@ -379,7 +386,7 @@ def main (): else: bcc = "Bcc: " + bcc; Subst["__BCC__"] = bcc[:-2]; - Subst["__CC__"] = "X-Melanie: $Revision: 1.15 $\n" + carbon_copy[:-1]; + Subst["__CC__"] = "X-Melanie: $Revision: 1.17 $\n" + carbon_copy[:-1]; Subst["__SUITE_LIST__"] = suites_list; Subst["__SUMMARY__"] = summary; Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"]; @@ -393,7 +400,7 @@ def main (): Subst["__BUG_NUMBER__"] = bug; mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/melanie.bug-close","r").read()); utils.send_mail (mail_message, "") - + logfile.write("=========================================================================\n"); logfile.close();