X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;ds=inline;f=utils.py;h=2b40501cfac2bf6e59298578800cbf7a1a7a45e5;hb=156a0cb3726a88995d4ef275002d741689dfb84c;hp=59d5fe5018ddb5f188eefca76426eaae845ba45b;hpb=63d91e6f17acde90e48b639316b6ada7267fd759;p=dak.git diff --git a/utils.py b/utils.py index 59d5fe50..2b40501c 100644 --- a/utils.py +++ b/utils.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Utility functions -# Copyright (C) 2000, 2001, 2002, 2003 James Troup -# $Id: utils.py,v 1.59 2003-09-24 00:13:43 troup Exp $ +# Copyright (C) 2000, 2001, 2002, 2003, 2004 James Troup +# $Id: utils.py,v 1.61 2004-01-21 03:20:52 troup Exp $ ################################################################################ @@ -155,16 +155,16 @@ def parse_changes(filename, dsc_whitespace_rules=0): inside_signature = 0; - indices = indexed_lines.keys() + num_of_lines = len(indexed_lines.keys()); index = 0; first = -1; - while index < max(indices): + while index < num_of_lines: index += 1; line = indexed_lines[index]; if line == "": if dsc_whitespace_rules: index += 1; - if index > max(indices): + if index > num_of_lines: raise invalid_dsc_format_exc, index; line = indexed_lines[index]; if not line.startswith("-----BEGIN PGP SIGNATURE"): @@ -178,10 +178,13 @@ def parse_changes(filename, dsc_whitespace_rules=0): if line.startswith("-----BEGIN PGP SIGNED MESSAGE"): if dsc_whitespace_rules: inside_signature = 1; - while index < max(indices) and line != "": + while index < num_of_lines and line != "": index += 1; line = indexed_lines[index]; continue; + # If we're not inside the signed data, don't process anything + if not inside_signature: + continue; slf = re_single_line_field.match(line); if slf: field = slf.groups()[0].lower();