From 29f1538d90a3b0943ff1ab942914e1221c9fd2de Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Fri, 9 Sep 2011 21:46:18 +0200 Subject: [PATCH] ubuntutools.update_maintainer: Don't use strict changelog parsing (LP: #806633) --- debian/changelog | 2 ++ ubuntutools/update_maintainer.py | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 4457e3d..2e9368f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,8 @@ ubuntu-dev-tools (0.131) UNRELEASED; urgency=low simple assertions (LP: #537288) * submittodebian: Don't parse the entire changelog, to avoid bumping into past illegal version numbers (LP: #727314) + * ubuntutools.update_maintainer: Don't use strict changelog parsing + (LP: #806633) [ Colin Watson ] * syncpackage: Fix typo. diff --git a/ubuntutools/update_maintainer.py b/ubuntutools/update_maintainer.py index 5eee5f9..4e25ee5 100644 --- a/ubuntutools/update_maintainer.py +++ b/ubuntutools/update_maintainer.py @@ -20,7 +20,6 @@ import os import re import debian.changelog - from devscripts.logger import Logger # Prior May 2009 these Maintainers were used: @@ -83,8 +82,11 @@ class Control(object): def _get_distribution(changelog_file): """get distribution of latest changelog entry""" - changelog = debian.changelog.Changelog(open(changelog_file)) - return changelog.distributions + with open(changelog_file) as f: + changelog = debian.changelog.Changelog(f, strict=False, max_blocks=1) + distribution = changelog.distributions[0] + # Strip things like "-proposed-updates" or "-security" from distribution + return distribution.split("-", 1)[0] def update_maintainer(debian_directory, verbose=False): """updates the Maintainer field of an Ubuntu package @@ -120,8 +122,7 @@ def update_maintainer(debian_directory, verbose=False): print "XSBC-Original is managed by 'rules' file. Doing nothing." return(0) - # Strip things like "-proposed-updates" or "-security" from distribution. - distribution = _get_distribution(changelog_file).split("-")[0] + distribution = _get_distribution(changelog_file) for control_file in control_files: control = Control(control_file)