From: Chris Lamb Date: Wed, 28 Oct 2009 16:24:32 +0000 (+0000) Subject: Don't validate a .changes Format as a source package version format (!) X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=fd9038ac91d1ec43828ae4d0f364952aee2de181;p=dak.git Don't validate a .changes Format as a source package version format (!) Signed-off-by: Chris Lamb --- diff --git a/daklib/utils.py b/daklib/utils.py index 3305f695..b0b71c01 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -48,6 +48,7 @@ from regexes import re_html_escaping, html_escaping, re_single_line_field, \ re_gpg_uid, re_re_mark, re_whitespace_comment, re_issource, \ re_is_orig_source +from formats import parse_format, validate_changes_format from srcformats import get_format_from_string from collections import defaultdict @@ -527,9 +528,8 @@ def build_file_list(changes, is_a_dsc=0, field="files", hashname="md5sum"): if not changes.has_key(field): raise NoFilesFieldError - # Get SourceFormat object for this Format and validate it - format = get_format_from_string(changes['format']) - format.validate_format(is_a_dsc=is_a_dsc, field=field) + # Validate .changes Format: field + validate_changes_format(parse_format(changes['format']), field) includes_section = (not is_a_dsc) and field == "files" diff --git a/tests/test_srcformats.py b/tests/test_srcformats.py index 9bc0ddf2..2bd527d5 100755 --- a/tests/test_srcformats.py +++ b/tests/test_srcformats.py @@ -108,7 +108,6 @@ class FormatTreeQuiltTestCase(SourceFormatTestCase): class ValidateFormatTestCase(unittest.TestCase): def assertValid(self, format, **kwargs): - kwargs['is_a_dsc'] = kwargs.get('is_a_dsc', True) self.fmt.validate_format(format, **kwargs) def assertInvalid(self, *args, **kwargs): @@ -117,32 +116,6 @@ class ValidateFormatTestCase(unittest.TestCase): lambda: self.assertValid(*args, **kwargs), ) -class ValidateFormatOneTestCase(ValidateFormatTestCase): - fmt = srcformats.FormatOne - - def testValid(self): - self.assertValid((1, 0)) - - def testInvalid(self): - self.assertInvalid((0, 1)) - self.assertInvalid((3, 0, 'quilt')) - - ## - - def testBinary(self): - self.assertValid((1, 5), is_a_dsc=False) - self.assertInvalid((1, 0), is_a_dsc=False) - - def testRange(self): - self.assertInvalid((1, 3), is_a_dsc=False) - self.assertValid((1, 5), is_a_dsc=False) - self.assertValid((1, 8), is_a_dsc=False) - self.assertInvalid((1, 9), is_a_dsc=False) - - def testFilesField(self): - self.assertInvalid((1, 7), is_a_dsc=False, field='notfiles') - self.assertValid((1, 8), is_a_dsc=False, field='notfiles') - class ValidateFormatThreeTestCase(ValidateFormatTestCase): fmt = srcformats.FormatThree