From f997a3ffafcff4e591685dbad84cf85bc0a2245a Mon Sep 17 00:00:00 2001 From: Archive Administrator Date: Mon, 26 Jun 2006 18:39:39 -0700 Subject: [PATCH] ensure the Source: field in changes files is a package name. Support new dpkg optional version in the field, too. --- ChangeLog | 6 ++++++ dak/process_unchecked.py | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index fd2f9c3a..5f347bbb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-06-26 Ryan Murray + + * dak/process_unchecked.py (check_files): strip optional source version + from Source: field in changes file, and ensure what is left is a valid + package name. + 2006-06-23 Ryan Murray * dak/process_unchecked.py (check_files): also check ProposedUpdates diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index 9b1b4867..8a92e878 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -43,6 +43,7 @@ re_valid_version = re.compile(r"^([0-9]+:)?[0-9A-Za-z\.\-\+:]+$") 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+\)$") ################################################################################ @@ -202,6 +203,14 @@ def check_changes(): reject("%s: Missing mandatory field `%s'." % (filename, i)) return 0 # Avoid errors during later tests + # Strip a source version in brackets from the source field + if re_strip_srcver.search(changes["source"]): + changes["source"] = re_strip_srcver.sub('', changes["source"]) + + # Ensure the source field is a valid package name. + if not re_valid_pkg_name.match(changes["source"]): + reject("%s: invalid source name '%s'." % (filename, changes["source"])) + # Split multi-value fields into a lower-level dictionary for i in ("architecture", "distribution", "binary", "closes"): o = changes.get(i, "") -- 2.39.5