]> git.decadent.org.uk Git - dak.git/blobdiff - melanie
* vars: external-overrides variable added* cron.daily: Update testing/unstable Task...
[dak.git] / melanie
diff --git a/melanie b/melanie
index 0919a88d2a5096df027a2f31768c773145d356f8..38b81b3733c590057ae2d623f2c8a2a87293efd8 100755 (executable)
--- a/melanie
+++ b/melanie
@@ -1,8 +1,8 @@
 #!/usr/bin/env python
 
 # General purpose package removal tool for ftpmaster
-# Copyright (C) 2000, 2001, 2002  James Troup <james@nocrew.org>
-# $Id: melanie,v 1.33 2002-11-19 03:14:59 troup Exp $
+# Copyright (C) 2000, 2001, 2002, 2003  James Troup <james@nocrew.org>
+# $Id: melanie,v 1.39 2003-05-02 13:53:57 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
@@ -64,22 +64,24 @@ Remove PACKAGE(s) from suite(s).
   -c, --component=COMPONENT  act on this component
   -C, --carbon-copy=EMAIL    send a CC of removal message to EMAIL
   -d, --done=BUG#            send removal message as closure to bug#
+  -h, --help                 show this help and exit
   -m, --reason=MSG           reason for removal
   -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
-  -h, --help                 show this help and exit
 
-ARCH, BUG#, COMPONENT and SUITE can be space seperated lists, e.g.
-    --architecture=\"m68k i386\""""
+ARCH, BUG#, COMPONENT and SUITE can be comma (or space) separated lists, e.g.
+    --architecture=m68k,i386"""
 
     sys.exit(exit_code)
 
 ################################################################################
 
-# "That's just fucking great!  Game over, man!  What the fuck are we
-#  going to do now?"
+# "Hudson: What that's great, that's just fucking great man, now what
+#  the fuck are we supposed to do? We're in some real pretty shit now
+#  man...That's it man, game over man, game over, man! Game over! What
+#  the fuck are we gonna do now? What are we gonna do?"
 
 def game_over():
     answer = utils.our_raw_input("Continue (y/N)? ").lower();
@@ -135,6 +137,12 @@ def main ():
         utils.warn("-a/--architecture implies -p/--partial.");
         Options["Partial"] = "true";
 
+    # Force the admin to tell someone if we're not doing a rene-led removal
+    # (or closing a bug, which counts as telling someone).
+    if not Options["Carbon-Copy"] and not Options["Done"] \
+       and Options["Reason"].find("[rene]") == -1:
+        utils.fubar("Need a -C/--carbon-copy if not closing a bug and not doing a rene-led removal.");
+
     # Process -C/--carbon-copy
     #
     # Accept 3 types of arguments (space separated):
@@ -143,7 +151,7 @@ def main ():
     #  3) contains a '@' - assumed to be an email address, used unmofidied
     #
     carbon_copy = [];
-    for copy_to in Options.get("Carbon-Copy").split():
+    for copy_to in utils.split_args(Options.get("Carbon-Copy")):
         if utils.str_isnum(copy_to):
             carbon_copy.append(copy_to + "@" + Cnf["Dinstall::BugServer"]);
         elif copy_to == 'package':
@@ -167,7 +175,7 @@ def main ():
 
     # Additional suite checks
     suite_ids_list = [];
-    suites = Options["Suite"].split();
+    suites = utils.split_args(Options["Suite"]);
     suites_list = utils.join_with_commas_and(suites);
     if not Options["No-Action"]:
         for suite in suites:
@@ -289,8 +297,9 @@ def main ():
     packages.sort();
     for package in packages:
         versions = d[package].keys();
-        versions.sort();
+        versions.sort(apt_pkg.VersionCompare);
         for version in versions:
+            d[package][version].sort(utils.arch_compare_sw);
             summary += "%10s | %10s | %s\n" % (package, version, ", ".join(d[package][version]));
     print "Will remove the following packages from %s:" % (suites_list);
     print
@@ -368,7 +377,7 @@ def main ():
             Subst["__BCC__"] = "Bcc: " + ", ".join(bcc);
         else:
             Subst["__BCC__"] = "X-Filler: 42";
-        Subst["__CC__"] = "X-Katie: melanie $Revision: 1.33 $";
+        Subst["__CC__"] = "X-Katie: melanie $Revision: 1.39 $";
         if carbon_copy:
             Subst["__CC__"] += "\nCc: " + ", ".join(carbon_copy);
         Subst["__SUITE_LIST__"] = suites_list;
@@ -380,10 +389,10 @@ def main ():
         Archive = Cnf.SubTree("Archive::%s" % (whereami));
         Subst["__MASTER_ARCHIVE__"] = Archive["OriginServer"];
         Subst["__PRIMARY_MIRROR__"] = Archive["PrimaryMirror"];
-        for bug in Options["Done"].split():
+        for bug in utils.split_args(Options["Done"]):
             Subst["__BUG_NUMBER__"] = bug;
             mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/melanie.bug-close");
-            utils.send_mail (mail_message, "")
+            utils.send_mail(mail_message);
 
     logfile.write("=========================================================================\n");
     logfile.close();