X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fprocess_unchecked.py;h=8f9857f411660ec286c3388e76d8e2d3d98aefb6;hb=5f6cd0951ff5658a9ad5b4eb76a2261384812dc8;hp=26b2ae55612ff85306641d89d90268218cac9f90;hpb=603d8ace7d4f942c999c29556bde38ec2516b9a8;p=dak.git diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 26b2ae55..8f9857f4 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -37,10 +37,10 @@ import shutil import stat import sys import time -import tempfile import traceback import tarfile -import apt_inst, apt_pkg +import apt_inst +import apt_pkg from debian_bundle import deb822 from daklib.dbconn import DBConn from daklib.binary import Binary @@ -144,16 +144,6 @@ def reject (str, prefix="Rejected: "): ################################################################################ -def create_tmpdir(): - """ - Create a temporary directory that can be used for unpacking files into for - checking - """ - tmpdir = tempfile.mkdtemp() - return tmpdir - -################################################################################ - def copy_to_holding(filename): global in_holding @@ -325,7 +315,7 @@ def check_distributions(): (source, dest) = args[1:3] if changes["distribution"].has_key(source): for arch in changes["architecture"].keys(): - if arch not in database.get_suite_architectures(source): + if arch not in DBConn().get_suite_architectures(source): reject("Mapping %s to %s for unreleased architecture %s." % (source, dest, arch),"") del changes["distribution"][source] changes["distribution"][dest] = 1 @@ -399,7 +389,8 @@ def check_files(): cursor = DBConn().cursor() # Check for packages that have moved from one component to another # STU: this should probably be changed to not join on architecture, suite tables but instead to used their cached name->id mappings from DBConn - cursor.execute("""PREPARE moved_pkg_q AS + DBConn().prepare("moved_pkg_q", """ + PREPARE moved_pkg_q(text,text,text) AS SELECT c.name FROM binaries b, bin_associations ba, suite s, location l, component c, architecture a, files f WHERE b.package = $1 AND s.suite_name = $2 @@ -473,7 +464,7 @@ def check_files(): default_suite = Cnf.get("Dinstall::DefaultSuite", "Unstable") architecture = control.Find("Architecture") upload_suite = changes["distribution"].keys()[0] - if architecture not in database.get_suite_architectures(default_suite) and architecture not in database.get_suite_architectures(upload_suite): + if architecture not in DBConn().get_suite_architectures(default_suite) and architecture not in DBConn().get_suite_architectures(upload_suite): reject("Unknown architecture '%s'." % (architecture)) # Ensure the architecture of the .deb is one of the ones @@ -571,7 +562,7 @@ def check_files(): # Check the version and for file overwrites reject(Upload.check_binary_against_db(f),"") - Binary(f).scan_package() + Binary(f, reject).scan_package() # Checks for a source package... else: @@ -888,7 +879,7 @@ def check_source(): or pkg.orig_tar_gz == -1: return - tmpdir = create_tmpdir() + tmpdir = utils.temp_dirname() # Move into the temporary directory cwd = os.getcwd() @@ -1329,11 +1320,11 @@ def is_stableupdate (): cursor.execute( """SELECT 1 FROM source s JOIN src_associations sa ON (s.id = sa.source) WHERE s.source = %(source)s - AND s.version = '%(version)s' - AND sa.suite = %(suite)d""", + AND s.version = %(version)s + AND sa.suite = %(suite)s""", {'source' : changes['source'], 'version' : changes['version'], - 'suite' : pasuite}) + 'suite' : pusuite}) if cursor.fetchone(): # source is already in proposed-updates so no need to hold @@ -1361,14 +1352,14 @@ def is_oldstableupdate (): if not changes["architecture"].has_key("source"): pusuite = DBConn().get_suite_id("oldstable-proposed-updates") cursor = DBConn().cursor() - cursor.execute( """"SELECT 1 FROM source s - JOIN src_associations sa ON (s.id = sa.source) - WHERE s.source = %(source)s - AND s.version = %(version)s - AND sa.suite = %d""", - {'source' : changes['source'], + cursor.execute( """SELECT 1 FROM source s + JOIN src_associations sa ON (s.id = sa.source) + WHERE s.source = %(source)s + AND s.version = %(version)s + AND sa.suite = %(suite)s""", + {'source' : changes['source'], 'version' : changes['version'], - 'suite' : pasuite}) + 'suite' : pusuite}) if cursor.fetchone(): return 0