X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=dak%2Fprocess_unchecked.py;h=0b8241e47a99cad82564bb0035c3b4c0bd403d96;hb=43c0b95eaf91b77daccded5ac32c5fa67c9d72c8;hp=c4fcf4b7e63065e91080cb5f90006404a6417eb1;hpb=195caf3ae4b2150a7234de64d0907d74f9a4c0be;p=dak.git diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index c4fcf4b7..0b8241e4 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -44,6 +44,7 @@ re_valid_pkg_name = re.compile(r"^[\dA-Za-z][\dA-Za-z\+\-\.]+$") re_changelog_versions = re.compile(r"^\w[-+0-9a-z.]+ \([^\(\) \t]+\)") re_strip_revision = re.compile(r"-([^-]+)$") re_strip_srcver = re.compile(r"\s+\(\S+\)$") +re_spacestrip = re.compile('(\s)') ################################################################################ @@ -461,6 +462,16 @@ def check_files(): if depends == '': reject("%s: Depends field is empty." % (file)) + # Sanity-check the Provides field + provides = re_spacestrip.sub('', control.Find("Provides")) + if provides == '': + reject("%s: Provides field is empty." % (file)) + prov_list = provides.split(",") + for prov in prov_list: + if not re_valid_pkg_name.match(prov): + reject("%s: Invalid Provides field content %s." % (file, prov)) + + # Check the section & priority match those given in the .changes (non-fatal) if control.Find("Section") and files[file]["section"] != "" and files[file]["section"] != control.Find("Section"): reject("%s control file lists section as `%s', but changes file has `%s'." % (file, control.Find("Section", ""), files[file]["section"]), "Warning: ") @@ -916,14 +927,32 @@ def check_hashes (): else: hashes = [] + for x in changes: + if x.startswith("checksum-"): + h = x.split("-",1)[1] + if h not in dict(hashes): + reject("Unsupported checksum field in .changes" % (h)) + + for x in dsc: + if x.startswith("checksum-"): + h = x.split("-",1)[1] + if h not in dict(hashes): + reject("Unsupported checksum field in .dsc" % (h)) + for h,f in hashes: - fs = daklib.utils.build_file_list(changes, 0, "checksums-%s" % h, h) - check_hash( ".changes %s" % (h), fs, h, f, files) + try: + fs = daklib.utils.build_file_list(changes, 0, "checksums-%s" % h, h) + check_hash(".changes %s" % (h), fs, h, f, files) + except daklib.utils.no_files_exc: + reject("No Checksums-%s: field in .changes file" % (h)) if "source" not in changes["architecture"]: continue - fs = daklib.utils.build_file_list(dsc, 1, "checksums-%s" % h, h) - check_hash( ".dsc %s" % (h), fs, h, f, dsc_files) + try: + fs = daklib.utils.build_file_list(dsc, 1, "checksums-%s" % h, h) + check_hash(".dsc %s" % (h), fs, h, f, dsc_files) + except daklib.utils.no_files_exc: + reject("No Checksums-%s: field in .changes file" % (h)) ################################################################################