X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=melanie;h=1a6fc08a00ce6fd896e8849d17ef922440a29d64;hb=d0a891d7eb8d79b747f031392dd29de3acd68d84;hp=90260fe20e963a3907b8c4ad0efce848cd644a85;hpb=128d4606233f6e4147f6b74b108bf03b4dd76c07;p=dak.git diff --git a/melanie b/melanie index 90260fe2..1a6fc08a 100755 --- a/melanie +++ b/melanie @@ -1,8 +1,8 @@ #!/usr/bin/env python # General purpose package removal tool for ftpmaster -# Copyright (C) 2000, 2001 James Troup -# $Id: melanie,v 1.18 2001-11-04 22:35:11 troup Exp $ +# Copyright (C) 2000, 2001, 2002 James Troup +# $Id: melanie,v 1.27 2002-05-23 12:36:44 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,11 +18,29 @@ # 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: Astronomy, Metallica - Garage Inc. +################################################################################ + +# o OpenBSD team wants to get changes incorporated into IPF. Darren no +# respond. +# o Ask again -> No respond. Darren coder supreme. +# o OpenBSD decide to make changes, but only in OpenBSD source +# tree. Darren hears, gets angry! Decides: "LICENSE NO ALLOW!" +# o Insert Flame War. +# o OpenBSD team decide to switch to different packet filter under BSD +# license. Because Project Goal: Every user should be able to make +# changes to source tree. IPF license bad!! +# o Darren try get back: says, NetBSD, FreeBSD allowed! MUAHAHAHAH!!! +# o Theo say: no care, pf much better than ipf! +# o Darren changes mind: changes license. But OpenBSD will not change +# back to ipf. Darren even much more bitter. +# o Darren so bitterbitter. Decides: I'LL GET BACK BY FORKING OPENBSD AND +# RELEASING MY OWN VERSION. HEHEHEHEHE. + +# http://slashdot.org/comments.pl?sid=26697&cid=2883271 ################################################################################ -import commands, os, pg, pwd, re, string, sys, tempfile +import commands, os, pg, re, string, sys, tempfile import utils, db_access import apt_pkg, apt_inst; @@ -64,8 +82,7 @@ ARCH, BUG#, COMPONENT and SUITE can be space seperated lists, e.g. # going to do now?" def game_over(): - print "Continue (y/N)? ", - answer = string.lower(utils.our_raw_input()); + answer = string.lower(utils.our_raw_input("Continue (y/N)? ")); if answer != "y": print "Aborted." sys.exit(1); @@ -75,10 +92,7 @@ def game_over(): def main (): global Cnf, projectB; - apt_pkg.init(); - - Cnf = apt_pkg.newConfiguration(); - apt_pkg.ReadConfigFileISC(Cnf,utils.which_conf_file()); + Cnf = utils.get_conf() Arguments = [('h',"help","Melanie::Options::Help"), ('a',"architecture","Melanie::Options::Architecture", "HasArg"), @@ -93,9 +107,11 @@ 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"; + for i in ["help", "architecture", "binary-only", "component", "carbon-copy", "done", "reason", "no-action", "partial", "source-only" ]: + if not Cnf.has_key("Melanie::Options::%s" % (i)): + Cnf["Melanie::Options::%s" % (i)] = ""; + if not Cnf.has_key("Melanie::Options::Suite"): + Cnf["Melanie::Options::Suite"] = "unstable"; arguments = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv); Options = Cnf.SubTree("Melanie::Options") @@ -123,7 +139,7 @@ def main (): # # Accept 3 types of arguments (space separated): # 1) a number - assumed to be a bug number, i.e. nnnnn@bugs.debian.org - # 2) the keyword 'package' - cc's $arch@packages.debian.org for every argument + # 2) the keyword 'package' - cc's $package@packages.debian.org for every argument # 3) contains a '@' - assumed to be an email address, used unmofidied # carbon_copy = []; @@ -133,21 +149,18 @@ def main (): elif copy_to == 'package': for package in arguments: carbon_copy.append(package + "@" + Cnf["Dinstall::PackagesServer"]); + if Cnf.has_key("Dinstall::TrackingServer"): + carbon_copy.append(package + "@" + Cnf["Dinstall::TrackingServer"]); elif '@' in copy_to: carbon_copy.append(copy_to); else: utils.fubar("Invalid -C/--carbon-copy argument '%s'; not a bug number, 'package' or email address." % (copy_to)); - packages = {}; if Options["Binary-Only"]: field = "b.package"; else: field = "s.source"; - quoted_packages_list = [] - for package in arguments: - quoted_packages_list.append("'%s'" % package) - packages[package] = ""; - con_packages = "AND %s IN (%s)" % (field, string.join(quoted_packages_list, ", ")); + con_packages = "AND %s IN (%s)" % (field, string.join(map(repr, arguments), ", ")); suites = []; suite_ids_list = []; for suite in string.split(Options["Suite"]): @@ -237,7 +250,7 @@ def main (): for i in source_packages.keys(): filename = string.join(source_packages[i], '/'); try: - dsc = utils.parse_changes(filename, 0); + dsc = utils.parse_changes(filename); except utils.cant_open_exc: utils.warn("couldn't open '%s'." % (filename)); continue; @@ -376,7 +389,7 @@ def main (): Subst["__BCC__"] = "Bcc: " + string.join(bcc, ", "); else: Subst["__BCC__"] = "X-Filler: 42"; - Subst["__CC__"] = "X-Melanie: $Revision: 1.18 $"; + Subst["__CC__"] = "X-Melanie: $Revision: 1.27 $"; if carbon_copy: Subst["__CC__"] = Subst["__CC__"] + "\nCc: " + string.join(carbon_copy, ", "); Subst["__SUITE_LIST__"] = suites_list; @@ -390,7 +403,7 @@ def main (): Subst["__PRIMARY_MIRROR__"] = Archive["PrimaryMirror"]; for bug in string.split(Options["Done"]): Subst["__BUG_NUMBER__"] = bug; - mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/melanie.bug-close","r").read()); + mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/melanie.bug-close"); utils.send_mail (mail_message, "") logfile.write("=========================================================================\n");