From 1cff7f516673745e26edde571dd683abac9fe176 Mon Sep 17 00:00:00 2001 From: James Troup Date: Thu, 17 May 2001 01:17:54 +0000 Subject: [PATCH] fix parsing of multi-line fields in .changes. --- test/003/krb5_1.2.2-4_m68k.changes | 54 +++++++++++++++++++++++ test/003/test.py | 69 ++++++++++++++++++++++++++++++ utils.py | 6 ++- 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 test/003/krb5_1.2.2-4_m68k.changes create mode 100755 test/003/test.py diff --git a/test/003/krb5_1.2.2-4_m68k.changes b/test/003/krb5_1.2.2-4_m68k.changes new file mode 100644 index 00000000..9d264c10 --- /dev/null +++ b/test/003/krb5_1.2.2-4_m68k.changes @@ -0,0 +1,54 @@ +-----BEGIN PGP SIGNED MESSAGE----- + +Format: 1.7 +Date: Fri, 20 Apr 2001 02:47:21 -0400 +Source: krb5 +Binary: krb5-kdc krb5-doc krb5-rsh-server libkrb5-dev libkrb53 krb5-ftpd + krb5-clients krb5-user libkadm54 krb5-telnetd krb5-admin-server +Architecture: m68k +Version: 1.2.2-4 +Distribution: unstable +Urgency: low +Maintainer: buildd m68k user account +Changed-By: Sam Hartman +Description: + krb5-admin-server - Mit Kerberos master server (kadmind) + krb5-clients - Secure replacements for ftp, telnet and rsh using MIT Kerberos + krb5-ftpd - Secure FTP server supporting MIT Kerberos + krb5-kdc - Mit Kerberos key server (KDC) + krb5-rsh-server - Secure replacements for rshd and rlogind using MIT Kerberos + krb5-telnetd - Secure telnet server supporting MIT Kerberos + krb5-user - Basic programs to authenticate using MIT Kerberos + libkadm54 - MIT Kerberos administration runtime libraries + libkrb5-dev - Headers and development libraries for MIT Kerberos + libkrb53 - MIT Kerberos runtime libraries +Closes: 94407 +Changes: + krb5 (1.2.2-4) unstable; urgency=low + . + * Fix shared libraries to build with gcc not ld to properly include + -lgcc symbols, closes: #94407 +Files: + 563dac1cdd3ba922f9301fe074fbfc80 65836 non-us/main optional libkadm54_1.2.2-4_m68k.deb + bb620f589c17ab0ebea1aa6e10ca52ad 272198 non-us/main optional libkrb53_1.2.2-4_m68k.deb + 40af6e64b3030a179e0de25bd95c95e9 143264 non-us/main optional krb5-user_1.2.2-4_m68k.deb + ffe4e5e7b2cab162dc608d56278276cf 141870 non-us/main optional krb5-clients_1.2.2-4_m68k.deb + 4fe01d1acb4b82ce0b8b72652a9a15ae 54592 non-us/main optional krb5-rsh-server_1.2.2-4_m68k.deb + b3c8c617ea72008a33b869b75d2485bf 41292 non-us/main optional krb5-ftpd_1.2.2-4_m68k.deb + 5908f8f60fe536d7bfc1ef3fdd9d74cc 42090 non-us/main optional krb5-telnetd_1.2.2-4_m68k.deb + 650ea769009a312396e56503d0059ebc 160236 non-us/main optional krb5-kdc_1.2.2-4_m68k.deb + 399c9de4e9d7d0b0f5626793808a4391 160392 non-us/main optional krb5-admin-server_1.2.2-4_m68k.deb + 6f962fe530c3187e986268b4e4d27de9 398662 non-us/main optional libkrb5-dev_1.2.2-4_m68k.deb + +-----BEGIN PGP SIGNATURE----- +Version: 2.6.3i +Charset: noconv + +iQCVAwUBOvVPPm547I3m3eHJAQHyaQP+M7RXVEqZ2/xHiPzaPcZRJ4q7o0zbMaU8 +qG/Mi6kuR1EhRNMjMH4Cp6ctbhRDHK5FR/8v7UkOd+ETDAhiw7eqJnLC60EZxZ/H +CiOs8JklAXDERkQ3i7EYybv46Gxx91pIs2nE4xVKnG16d/wFELWMBLY6skF1B2/g +zZju3cuFCCE= +=Vm59 +-----END PGP SIGNATURE----- + + diff --git a/test/003/test.py b/test/003/test.py new file mode 100755 index 00000000..c1d1c334 --- /dev/null +++ b/test/003/test.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python + +# Check utils.parse_changes()'s for handling of multi-line fields +# Copyright (C) 2000 James Troup +# $Id: test.py,v 1.1 2001-05-17 01:17:54 troup Exp $ + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + +################################################################################ + +# The deal here is that for the first 6 months of katie's +# implementation it has been misparsing multi-line fields in .changes +# files; specifically multi-line fields where there _is_ data on the +# first line. So, for example: + +# Foo: bar baz +# bat bant + +# Became "foo: bar bazbat bant" rather than "foo: bar baz\nbat bant" + +################################################################################ + +import os, string, sys + +sys.path.append(os.path.abspath('../../')); + +import utils + +################################################################################ + +def fail(message): + sys.stderr.write("%s\n" % (message)); + sys.exit(1); + +################################################################################ + +def main (): + # Valid .changes file with a multi-line Binary: field + try: + changes = utils.parse_changes('krb5_1.2.2-4_m68k.changes', 0) + except utils.changes_parse_error_exc, line: + fail("parse_changes() returned an exception with error message `%s'." % (line)); + + o = changes.get("binary", "") + if o != "": + del changes["binary"] + changes["binary"] = {} + for j in string.split(o): + changes["binary"][j] = 1 + + if not changes["binary"].has_key("krb5-ftpd"): + fail("parse_changes() is broken; 'krb5-ftpd' is not in the Binary: dictionary."); + +################################################################################ + +if __name__ == '__main__': + main() diff --git a/utils.py b/utils.py index 11f0c475..33b77805 100644 --- a/utils.py +++ b/utils.py @@ -1,6 +1,6 @@ # Utility functions # Copyright (C) 2000 James Troup -# $Id: utils.py,v 1.21 2001-04-13 20:11:20 troup Exp $ +# $Id: utils.py,v 1.22 2001-05-17 01:17:54 troup Exp $ # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -148,6 +148,7 @@ def parse_changes(filename, dsc_whitespace_rules): if slf: field = string.lower(slf.groups()[0]); changes[field] = slf.groups()[1]; + first = 1; continue; mld = re.match(r'^ \.$', line); if mld: @@ -155,6 +156,9 @@ def parse_changes(filename, dsc_whitespace_rules): continue; mlf = re.match(r'^\s(.*)', line); if mlf: + if first == 1 and changes[field] != "": + changes[field] = changes[field] + '\n'; + first = 0; changes[field] = changes[field] + mlf.groups()[0] + '\n'; continue; error = error + line; -- 2.39.5