X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=fernanda.py;h=be6d767a168fb3eef59ce0b80ba8403d7e32b342;hb=dd0ee5b67c650470139ffa8a50ae6b83a92ca76a;hp=81704dca726c0ff4dadf234ce3b659d8733ec3be;hpb=da5e3dbaaac033dd1f6661b13db503cec795e659;p=dak.git diff --git a/fernanda.py b/fernanda.py index 81704dca..be6d767a 100755 --- a/fernanda.py +++ b/fernanda.py @@ -1,8 +1,8 @@ #!/usr/bin/env python # Script to automate some parts of checking NEW packages -# Copyright (C) 2000, 2001, 2002 James Troup -# $Id: fernanda.py,v 1.8 2002-11-26 16:15:54 troup Exp $ +# Copyright (C) 2000, 2001, 2002, 2003 James Troup +# $Id: fernanda.py,v 1.10 2003-11-10 23:01:17 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 @@ -180,7 +180,7 @@ def read_control (filename): else : # main section = main_colour + section_str + end_colour - if control.has_key("Achitecture"): + if control.has_key("Architecture"): arch_str = control.Find("Architecture") arch = arch_colour + arch_str + end_colour @@ -203,7 +203,7 @@ def read_dsc (dsc_filename): print "can't parse control info" dsc_file.close(); - filecontents = dsc["filecontents"]; + filecontents = strip_pgp_signature(dsc_filename); if dsc.has_key("build-depends"): builddep = split_depends(dsc["build-depends"]); @@ -344,13 +344,38 @@ def check_deb (deb_filename): print "---- file listing of %s ----" % (filename); do_command ("ls -l", deb_filename); -def display_changes (changes_filename): - print "---- .changes file for %s ----" % (changes_filename); - file = utils.open_file (changes_filename); +# Read a file, strip the signature and return the modified contents as +# a string. +def strip_pgp_signature (filename): + file = utils.open_file (filename); + contents = ""; + inside_signature = 0; + skip_next = 0; for line in file.readlines(): - print line[:-1] - print ; + if line[:-1] == "": + continue; + if inside_signature: + continue; + if skip_next: + skip_next = 0; + continue; + if line.startswith("-----BEGIN PGP SIGNED MESSAGE"): + skip_next = 1; + continue; + if line.startswith("-----BEGIN PGP SIGNATURE"): + inside_signature = 1; + continue; + if line.startswith("-----END PGP SIGNATURE"): + inside_signature = 0; + continue; + contents += line; file.close(); + return contents; + +# Display the .changes [without the signature] +def display_changes (changes_filename): + print "---- .changes file for %s ----" % (changes_filename); + print strip_pgp_signature(changes_filename); def check_changes (changes_filename): display_changes(changes_filename);