X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fcheck_archive.py;h=aed2a8a88ec792c02df91f2664defd5fe689240f;hb=96e09c76fb2c4a3f445d85f20799a261e22579a7;hp=10765a89e4d77470fb0d3b2bf489a1f7764858ad;hpb=3fd49b3537079afc226a219cfbe1f807423f92c2;p=dak.git diff --git a/dak/check_archive.py b/dak/check_archive.py index 10765a89..aed2a8a8 100755 --- a/dak/check_archive.py +++ b/dak/check_archive.py @@ -32,7 +32,6 @@ import commands import os -import pg import stat import sys import time @@ -41,7 +40,6 @@ import apt_inst from daklib.dbconn import * from daklib import utils -from daklib.regexes import re_issource from daklib.config import Config ################################################################################ @@ -69,7 +67,7 @@ The following MODEs are available: missing-overrides - check for missing overrides source-in-one-dir - ensure the source for each package is in one directory timestamps - check for future timestamps in .deb's - tar-gz-in-dsc - ensure each .dsc lists a .tar.gz file + files-in-dsc - ensure each .dsc references appropriate Files 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 @@ -187,14 +185,14 @@ def check_override(): print suite_name print "-" * len(suite_name) print - suite = get_suite(suite) + suite = get_suite(suite_name) q = s.execute(""" SELECT DISTINCT b.package FROM binaries b, bin_associations ba WHERE b.id = ba.bin AND ba.suite = :suiteid AND NOT EXISTS (SELECT 1 FROM override o WHERE o.suite = :suiteid AND o.package = b.package)""" % {'suiteid': suite.suite_id}) - for j in q: + for j in q.fetchall(): print j[0] q = s.execute(""" @@ -202,7 +200,7 @@ SELECT DISTINCT s.source FROM source s, src_associations sa WHERE s.id = sa.source AND sa.suite = :suiteid AND NOT EXISTS (SELECT 1 FROM override o WHERE o.suite = :suiteid and o.package = s.source)""" % {'suiteid': suite.suite_id}) - for j in q: + for j in q.fetchall(): print j[0] ################################################################################ @@ -321,9 +319,10 @@ def check_timestamps(): ################################################################################ -def check_missing_tar_gz_in_dsc(): +def check_files_in_dsc(): """ - Ensure each .dsc lists a .tar.gz file + Ensure each .dsc lists appropriate files in its Files field (according + to the format announced in its Format field). """ count = 0 @@ -344,19 +343,11 @@ def check_missing_tar_gz_in_dsc(): except: utils.fubar("error parsing .dsc file '%s'." % (filename)) - dsc_files = utils.build_file_list(dsc, is_a_dsc=1) - has_tar = 0 + reasons = utils.check_dsc_files(filename, dsc) + for r in reasons: + utils.warn(r) - for f in dsc_files.keys(): - m = re_issource.match(f) - if not m: - utils.fubar("%s not recognised as source." % (f)) - ftype = m.group(3) - if ftype == "orig.tar.gz" or ftype == "tar.gz": - has_tar = 1 - - if not has_tar: - utils.warn("%s has no .tar.gz in the .dsc file." % (f)) + if len(reasons) > 0: count += 1 if count: @@ -527,8 +518,8 @@ def main (): check_source_in_one_dir() elif mode == "timestamps": check_timestamps() - elif mode == "tar-gz-in-dsc": - check_missing_tar_gz_in_dsc() + elif mode == "files-in-dsc": + check_files_in_dsc() elif mode == "validate-indices": check_indices_files_exist() elif mode == "files-not-symlinks":