# Installs Debian packaes
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: katie,v 1.32 2001-03-20 00:28:11 troup Exp $
+# $Id: katie,v 1.33 2001-03-21 01:05:07 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
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-# Based (almost entirely) on dinstall by Guy Maor <maor@debian.org>
+# Originally based almost entirely on dinstall by Guy Maor <maor@debian.org>
#########################################################################################
re_fdnic = re.compile("\n\n");
re_bad_diff = re.compile("^[\-\+][\-\+][\-\+] /dev/null");
-###############################################################################
-
-#
-reject_footer = """If you don't understand why your files were rejected, or if the
-override file requires editing, reply to this email.
-
-Your rejected files are in incoming/REJECT/. (Some may also be in
-incoming/ if your .changes file was unparsable.) If only some of the
-files need to repaired, you may move any good files back to incoming/.
-Please remove any bad files from incoming/REJECT/."""
-#
-new_ack_footer = """Your package contains new components which requires manual editing of
-the override file. It is ok otherwise, so please be patient. New
-packages are usually added to the override file about once a week.
-
-You may have gotten the distribution wrong. You'll get warnings above
-if files already exist in other distributions."""
-#
-installed_footer = """If the override file requires editing, file a bug on ftp.debian.org.
-
-Thank you for your contribution to Debian GNU."""
-
#########################################################################################
# Globals
reprocess = 0;
orig_tar_id = None;
legacy_source_untouchable = {};
+Subst = {};
#########################################################################################
-v, --version display the version number and exit"""
sys.exit(exit_code)
+#########################################################################################
+
def check_signature (filename):
global reject_message
reject_message = reject_message + "Rejected: md5sum check failed for %s.\n" % (file);
def check_override ():
+ global Subst;
+
# Only check section & priority on sourceful uploads
if not changes["architecture"].has_key("source"):
return;
if summary == "":
return;
-
- mail_message = """Return-Path: %s
-From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s override disparity
-
-There are disparities between your recently installed upload and the
-override file for the following file(s):
-
-%s
-Either the package or the override file is incorrect. If you think
-the override is correct and the package wrong please fix the package
-so that this disparity is fixed in the next upload. If you feel the
-override is incorrect then please reply to this mail and explain why.
-
---
-Debian distribution maintenance software
-
-(This message was generated automatically; if you believe that there
-is a problem with it please contact the archive administrators by
-mailing ftpmaster@debian.org)
-""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], changes["source"], summary);
+
+ Subst["__SUMMARY__"] = summary;
+ mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.override-disparity","r").read());
utils.send_mail (mail_message, "")
#####################################################################################################################
+# Set up the per-package template substitution mappings
+
+def update_subst (changes_filename):
+ global Subst;
+
+ Subst["__ARCHITECTURE__"] = string.join(changes["architecture"].keys(), ' ' );
+ Subst["__CHANGES_FILENAME__"] = os.path.basename(changes_filename);
+ Subst["__FILE_CONTENTS__"] = changes["filecontents"];
+ Subst["__MAINTAINER_ADDRESS__"] = changes["maintainer822"];
+ Subst["__MAINTAINER__"] = changes["maintainer"];
+ Subst["__REJECT_MESSAGE__"] = reject_message;
+ Subst["__SOURCE__"] = changes["source"];
+ Subst["__VERSION__"] = changes["version"];
+
+#####################################################################################################################
+
def action (changes_filename):
byhand = confirm = suites = summary = new = "";
#####################################################################################################################
def install (changes_filename, summary, short_summary):
- global install_count, install_bytes
+ global install_count, install_bytes, Subst;
# Stable uploads are a special case
if changes.has_key("stable upload"):
install_count = install_count + 1;
if not Cnf["Dinstall::Options::No-Mail"]:
- mail_message = """Return-Path: %s
-From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s INSTALLED
-
-%s
-Installing:
-%s
-
-%s""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], os.path.basename(changes_filename), reject_message, summary, installed_footer)
+ Subst["__SUITE__"] = "";
+ Subst["__SUMMARY__"] = summary;
+ mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.installed","r").read());
utils.send_mail (mail_message, "")
announce (short_summary, 1)
check_override ();
#####################################################################################################################
def stable_install (changes_filename, summary, short_summary):
- global install_count, install_bytes
+ global install_count, install_bytes, Subst;
print "Installing to stable."
install_count = install_count + 1;
if not Cnf["Dinstall::Options::No-Mail"]:
- mail_message = """Return-Path: %s
-From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s INSTALLED into stable
-
-%s
-Installing:
-%s
-
-%s""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], os.path.basename(changes_filename), reject_message, summary, installed_footer)
+ Subst["__SUITE__"] = "into stable";
+ Subst["__SUMMARY__"] = summary;
utils.send_mail (mail_message, "")
announce (short_summary, 1)
#####################################################################################################################
def reject (changes_filename, manual_reject_mail_filename):
+ global Subst;
+
print "Rejecting.\n"
base_changes_filename = os.path.basename(changes_filename);
fd = os.open(reject_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644);
os.write(fd, reject_message);
os.close(fd);
- reject_mail_message = """From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s REJECTED
-
-%s
-===
-%s""" % (Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], os.path.basename(changes_filename), reject_message, reject_footer);
+ Subst["__MANUAL_REJECT_MESSAGE__"] = "";
+ reject_mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.rejected","r").read());
else: # Have a manual rejection file to use
reject_mail_message = ""; # avoid <undef>'s
##################################################################
def manual_reject (changes_filename):
+ global Subst;
+
# Build up the rejection email
user_email_address = string.replace(string.split(pwd.getpwuid(os.getuid())[4],',')[0], '.', '')
user_email_address = user_email_address + " <%s@%s>" % (pwd.getpwuid(os.getuid())[0], Cnf["Dinstall::MyHost"])
manual_reject_message = Cnf.get("Dinstall::Options::Manual-Reject", "")
- reject_mail_message = """From: %s
-Cc: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s REJECTED
-
-%s
-%s
-===
-%s""" % (user_email_address, Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], os.path.basename(changes_filename), manual_reject_message, reject_message, reject_footer)
+ Subst["__MANUAL_REJECT_MESSAGE__"] = manual_reject_message;
+ reject_mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.rejected","r").read());
# Write the rejection email out as the <foo>.reason file
reason_filename = re_changes.sub("reason", os.path.basename(changes_filename));
#####################################################################################################################
def acknowledge_new (changes_filename, summary):
- global new_ack_new;
+ global new_ack_new, Subst;
changes_filename = os.path.basename(changes_filename);
print "Sending new ack.";
if not Cnf["Dinstall::Options::No-Mail"]:
- new_ack_message = """Return-Path: %s
-From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: %s is NEW
-
-%s
-%s""" % (Cnf["Dinstall::MyEmailAddress"], Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], changes_filename, summary, new_ack_footer);
+ Subst["__SUMMARY__"] = summary;
+ new_ack_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.new","r").read());
utils.send_mail(new_ack_message,"");
#####################################################################################################################
def announce (short_summary, action):
+ global Subst;
+
# Only do announcements for source uploads with a recent dpkg-dev installed
if float(changes.get("format", 0)) < 1.6 or not changes["architecture"].has_key("source"):
return ""
lists_done = {}
summary = ""
+ Subst["__SHORT_SUMMARY__"] = short_summary;
for dist in changes["distribution"].keys():
list = Cnf.Find("Suite::%s::Announce" % (dist))
- if list == None or lists_done.has_key(list):
+ if list == "" or lists_done.has_key(list):
continue
lists_done[list] = 1
summary = summary + "Announcing to %s\n" % (list)
if action:
- mail_message = """Return-Path: %s
-From: %s
-To: %s
-Bcc: troup@auric.debian.org
-Subject: Installed %s %s (%s)
-
-%s
-
-Installed:
-%s
-""" % (Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], list, changes["source"], changes["version"], string.join(changes["architecture"].keys(), ' ' ),
- changes["filecontents"], short_summary)
+ Subst["__ANNOUNCE_LIST_ADDRESS__"] = list;
+ mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.announce","r").read());
utils.send_mail (mail_message, "")
(dsc_rfc822, dsc_name, dsc_email) = utils.fix_maintainer (dsc.get("maintainer",Cnf["Dinstall::MyEmailAddress"]));
for bug in bugs:
summary = summary + "%s " % (bug)
if action:
- mail_message = """Return-Path: %s
-From: %s
-To: %s-close@bugs.debian.org
-Bcc: troup@auric.debian.org
-Subject: Bug#%s: fixed in %s %s
-
-We believe that the bug you reported is fixed in the latest version of
-%s, which has been installed in the Debian FTP archive:
-
-%s""" % (Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], bug, bug, changes["source"], changes["version"], changes["source"], short_summary)
-
+ Subst["__BUG_NUMBER__"] = bug;
if changes["distribution"].has_key("stable"):
- mail_message = mail_message + """Note that this package is not part of the released stable Debian
+ Subst["__STABLE_WARNING__"] = """
+Note that this package is not part of the released stable Debian
distribution. It may have dependencies on other unreleased software,
or other instabilities. Please take care if you wish to install it.
The update will eventually make its way into the next released Debian
distribution."""
-
- mail_message = mail_message + """A summary of the changes between this version and the previous one is
-attached.
-
-Thank you for reporting the bug, which will now be closed. If you
-have further comments please address them to %s@bugs.debian.org,
-and the maintainer will reopen the bug report if appropriate.
-
-Debian distribution maintenance software
-pp.
-%s (supplier of updated %s package)
-
-(This message was generated automatically at their request; if you
-believe that there is a problem with it please contact the archive
-administrators by mailing ftpmaster@debian.org)
-
-
-%s""" % (bug, changes["maintainer"], changes["source"], changes["filecontents"])
-
+ else:
+ Subst["__STABLE_WARNING__"] = "";
+ mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.bug-close","r").read());
utils.send_mail (mail_message, "")
else: # NMU
summary = summary + "Setting bugs to severity fixed: "
summary = summary + "%s " % (bug)
control_message = control_message + "tag %s + fixed\n" % (bug)
if action and control_message != "":
- mail_message = """Return-Path: %s
-From: %s
-To: control@bugs.debian.org
-Bcc: troup@auric.debian.org, %s
-Subject: Fixed in NMU of %s %s
-
-%s
-quit
-
-This message was generated automatically in response to a
-non-maintainer upload. The .changes file follows.
-
-%s
-""" % (Cnf["Dinstall::MyEmailAddress"], changes["maintainer822"], changes["maintainer822"], changes["source"], changes["version"], control_message, changes["filecontents"])
+ Subst["__CONTROL_MESSAGE__"] = control_message;
+ mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.bug-nmu-fixed","r").read());
utils.send_mail (mail_message, "")
summary = summary + "\n"
check_dsc ();
check_diff ();
+ update_subst(changes_file);
action(changes_file);
# Restore CWD
###############################################################################
def main():
- global Cnf, projectB, install_bytes, new_ack_old
+ global Cnf, projectB, install_bytes, new_ack_old, Subst
apt_pkg.init();
new_ack_old[line[:-1]] = 1;
new_ack_list.close();
+ # Initialize the substitution template mapping global
+ Subst = {}
+ Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"];
+ Subst["__BUG_SERVER__"] = Cnf["Dinstall::BugServer"];
+ bcc = "X-Katie: $Id: katie,v 1.33 2001-03-21 01:05:07 troup Exp $"
+ if Cnf.has_key("Dinstall::Bcc"):
+ Subst["__BCC__"] = bcc + "\nBcc: %s" % (Cnf["Dinstall::Bcc"]);
+ else:
+ Subst["__BCC__"] = bcc;
+ Subst["__DISTRO__"] = Cnf["Dinstall::MyDistribution"];
+ Subst["__KATIE_ADDRESS__"] = Cnf["Dinstall::MyEmailAddress"];
+
# Process the changes files
for changes_file in changes_files:
print "\n" + changes_file;
# General purpose archive tool for ftpmaster
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
-# $Id: melanie,v 1.8 2001-03-20 00:28:11 troup Exp $
+# $Id: melanie,v 1.9 2001-03-21 01:05:07 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
################################################################################
+# "That's just fucking great! Game over, man! What the fuck are we
+# going to do now?"
+
def game_over():
print "Continue (y/N)? ",
answer = string.lower(utils.our_raw_input());
# Send the bug closing messages
if Options["Done"]:
+ Subst = {};
+ Subst["__MELANIE_ADDRESS__"] = Cnf["Melanie::MyEmailAddress"];
+ Subst["__BUG_SERVER__"] = Cnf["Dinstall::BugServer"];
+ if Cnf.Find("Dinstall::Bcc") != "":
+ Subst["__BCC__"] = "Bcc: " + Cnf["Dinstall::Bcc"];
+ else:
+ Subst["__BCC__"] = "X-Filler: 42";
+ Subst["__CC__"] = "X-Melanie: $Id: melanie,v 1.9 2001-03-21 01:05:07 troup Exp $\n" + carbon_copy[:-1];
+ Subst["__SUITE_LIST__"] = suites_list;
+ Subst["__SUMMARY__"] = summary;
+ Subst["__ADMIN_ADDRESS__"] = Cnf["Dinstall::MyAdminAddress"];
+ Subst["__DISTRO__"] = Cnf["Dinstall::MyDistribution"];
+ Subst["__WHOAMI__"] = whoami;
+ whereami = utils.where_am_i();
+ Archive = Cnf.SubTree("Archive::%s" % (whereami));
+ Subst["__MASTER_ARCHIVE__"] = Archive["OriginServer"];
+ Subst["__PRIMARY_MIRROR__"] = Archive["PrimaryMirror"];
for bug in string.split(Options["Done"]):
- mail_message = """Return-Path: %s
-From: %s
-To: %s-close@bugs.debian.org
-Bcc: troup@auric.debian.org
-Bcc: removed-packages@qa.debian.org
-%sSubject: Bug#%s: fixed
-
-We believe that the bug you reported is now fixed; the following
-package(s) have been removed from %s:
-
-%s
-Note that the package(s) have simply been removed from the tag
-database and may (or may not) still be in the pool; this is not a bug.
-The package(s) will be physically removed automatically when no suite
-references them (and in the case of source, when no binary references
-it). Please also remember that the changes have been done on the
-master archive (ftp-master.debian.org) and will not propagate to any
-mirrors (ftp.debian.org included) until the next cron.daily run at the
-earliest.
-
-Packages are never removed from testing by hand. Testing tracks
-unstable and will automatically remove packages which were removed
-from unstable when removing them from testing causes no dependency
-problems.
-
-Bugs which have been reported against this package are not automatically
-removed from the Bug Tracking System. Please check all open bugs and
-close them or re-assign them to another package if the removed package
-was superseded by another one.
-
-Thank you for reporting the bug, which will now be closed. If you
-have further comments please address them to %s@bugs.debian.org.
-
-This message was generated automatically; if you believe that there is
-a problem with it please contact the archive administrators by mailing
-ftpmaster@debian.org.
-
-Debian distribution maintenance software
-pp.
-%s (the ftpmaster behind the curtain)
-""" % (Cnf["Melanie::MyEmailAddress"], Cnf["Melanie::MyEmailAddress"], bug, carbon_copy, bug, suites_list, summary, bug, whoami);
+ 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");