# Installs Debian packaes
# Copyright (C) 2000 James Troup <james@nocrew.org>
-# $Id: katie,v 1.11 2000-12-15 00:15:30 troup Exp $
+# $Id: katie,v 1.16 2000-12-20 08:25:56 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
del changes["distribution"]["frozen"]
reject_message = reject_message + "Mapping frozen to unstable.\n"
+ # Map testing to unstable
+ if changes["distribution"].has_key("testing"):
+ del changes["distribution"]["testing"]
+ reject_message = reject_message + "Mapping testing to unstable.\n"
+
# Ensure target distributions exist
for i in changes["distribution"].keys():
if not Cnf.has_key("Suite::%s" % (i)):
# locations of an .orig.tar.gz.
for dsc_file in dsc_files.keys():
if files.has_key(dsc_file):
- actual_md5 = files[dsc_file]["md5sum"]
+ actual_md5 = files[dsc_file]["md5sum"];
+ actual_size = int(files[dsc_file]["size"]);
found = "%s in incoming" % (dsc_file)
# Check the file does not already exist in the archive
if not changes.has_key("stable upload"):
if len(ql) > 0:
old_file = ql[0][0] + ql[0][1];
actual_md5 = apt_pkg.md5sum(utils.open_file(old_file,"r"));
+ actual_size = os.stat(old_file)[stat.ST_SIZE];
found = old_file;
suite_type = ql[0][2];
dsc_files[dsc_file]["files id"] = ql[0][3]; # need this for updating dsc_files in install()
reject_message = reject_message + "Rejected: %s refers to %s, but I can't find it in Incoming." % (file, dsc_file);
continue;
if actual_md5 != dsc_files[dsc_file]["md5sum"]:
- reject_message = reject_message + "Rejected: md5sum for %s doesn't match %s.\n" % (found, file)
+ reject_message = reject_message + "Rejected: md5sum for %s doesn't match %s.\n" % (found, file);
+ if actual_size != int(dsc_files[dsc_file]["size"]):
+ reject_message = reject_message + "Rejected: size for %s doesn't match %s.\n" % (found, file);
if string.find(reject_message, "Rejected:") != -1:
return 0
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/
- utils.move (changes_filename, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_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.cant_overwrite_exc:
+ sys.stderr.write("W: couldn't overwrite existing file '%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], base_changes_filename));
+ pass;
for file in files.keys():
- if os.access(file,os.R_OK) == 0:
- utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file));
+ if os.path.exists(file):
+ try:
+ utils.move (file, "%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file));
+ except utils.cant_overwrite_exc:
+ sys.stderr.write("W: couldn't overwrite existing file '%s/REJECT/%s" % (Cnf["Dir::IncomingDir"], file));
+ pass;
# If this is not a manual rejection generate the .reason file and rejection mail message
if manual_reject_mail_filename == "":
print "\n" + changes_file;
process_it (changes_file);
- install_mag = " b";
- if install_bytes > 10000:
- install_bytes = install_bytes / 1000;
- install_mag = " Kb";
- if install_bytes > 10000:
- install_bytes = install_bytes / 1000;
- install_mag = " Mb";
if install_count:
sets = "set"
if install_count > 1:
sets = "sets"
- sys.stderr.write("Installed %d package %s, %d%s.\n" % (install_count, sets, int(install_bytes), install_mag))
+ sys.stderr.write("Installed %d package %s, %s.\n" % (install_count, sets, utils.size_type(int(install_bytes))));
# Write out the list of already-acknowledged NEW packages
if Cnf["Dinstall::Options::Ack-New"]: