X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Fformats.py;h=aaad2715aac119bd40766d1cef333f9cf2df36df;hb=f0c875ddc69f384bf2600fa342fbac30dc82fda7;hp=e8ab1d77d205f85db14ee80ea2cd5173e7ce8b3f;hpb=8c266683b16ad4f1ddcf2cc48cc7931ac007af59;p=dak.git diff --git a/daklib/formats.py b/daklib/formats.py index e8ab1d77..aaad2715 100644 --- a/daklib/formats.py +++ b/daklib/formats.py @@ -30,3 +30,16 @@ def parse_format(txt): format = format[:2] return format + +def validate_changes_format(format, field): + """ + Validate a tuple-representation of a .changes Format: field. Raises + UnknownFormatError if the field is invalid, otherwise return type is + undefined. + """ + + if (format < (1, 5) or format > (1, 8)): + raise UnknownFormatError, repr(format) + + if field != 'files' and format < (1, 8): + raise UnknownFormatError, repr(format)