X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_accepted.py;h=9883bb206de77c0e7b5a9780769482534cf774aa;hb=14396f8a5519e35e909d77ede50f3c6e39313729;hp=e99c35b359bdce6cec908225e32c1f20ce42ef5e;hpb=8e60420c69a993a4041c22008dafc2fcb238d0d5;p=dak.git diff --git a/dak/process_accepted.py b/dak/process_accepted.py index e99c35b3..9883bb20 100755 --- a/dak/process_accepted.py +++ b/dak/process_accepted.py @@ -1,8 +1,14 @@ #!/usr/bin/env python -# Installs Debian packages from queue/accepted into the pool -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2006 James Troup +""" +Installs Debian packages from queue/accepted into the pool +@contact: Debian FTP Master +@copyright: 2000, 2001, 2002, 2003, 2004, 2006 James Troup +@copyright: 2009 Joerg Jaspert +@license: GNU General Public License version 2 or later + +""" # 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 # the Free Software Foundation; either version 2 of the License, or @@ -29,12 +35,19 @@ ############################################################################### -import errno, fcntl, os, sys, time, re -import apt_pkg +import errno +import fcntl +import os +import sys +import time +import re +import apt_pkg, commands from daklib import database from daklib import logging from daklib import queue from daklib import utils +from daklib.dak_exceptions import * +from daklib.regexes import re_default_answer, re_issource, re_fdnic ############################################################################### @@ -95,8 +108,10 @@ class Urgency_Log: else: os.unlink(self.log_filename) + ############################################################################### + def reject (str, prefix="Rejected: "): global reject_message if str: @@ -108,32 +123,32 @@ def reject (str, prefix="Rejected: "): def check(): propogate={} nopropogate={} - for file in files.keys(): + for checkfile in files.keys(): # The .orig.tar.gz can disappear out from under us is it's a # duplicate of one in the archive. - if not files.has_key(file): + if not files.has_key(checkfile): continue # Check that the source still exists - if files[file]["type"] == "deb": - source_version = files[file]["source version"] - source_package = files[file]["source package"] + if files[checkfile]["type"] == "deb": + source_version = files[checkfile]["source version"] + source_package = files[checkfile]["source package"] if not changes["architecture"].has_key("source") \ and not Upload.source_exists(source_package, source_version, changes["distribution"].keys()): - reject("no source found for %s %s (%s)." % (source_package, source_version, file)) + reject("no source found for %s %s (%s)." % (source_package, source_version, checkfile)) # Version and file overwrite checks if not installing_to_stable: - if files[file]["type"] == "deb": - reject(Upload.check_binary_against_db(file), "") - elif files[file]["type"] == "dsc": - reject(Upload.check_source_against_db(file), "") - (reject_msg, is_in_incoming) = Upload.check_dsc_against_db(file) + if files[checkfile]["type"] == "deb": + reject(Upload.check_binary_against_db(checkfile), "") + elif files[checkfile]["type"] == "dsc": + reject(Upload.check_source_against_db(checkfile), "") + (reject_msg, is_in_incoming) = Upload.check_dsc_against_db(checkfile) reject(reject_msg, "") # propogate in the case it is in the override tables: if changes.has_key("propdistribution"): for suite in changes["propdistribution"].keys(): - if Upload.in_override_p(files[file]["package"], files[file]["component"], suite, files[file].get("dbtype",""), file): + if Upload.in_override_p(files[checkfile]["package"], files[checkfile]["component"], suite, files[checkfile].get("dbtype",""), checkfile): propogate[suite] = 1 else: nopropogate[suite] = 1 @@ -143,11 +158,11 @@ def check(): continue changes["distribution"][suite] = 1 - for file in files.keys(): + for checkfile in files.keys(): # Check the package is still in the override tables for suite in changes["distribution"].keys(): - if not Upload.in_override_p(files[file]["package"], files[file]["component"], suite, files[file].get("dbtype",""), file): - reject("%s is NEW for %s." % (file, suite)) + if not Upload.in_override_p(files[checkfile]["package"], files[checkfile]["component"], suite, files[checkfile].get("dbtype",""), checkfile): + reject("%s is NEW for %s." % (checkfile, suite)) ############################################################################### @@ -160,9 +175,11 @@ def init(): ('h',"help","Dinstall::Options::Help"), ('n',"no-action","Dinstall::Options::No-Action"), ('p',"no-lock", "Dinstall::Options::No-Lock"), - ('s',"no-mail", "Dinstall::Options::No-Mail")] + ('s',"no-mail", "Dinstall::Options::No-Mail"), + ('d',"directory", "Dinstall::Options::Directory", "HasArg")] - for i in ["automatic", "help", "no-action", "no-lock", "no-mail", "version"]: + for i in ["automatic", "help", "no-action", "no-lock", "no-mail", + "version", "directory"]: if not Cnf.has_key("Dinstall::Options::%s" % (i)): Cnf["Dinstall::Options::%s" % (i)] = "" @@ -172,6 +189,15 @@ def init(): if Options["Help"]: usage() + # If we have a directory flag, use it to find our files + if Cnf["Dinstall::Options::Directory"] != "": + # Note that we clobber the list of files we were given in this case + # so warn if the user has done both + if len(changes_files) > 0: + utils.warn("Directory provided so ignoring files given on command line") + + changes_files = utils.get_changes_files(Cnf["Dinstall::Options::Directory"]) + Upload = queue.Upload(Cnf) projectB = Upload.projectB @@ -198,7 +224,7 @@ def usage (exit_code=0): ############################################################################### -def action (): +def action (queue=""): (summary, short_summary) = Upload.build_summaries() (prompt, answer) = ("", "XXX") @@ -219,7 +245,7 @@ def action (): while prompt.find(answer) == -1: answer = utils.our_raw_input(prompt) - m = queue.re_default_answer.match(prompt) + m = re_default_answer.match(prompt) if answer == "": answer = m.group(1) answer = answer[:1].upper() @@ -230,7 +256,7 @@ def action (): if not installing_to_stable: install() else: - stable_install(summary, short_summary) + stable_install(summary, short_summary, queue) elif answer == 'Q': sys.exit(0) @@ -273,9 +299,17 @@ def install (): # Begin a transaction; if we bomb out anywhere between here and the COMMIT WORK below, the DB will not be changed. projectB.query("BEGIN WORK") + # Ensure that we have all the hashes we need below. + rejmsg = utils.ensure_hashes(changes, dsc, files, dsc_files) + if len(rejmsg) > 0: + # There were errors. Print them and SKIP the changes. + for msg in rejmsg: + utils.warn(msg) + return + # Add the .dsc file to the DB - for file in files.keys(): - if files[file]["type"] == "dsc": + for newfile in files.keys(): + if files[newfile]["type"] == "dsc": package = dsc["source"] version = dsc["version"] # NB: not files[file]["version"], that has no epoch maintainer = dsc["maintainer"] @@ -286,22 +320,26 @@ def install (): changedby_id = database.get_or_set_maintainer_id(changedby) fingerprint_id = database.get_or_set_fingerprint_id(dsc["fingerprint"]) install_date = time.strftime("%Y-%m-%d") - filename = files[file]["pool name"] + file - dsc_component = files[file]["component"] - dsc_location_id = files[file]["location id"] - if not files[file].has_key("files id") or not files[file]["files id"]: - files[file]["files id"] = database.set_files_id (filename, files[file]["size"], files[file]["md5sum"], dsc_location_id) - projectB.query("INSERT INTO source (source, version, maintainer, changedby, file, install_date, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, '%s', %s)" - % (package, version, maintainer_id, changedby_id, files[file]["files id"], install_date, fingerprint_id)) + filename = files[newfile]["pool name"] + newfile + dsc_component = files[newfile]["component"] + dsc_location_id = files[newfile]["location id"] + if dsc.has_key("dm-upload-allowed") and dsc["dm-upload-allowed"] == "yes": + dm_upload_allowed = "true" + else: + dm_upload_allowed = "false" + if not files[newfile].has_key("files id") or not files[newfile]["files id"]: + files[newfile]["files id"] = database.set_files_id (filename, files[newfile]["size"], files[newfile]["md5sum"], files[newfile]["sha1sum"], files[newfile]["sha256sum"], dsc_location_id) + projectB.query("INSERT INTO source (source, version, maintainer, changedby, file, install_date, sig_fpr, dm_upload_allowed) VALUES ('%s', '%s', %d, %d, %d, '%s', %s, %s)" + % (package, version, maintainer_id, changedby_id, files[newfile]["files id"], install_date, fingerprint_id, dm_upload_allowed)) for suite in changes["distribution"].keys(): suite_id = database.get_suite_id(suite) projectB.query("INSERT INTO src_associations (suite, source) VALUES (%d, currval('source_id_seq'))" % (suite_id)) # Add the source files to the DB (files and dsc_files) - projectB.query("INSERT INTO dsc_files (source, file) VALUES (currval('source_id_seq'), %d)" % (files[file]["files id"])) + projectB.query("INSERT INTO dsc_files (source, file) VALUES (currval('source_id_seq'), %d)" % (files[newfile]["files id"])) for dsc_file in dsc_files.keys(): - filename = files[file]["pool name"] + dsc_file + filename = files[newfile]["pool name"] + dsc_file # If the .orig.tar.gz is already in the pool, it's # files id is stored in dsc_files by check_dsc(). files_id = dsc_files[dsc_file].get("files id", None) @@ -309,103 +347,90 @@ def install (): files_id = database.get_files_id(filename, dsc_files[dsc_file]["size"], dsc_files[dsc_file]["md5sum"], dsc_location_id) # FIXME: needs to check for -1/-2 and or handle exception if files_id == None: - files_id = database.set_files_id (filename, dsc_files[dsc_file]["size"], dsc_files[dsc_file]["md5sum"], dsc_location_id) + files_id = database.set_files_id (filename, dsc_files[dsc_file]["size"], dsc_files[dsc_file]["md5sum"], files[dsc_file]["sha1sum"], files[dsc_file]["sha256sum"], dsc_location_id) projectB.query("INSERT INTO dsc_files (source, file) VALUES (currval('source_id_seq'), %d)" % (files_id)) # Add the src_uploaders to the DB - if dsc.get("dm-upload-allowed", "no") == "yes": - uploader_ids = [maintainer_id] - if dsc.has_key("uploaders"): - for u in dsc["uploaders"].split(","): - u = u.replace("'", "\\'") - u = u.strip() - uploader_ids.append( - database.get_or_set_maintainer_id(u)) - added_ids = {} - for u in uploader_ids: - if added_ids.has_key(u): - utils.warn("Already saw uploader %s for source %s" % (u, package)) - continue - added_ids[u]=1 - projectB.query("INSERT INTO src_uploaders (source, maintainer) VALUES (currval('source_id_seq'), %d)" % (u)) + uploader_ids = [maintainer_id] + if dsc.has_key("uploaders"): + for u in dsc["uploaders"].split(","): + u = u.replace("'", "\\'") + u = u.strip() + uploader_ids.append( + database.get_or_set_maintainer_id(u)) + added_ids = {} + for u in uploader_ids: + if added_ids.has_key(u): + utils.warn("Already saw uploader %s for source %s" % (u, package)) + continue + added_ids[u]=1 + projectB.query("INSERT INTO src_uploaders (source, maintainer) VALUES (currval('source_id_seq'), %d)" % (u)) # Add the .deb files to the DB - for file in files.keys(): - if files[file]["type"] == "deb": - package = files[file]["package"] - version = files[file]["version"] - maintainer = files[file]["maintainer"] + for newfile in files.keys(): + if files[newfile]["type"] == "deb": + package = files[newfile]["package"] + version = files[newfile]["version"] + maintainer = files[newfile]["maintainer"] maintainer = maintainer.replace("'", "\\'") maintainer_id = database.get_or_set_maintainer_id(maintainer) fingerprint_id = database.get_or_set_fingerprint_id(changes["fingerprint"]) - architecture = files[file]["architecture"] + architecture = files[newfile]["architecture"] architecture_id = database.get_architecture_id (architecture) - type = files[file]["dbtype"] - source = files[file]["source package"] - source_version = files[file]["source version"] - filename = files[file]["pool name"] + file - if not files[file].has_key("location id") or not files[file]["location id"]: - files[file]["location id"] = database.get_location_id(Cnf["Dir::Pool"],files[file]["component"],utils.where_am_i()) - if not files[file].has_key("files id") or not files[file]["files id"]: - files[file]["files id"] = database.set_files_id (filename, files[file]["size"], files[file]["md5sum"], files[file]["location id"]) + filetype = files[newfile]["dbtype"] + source = files[newfile]["source package"] + source_version = files[newfile]["source version"] + filename = files[newfile]["pool name"] + newfile + if not files[newfile].has_key("location id") or not files[newfile]["location id"]: + files[newfile]["location id"] = database.get_location_id(Cnf["Dir::Pool"],files[newfile]["component"],utils.where_am_i()) + if not files[newfile].has_key("files id") or not files[newfile]["files id"]: + files[newfile]["files id"] = database.set_files_id (filename, files[newfile]["size"], files[newfile]["md5sum"], files[newfile]["sha1sum"], files[newfile]["sha256sum"], files[newfile]["location id"]) source_id = database.get_source_id (source, source_version) if source_id: projectB.query("INSERT INTO binaries (package, version, maintainer, source, architecture, file, type, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, %d, '%s', %d)" - % (package, version, maintainer_id, source_id, architecture_id, files[file]["files id"], type, fingerprint_id)) + % (package, version, maintainer_id, source_id, architecture_id, files[newfile]["files id"], filetype, fingerprint_id)) else: - projectB.query("INSERT INTO binaries (package, version, maintainer, architecture, file, type, sig_fpr) VALUES ('%s', '%s', %d, %d, %d, '%s', %d)" - % (package, version, maintainer_id, architecture_id, files[file]["files id"], type, fingerprint_id)) + raise NoSourceFieldError, "Unable to find a source id for %s (%s), %s, file %s, type %s, signed by %s" % (package, version, architecture, newfile, filetype, changes["fingerprint"]) for suite in changes["distribution"].keys(): suite_id = database.get_suite_id(suite) projectB.query("INSERT INTO bin_associations (suite, bin) VALUES (%d, currval('binaries_id_seq'))" % (suite_id)) - # If the .orig.tar.gz is in a legacy directory we need to poolify - # it, so that apt-get source (and anything else that goes by the - # "Directory:" field in the Sources.gz file) works. + if not database.copy_temporary_contents(package, version, architecture, newfile, reject): + print "REJECT\n" + reject_message, + projectB.query("ROLLBACK") + raise MissingContents, "No contents stored for package %s, and couldn't determine contents of %s" % (package, newfile ) + + orig_tar_id = Upload.pkg.orig_tar_id orig_tar_location = Upload.pkg.orig_tar_location - legacy_source_untouchable = Upload.pkg.legacy_source_untouchable - if orig_tar_id and orig_tar_location == "legacy": - q = projectB.query("SELECT DISTINCT ON (f.id) l.path, f.filename, f.id as files_id, df.source, df.id as dsc_files_id, f.size, f.md5sum FROM files f, dsc_files df, location l WHERE df.source IN (SELECT source FROM dsc_files WHERE file = %s) AND f.id = df.file AND l.id = f.location AND (l.type = 'legacy' OR l.type = 'legacy-mixed')" % (orig_tar_id)) - qd = q.dictresult() - for qid in qd: - # Is this an old upload superseded by a newer -sa upload? (See check_dsc() for details) - if legacy_source_untouchable.has_key(qid["files_id"]): - continue - # First move the files to the new location - legacy_filename = qid["path"] + qid["filename"] - pool_location = utils.poolify (changes["source"], files[file]["component"]) - pool_filename = pool_location + os.path.basename(qid["filename"]) - destination = Cnf["Dir::Pool"] + pool_location - utils.move(legacy_filename, destination) - # Then Update the DB's files table - q = projectB.query("UPDATE files SET filename = '%s', location = '%s' WHERE id = '%s'" % (pool_filename, dsc_location_id, qid["files_id"])) - - # If this is a sourceful diff only upload that is moving non-legacy + + # If this is a sourceful diff only upload that is moving # cross-component we need to copy the .orig.tar.gz into the new # component too for the same reasons as above. # if changes["architecture"].has_key("source") and orig_tar_id and \ - orig_tar_location != "legacy" and orig_tar_location != dsc_location_id: - q = projectB.query("SELECT l.path, f.filename, f.size, f.md5sum FROM files f, location l WHERE f.id = %s AND f.location = l.id" % (orig_tar_id)) + orig_tar_location != dsc_location_id: + q = projectB.query("SELECT l.path, f.filename, f.size, f.md5sum, f.sha1sum, f.sha256sum FROM files f, location l WHERE f.id = %s AND f.location = l.id" % (orig_tar_id)) ql = q.getresult()[0] old_filename = ql[0] + ql[1] file_size = ql[2] file_md5sum = ql[3] + file_sha1sum = ql[4] + file_sha256sum = ql[5] new_filename = utils.poolify(changes["source"], dsc_component) + os.path.basename(old_filename) new_files_id = database.get_files_id(new_filename, file_size, file_md5sum, dsc_location_id) if new_files_id == None: utils.copy(old_filename, Cnf["Dir::Pool"] + new_filename) - new_files_id = database.set_files_id(new_filename, file_size, file_md5sum, dsc_location_id) - projectB.query("UPDATE dsc_files SET file = %s WHERE source = %s AND file = %s" % (new_files_id, source_id, orig_tar_id)) + new_files_id = database.set_files_id(new_filename, file_size, file_md5sum, file_sha1sum, file_sha256sum, dsc_location_id) + projectB.query("UPDATE dsc_files SET file = %s WHERE source = %s AND file = %s" % (new_files_id, database.get_source_id(changes["source"], changes["version"]), orig_tar_id)) # Install the files into the pool - for file in files.keys(): - destination = Cnf["Dir::Pool"] + files[file]["pool name"] + file - utils.move(file, destination) - Logger.log(["installed", file, files[file]["type"], files[file]["size"], files[file]["architecture"]]) - install_bytes += float(files[file]["size"]) + for newfile in files.keys(): + destination = Cnf["Dir::Pool"] + files[newfile]["pool name"] + newfile + utils.move(newfile, destination) + Logger.log(["installed", newfile, files[newfile]["type"], files[newfile]["size"], files[newfile]["architecture"]]) + install_bytes += float(files[newfile]["size"]) # Copy the .changes file across for suite which need it. copy_changes = {} @@ -420,7 +445,6 @@ def install (): utils.copy(pkg.changes_file, Cnf["Dir::Root"] + dest) for dest in copy_dot_dak.keys(): utils.copy(Upload.pkg.changes_file[:-8]+".dak", dest) - projectB.query("COMMIT WORK") # Move the .changes into the 'done' directory @@ -444,14 +468,14 @@ def install (): dest_dir = Cnf["Dir::QueueBuild"] if Cnf.FindB("Dinstall::SecurityQueueBuild"): dest_dir = os.path.join(dest_dir, suite) - for file in files.keys(): - dest = os.path.join(dest_dir, file) + for newfile in files.keys(): + dest = os.path.join(dest_dir, newfile) # Remove it from the list of packages for later processing by apt-ftparchive projectB.query("UPDATE queue_build SET in_queue = 'f', last_used = '%s' WHERE filename = '%s' AND suite = %s" % (now_date, dest, suite_id)) if not Cnf.FindB("Dinstall::SecurityQueueBuild"): # Update the symlink to point to the new location in the pool - pool_location = utils.poolify (changes["source"], files[file]["component"]) - src = os.path.join(Cnf["Dir::Pool"], pool_location, os.path.basename(file)) + pool_location = utils.poolify (changes["source"], files[newfile]["component"]) + src = os.path.join(Cnf["Dir::Pool"], pool_location, os.path.basename(newfile)) if os.path.islink(dest): os.unlink(dest) os.symlink(src, dest) @@ -470,18 +494,23 @@ def install (): ################################################################################ -def stable_install (summary, short_summary): +def stable_install (summary, short_summary, fromsuite="proposed-updates"): global install_count - print "Installing to stable." + fromsuite = fromsuite.lower() + tosuite = "Stable" + if fromsuite == "oldstable-proposed-updates": + tosuite = "OldStable" + + print "Installing from %s to %s." % (fromsuite, tosuite) # Begin a transaction; if we bomb out anywhere between here and # the COMMIT WORK below, the DB won't be changed. projectB.query("BEGIN WORK") # Add the source to stable (and remove it from proposed-updates) - for file in files.keys(): - if files[file]["type"] == "dsc": + for newfile in files.keys(): + if files[newfile]["type"] == "dsc": package = dsc["source"] version = dsc["version"]; # NB: not files[file]["version"], that has no epoch q = projectB.query("SELECT id FROM source WHERE source = '%s' AND version = '%s'" % (package, version)) @@ -489,26 +518,26 @@ def stable_install (summary, short_summary): if not ql: utils.fubar("[INTERNAL ERROR] couldn't find '%s' (%s) in source table." % (package, version)) source_id = ql[0][0] - suite_id = database.get_suite_id('proposed-updates') + suite_id = database.get_suite_id(fromsuite) projectB.query("DELETE FROM src_associations WHERE suite = '%s' AND source = '%s'" % (suite_id, source_id)) - suite_id = database.get_suite_id('stable') + suite_id = database.get_suite_id(tosuite.lower()) projectB.query("INSERT INTO src_associations (suite, source) VALUES ('%s', '%s')" % (suite_id, source_id)) # Add the binaries to stable (and remove it/them from proposed-updates) - for file in files.keys(): - if files[file]["type"] == "deb": - package = files[file]["package"] - version = files[file]["version"] - architecture = files[file]["architecture"] + for newfile in files.keys(): + if files[newfile]["type"] == "deb": + package = files[newfile]["package"] + version = files[newfile]["version"] + architecture = files[newfile]["architecture"] q = projectB.query("SELECT b.id FROM binaries b, architecture a WHERE b.package = '%s' AND b.version = '%s' AND (a.arch_string = '%s' OR a.arch_string = 'all') AND b.architecture = a.id" % (package, version, architecture)) ql = q.getresult() if not ql: utils.fubar("[INTERNAL ERROR] couldn't find '%s' (%s for %s architecture) in binaries table." % (package, version, architecture)) binary_id = ql[0][0] - suite_id = database.get_suite_id('proposed-updates') + suite_id = database.get_suite_id(fromsuite) projectB.query("DELETE FROM bin_associations WHERE suite = '%s' AND bin = '%s'" % (suite_id, binary_id)) - suite_id = database.get_suite_id('stable') + suite_id = database.get_suite_id(tosuite.lower()) projectB.query("INSERT INTO bin_associations (suite, bin) VALUES ('%s', '%s')" % (suite_id, binary_id)) projectB.query("COMMIT WORK") @@ -516,20 +545,20 @@ def stable_install (summary, short_summary): utils.move (pkg.changes_file, Cnf["Dir::Morgue"] + '/process-accepted/' + os.path.basename(pkg.changes_file)) ## Update the Stable ChangeLog file - new_changelog_filename = Cnf["Dir::Root"] + Cnf["Suite::Stable::ChangeLogBase"] + ".ChangeLog" - changelog_filename = Cnf["Dir::Root"] + Cnf["Suite::Stable::ChangeLogBase"] + "ChangeLog" + new_changelog_filename = Cnf["Dir::Root"] + Cnf["Suite::%s::ChangeLogBase" % (tosuite)] + ".ChangeLog" + changelog_filename = Cnf["Dir::Root"] + Cnf["Suite::%s::ChangeLogBase" % (tosuite)] + "ChangeLog" if os.path.exists(new_changelog_filename): os.unlink (new_changelog_filename) new_changelog = utils.open_file(new_changelog_filename, 'w') - for file in files.keys(): - if files[file]["type"] == "deb": - new_changelog.write("stable/%s/binary-%s/%s\n" % (files[file]["component"], files[file]["architecture"], file)) - elif utils.re_issource.match(file): - new_changelog.write("stable/%s/source/%s\n" % (files[file]["component"], file)) + for newfile in files.keys(): + if files[newfile]["type"] == "deb": + new_changelog.write("%s/%s/binary-%s/%s\n" % (tosuite.lower(), files[newfile]["component"], files[newfile]["architecture"], newfile)) + elif re_issource.match(newfile): + new_changelog.write("%s/%s/source/%s\n" % (tosuite.lower(), files[newfile]["component"], newfile)) else: - new_changelog.write("%s\n" % (file)) - chop_changes = queue.re_fdnic.sub("\n", changes["changes"]) + new_changelog.write("%s\n" % (newfile)) + chop_changes = re_fdnic.sub("\n", changes["changes"]) new_changelog.write(chop_changes + '\n\n') if os.access(changelog_filename, os.R_OK) != 0: changelog = utils.open_file(changelog_filename) @@ -542,19 +571,19 @@ def stable_install (summary, short_summary): install_count += 1 if not Options["No-Mail"] and changes["architecture"].has_key("source"): - Subst["__SUITE__"] = " into stable" + Subst["__SUITE__"] = " into %s" % (tosuite) Subst["__SUMMARY__"] = summary mail_message = utils.TemplateSubst(Subst,Cnf["Dir::Templates"]+"/process-accepted.install") utils.send_mail(mail_message) Upload.announce(short_summary, 1) # Finally remove the .dak file - dot_dak_file = os.path.join(Cnf["Suite::Proposed-Updates::CopyDotDak"], os.path.basename(Upload.pkg.changes_file[:-8]+".dak")) + dot_dak_file = os.path.join(Cnf["Suite::%s::CopyDotDak" % (fromsuite)], os.path.basename(Upload.pkg.changes_file[:-8]+".dak")) os.unlink(dot_dak_file) ################################################################################ -def process_it (changes_file): +def process_it (changes_file, queue=""): global reject_message reject_message = "" @@ -570,7 +599,7 @@ def process_it (changes_file): if installing_to_stable: old = Upload.pkg.changes_file Upload.pkg.changes_file = os.path.basename(old) - os.chdir(Cnf["Suite::Proposed-Updates::CopyDotDak"]) + os.chdir(Cnf["Suite::%s::CopyDotDak" % (queue)]) Upload.init_vars() Upload.update_vars() @@ -580,7 +609,7 @@ def process_it (changes_file): Upload.pkg.changes_file = old check() - action() + action(queue) # Restore CWD os.chdir(pkg.directory) @@ -602,7 +631,12 @@ def main(): utils.fubar("Archive maintenance in progress. Try again later.") # If running from within proposed-updates; assume an install to stable - if os.getcwd().find('proposed-updates') != -1: + queue = "" + if os.getenv('PWD').find('oldstable-proposed-updates') != -1: + queue = "Oldstable-Proposed-Updates" + installing_to_stable = 1 + elif os.getenv('PWD').find('proposed-updates') != -1: + queue = "Proposed-Updates" installing_to_stable = 1 # Obtain lock if not in no-action mode and initialize the log @@ -632,7 +666,7 @@ def main(): # Process the changes files for changes_file in changes_files: print "\n" + changes_file - process_it (changes_file) + process_it (changes_file, queue) if install_count: sets = "set"