X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fbinary.py;h=97e3ec0d26bb4d8c7d930555b25c7e2e159707aa;hb=28f3e6f0659504214d482d682f4b2b4791872cc6;hp=5deb4a5c0b3cb2ff4761117d3515eda06ea2bcb5;hpb=513d05b0a10846e79cba8ee93deecc68e65cdae1;p=dak.git diff --git a/daklib/binary.py b/daklib/binary.py index 5deb4a5c..97e3ec0d 100755 --- a/daklib/binary.py +++ b/daklib/binary.py @@ -53,6 +53,12 @@ from dbconn import * from config import Config import utils +################################################################################ + +__all__ = [] + +################################################################################ + class Binary(object): def __init__(self, filename, reject=None): """ @@ -66,6 +72,8 @@ class Binary(object): self.tmpdir = None self.chunks = None self.wrapped_reject = reject + # Store rejects for later use + self.rejects = [] def reject(self, message): """ @@ -73,6 +81,7 @@ class Binary(object): otherwise send it to stderr. """ print >> sys.stderr, message + self.rejects.append(message) if self.wrapped_reject: self.wrapped_reject(message) @@ -255,14 +264,16 @@ def copy_temporary_contents(package, version, archname, deb, reject, session=Non contents stored in pending_content_associations """ - # first see if contents exist: cnf = Config() + privatetrans = False if session is None: session = DBConn().session() + privatetrans = True arch = get_architecture(archname, session=session) + # first see if contents exist: in_pcaq = """SELECT 1 FROM pending_content_associations WHERE package=:package AND version=:version @@ -272,7 +283,7 @@ def copy_temporary_contents(package, version, archname, deb, reject, session=Non 'version': version, 'archid': arch.arch_id} - exists = True + exists = None check = session.execute(in_pcaq, vals) if check.rowcount > 0: @@ -289,7 +300,8 @@ def copy_temporary_contents(package, version, archname, deb, reject, session=Non message = utils.TemplateSubst(subst, cnf["Dir::Templates"]+"/missing-contents") utils.send_mail(message) - exists = Binary(deb, reject).scan_package() + # Temporarily disable contents storage until we re-do the table layout + #exists = Binary(deb, reject).scan_package() if exists: sql = """INSERT INTO content_associations(binary_pkg,filepath,filename) @@ -300,6 +312,10 @@ def copy_temporary_contents(package, version, archname, deb, reject, session=Non sql = """DELETE from pending_content_associations WHERE package=:package AND version=:version AND architecture=:archid""" session.execute(sql, vals) + session.commit() + + if privatetrans: + session.close() return exists