- if not Options["No-Mail"]:
- Subst["__SUITE__"] = " into stable";
- 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)
-
-#####################################################################################################################
-
-def reject (changes_filename, manual_reject_mail_filename):
- global Subst;
-
- print "Rejecting.\n"
-
- base_changes_filename = os.path.basename(changes_filename);
- reason_filename = re_changes.sub("reason", base_changes_filename);
- reject_filename = "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], reason_filename);
-
- # Move the .changes files and it's contents into REJECT/ (if we can; errors are ignored)
- try:
- utils.move (changes_filename, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_filename));
- except:
- utils.warn("couldn't reject changes file '%s'. [Got %s]" % (base_changes_filename, sys.exc_type));
- pass;
- for file in files.keys():
- if os.path.exists(file):
- try:
- utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file));
- except:
- utils.warn("couldn't reject file '%s'. [Got %s]" % (file, sys.exc_type));
- pass;
-
- # If this is not a manual rejection generate the .reason file and rejection mail message
- if manual_reject_mail_filename == "":
- if os.path.exists(reject_filename):
- os.unlink(reject_filename);
- fd = os.open(reject_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644);
- os.write(fd, reject_message);
- os.close(fd);
- Subst["__MANUAL_REJECT_MESSAGE__"] = "";
- Subst["__CC__"] = "X-Katie-Rejection: automatic (moo)";
- 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
-
- # Send the rejection mail if appropriate
- if not Options["No-Mail"]:
- utils.send_mail (reject_mail_message, manual_reject_mail_filename);
-
- Logger.log(["rejected", changes_filename]);
-
-##################################################################
-
-def manual_reject (changes_filename):
- global Subst;
-
- # Build up the rejection email
- user_email_address = utils.whoami() + " <%s@%s>" % (pwd.getpwuid(os.getuid())[0], Cnf["Dinstall::MyHost"])
- manual_reject_message = Cnf.get("Dinstall::Options::Manual-Reject", "")
-
- Subst["__MANUAL_REJECT_MESSAGE__"] = manual_reject_message;
- Subst["__CC__"] = "Cc: " + Cnf["Dinstall::MyEmailAddress"];
- 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));
- reject_filename = "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], reason_filename)
- if os.path.exists(reject_filename):
- os.unlink(reject_filename);
- fd = os.open(reject_filename, os.O_RDWR|os.O_CREAT|os.O_EXCL, 0644);
- os.write(fd, reject_mail_message);
- os.close(fd);
-
- # If we weren't given one, spawn an editor so the user can add one in
- if manual_reject_message == "":
- result = os.system("vi +6 %s" % (reject_filename))
- if result != 0:
- utils.fubar("vi invocation failed for `%s'!" % (reject_filename), result);
-
- # Then process it as if it were an automatic rejection
- reject (changes_filename, reject_filename)
-
-#####################################################################################################################
-
-def acknowledge_new (changes_filename, summary):
- global new_ack_new, Subst;
-
- changes_filename = os.path.basename(changes_filename);
-
- new_ack_new[changes_filename] = 1;
-
- if new_ack_old.has_key(changes_filename):
- print "Ack already sent.";
- return;
-
- print "Sending new ack.";
- if not Options["No-Mail"]:
- 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 == "" or lists_done.has_key(list):
- continue
- lists_done[list] = 1
- summary = summary + "Announcing to %s\n" % (list)
-
- if action:
- Subst["__ANNOUNCE_LIST_ADDRESS__"] = list;
- mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.announce","r").read());
- utils.send_mail (mail_message, "")
-
- bugs = changes["closes"].keys()
- bugs.sort()
- if not nmu.is_an_nmu(changes, dsc):
- summary = summary + "Closing bugs: "
- for bug in bugs:
- summary = summary + "%s " % (bug)
- if action:
- Subst["__BUG_NUMBER__"] = bug;
- if changes["distribution"].has_key("stable"):
- 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."""
- else:
- Subst["__STABLE_WARNING__"] = "";
- mail_message = utils.TemplateSubst(Subst,open(Cnf["Dir::TemplatesDir"]+"/katie.bug-close","r").read());
- utils.send_mail (mail_message, "")
- if action:
- Logger.log(["closing bugs"]+bugs);
- else: # NMU
- summary = summary + "Setting bugs to severity fixed: "
- control_message = ""
- for bug in bugs:
- summary = summary + "%s " % (bug)
- control_message = control_message + "tag %s + fixed\n" % (bug)
- if action and control_message != "":
- 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, "")
- if action:
- Logger.log(["setting bugs to fixed"]+bugs);
- summary = summary + "\n"
-
- return summary
-
-###############################################################################
-
-# reprocess is necessary for the case of foo_1.2-1 and foo_1.2-2 in
-# Incoming. -1 will reference the .orig.tar.gz, but -2 will not.
-# dsccheckdistrib() can find the .orig.tar.gz but it will not have
-# processed it during it's checks of -2. If -1 has been deleted or
-# otherwise not checked by da-install, the .orig.tar.gz will not have
-# been checked at all. To get round this, we force the .orig.tar.gz
-# into the .changes structure and reprocess the .changes file.