X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcheck_archive.py;h=3e537d805c1073d811c9ac9a1edbc1ed6a24885b;hb=6cfc82886d71c7436a97ddfe7a5a1dde297886d2;hp=1fb8560baaa628bb61abec14f56adce4094b50ac;hpb=d7b43e596f6aba7f096d57a9e5a2cc57aa7d976b;p=dak.git diff --git a/dak/check_archive.py b/dak/check_archive.py index 1fb8560b..3e537d80 100755 --- a/dak/check_archive.py +++ b/dak/check_archive.py @@ -72,6 +72,7 @@ The following MODEs are available: validate-indices - ensure files mentioned in Packages & Sources exist files-not-symlinks - check files in the database aren't symlinks validate-builddeps - validate build-dependencies of .dsc files in the archive + add-missing-source-checksums - add missing checksums for source packages """ sys.exit(exit_code) @@ -164,7 +165,7 @@ def check_dscs(): except CantOpenError: utils.warn("missing dsc file (%s)" % f) count += 1 - except Exception, e: + except Exception as e: utils.warn("miscellaneous error parsing dsc file (%s): %s" % (f, str(e))) count += 1 @@ -478,6 +479,17 @@ def check_build_depends(): ################################################################################ +def add_missing_source_checksums(): + """ Add missing source checksums to source_metadata """ + session = DBConn().session() + for checksum in ['Files', 'Checksums-Sha1', 'Checksums-Sha256']: + rows = session.execute('SELECT source_metadata_add_missing_checksum(:type)', {'type': checksum}).scalar() + if rows > 0: + print "Added {0} missing entries for {1}".format(rows, checksum) + session.commit() + +################################################################################ + def main (): global db_files, waste, excluded @@ -525,6 +537,8 @@ def main (): check_files_not_symlinks() elif mode == "validate-builddeps": check_build_depends() + elif mode == "add-missing-source-checksums": + add_missing_source_checksums() else: utils.warn("unknown mode '%s'" % (mode)) usage(1)