From: James Troup Date: Tue, 13 Feb 2007 01:02:35 +0000 (+0000) Subject: [rmurray] Handle 'Source (Version)' in Source: in .changes files. X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=0262d251fd547987adf41c8e73b9f66331ade335;p=dak.git [rmurray] Handle 'Source (Version)' in Source: in .changes files. --- diff --git a/ChangeLog b/ChangeLog index 4b704de3..7e9723c3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2007-02-08 Ryan Murray + * daklib/utils.py (re_srchasver): new regex. + (parse_changes): use regex to split 'Source (Version)' style + Source fields into 'source' and 'source-version'. + * config/debian/cron.daily: use $base instead of hardcoding path name. diff --git a/daklib/utils.py b/daklib/utils.py index 527f76b0..4e048d3c 100644 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -42,6 +42,8 @@ re_taint_free = re.compile(r"^[-+~/\.\w]+$") re_parse_maintainer = re.compile(r"^\s*(\S.*\S)\s*\<([^\>]+)\>") +re_srchasver = re.compile(r"^(\S+)\s+\((\S+)\)$") + changes_parse_error_exc = "Can't parse line in .changes file" invalid_dsc_format_exc = "Invalid .dsc file" nk_format_exc = "Unknown Format: in .changes file" @@ -223,6 +225,14 @@ The rules for (signing_rules == 1)-mode are: changes_in.close() changes["filecontents"] = "".join(lines) + if changes.has_key("source"): + # Strip the source version in brackets from the source field, + # put it in the "source-version" field instead. + srcver = re_srchasver.search(changes["source"]) + if srcver: + changes["source"] = srcver.group(1) + changes["source-version"] = srcver.group(2) + if error: raise changes_parse_error_exc, error