# 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")
- # Check the hashes are all present: HACK: Can go away once all dak files
- # are known to be newer than the shasum changes
- utils.ensure_hashes(changes, dsc, files, dsc_files)
+ # 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 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"])
+ files[file]["files id"] = database.set_files_id (filename, files[file]["size"], files[file]["md5sum"], files[file]["sha1sum"], files[file]["sha256sum"], files[file]["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)"