X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fdbconn.py;h=bb7473dc08b85d4f64c0268e1faeb094c3aca786;hb=ee00ba60099f741819f991db13b4d0fc65bdd960;hp=34ec55fd97aa91b94a5c29587949e07645f37d47;hpb=a8fead1c5a9080ee18bc2438a740a81f721de046;p=dak.git diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 34ec55fd..bb7473dc 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -419,11 +419,11 @@ class DBConn(Singleton): else: row = cursor.fetchone() - if row[1] != size or row[2] != md5sum: + if row[1] != int(size) or row[2] != md5sum: res = -2 else: - self.caches[cachename].SetValue(values, row[0]) + self.caches['files'].SetValue(values, row[0]) res = row[0] return res @@ -567,11 +567,15 @@ class DBConn(Singleton): c.execute("BEGIN WORK") try: + arch_id = self.get_architecture_id(package['Architecture']) - # Remove any already existing recorded files for this package + # Remove any already existing recorded files for this package c.execute("""DELETE FROM pending_content_associations WHERE package=%(Package)s - AND version=%(Version)s""", package ) + AND version=%(Version)s + AND architecture=%(ArchID)s""", {'Package': package['Package'], + 'Version': package['Version'], + 'ArchID': arch_id}) for fullpath in fullpaths: (path, file) = os.path.split(fullpath) @@ -583,9 +587,10 @@ class DBConn(Singleton): path_id = self.get_or_set_contents_path_id(path) c.execute("""INSERT INTO pending_content_associations - (package, version, filepath, filename) - VALUES (%%(Package)s, %%(Version)s, '%d', '%d')""" % (path_id, file_id), - package ) + (package, version, architecture, filepath, filename) + VALUES (%%(Package)s, %%(Version)s, '%d', '%d', '%d')""" + % (arch_id, path_id, file_id), package ) + c.execute("COMMIT") return True except: @@ -614,7 +619,6 @@ class Suite(object): if suite is not None: db_conn = DBConn() suite_data = db_conn.get_suite(suite) - print suite_data if suite_data is not None: for k in suite_data.keys(): setattr(self, k, suite_data[k])