X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcheck_archive.py;h=89c3dcbd82d690141e01bc2c05d981d8f5f99b72;hb=1c2f5f4048b36efb345a3aa96b20d60dc7af1990;hp=a88f8ebaaacbcf99a9d705b1c233af2a4d0a93cf;hpb=0872b2e0b78670c91fd2bf0bda52e5761e079820;p=dak.git diff --git a/dak/check_archive.py b/dak/check_archive.py index a88f8eba..89c3dcbd 100755 --- a/dak/check_archive.py +++ b/dak/check_archive.py @@ -41,6 +41,7 @@ import apt_inst from daklib.dbconn import * from daklib import utils from daklib.config import Config +from daklib.dak_exceptions import InvalidDscError, ChangesUnicodeError, CantOpenError ################################################################################ @@ -148,26 +149,24 @@ def check_dscs(): Parse every .dsc file in the archive and check for it's validity. """ - cnf = Config() - count = 0 - suite = 'unstable' - - for component in cnf.SubTree("Component").List(): - component = component.lower() - list_filename = '%s%s_%s_source.list' % (cnf["Dir::Lists"], suite, component) - list_file = utils.open_file(list_filename) - - for line in list_file.readlines(): - f = line[:-1] - try: - utils.parse_changes(f, signing_rules=1, dsc_file=1) - except InvalidDscError, line: - utils.warn("syntax error in .dsc file '%s', line %s." % (f, line)) - count += 1 - except ChangesUnicodeError: - utils.warn("found invalid changes file, not properly utf-8 encoded") - count += 1 + + for src in DBConn().session().query(DBSource).order_by(DBSource.source, DBSource.version): + f = src.poolfile.fullpath + try: + utils.parse_changes(f, signing_rules=1, dsc_file=1) + except InvalidDscError: + utils.warn("syntax error in .dsc file %s" % f) + count += 1 + except ChangesUnicodeError: + utils.warn("found invalid dsc file (%s), not properly utf-8 encoded" % f) + count += 1 + except CantOpenError: + utils.warn("missing dsc file (%s)" % f) + count += 1 + except Exception as e: + utils.warn("miscellaneous error parsing dsc file (%s): %s" % (f, str(e))) + count += 1 if count: utils.warn("Found %s invalid .dsc files." % (count)) @@ -425,7 +424,7 @@ def check_indices_files_exist(): Ensure files mentioned in Packages & Sources exist """ for suite in [ "stable", "testing", "unstable" ]: - for component in Cnf.ValueList("Suite::%s::Components" % (suite)): + for component in get_component_names(): architectures = get_suite_architectures(suite) for arch in [ i.arch_string.lower() for i in architectures ]: if arch == "source":