From ff9305976b75c18664fa05d5cd0bc0fb30d1d19a Mon Sep 17 00:00:00 2001 From: Stefano Rivera Date: Fri, 2 Dec 2011 21:33:10 +0200 Subject: [PATCH] submittodebian: Check existing bug reports before editing anything. --- debian/changelog | 1 + submittodebian | 32 +++++++++++++++++++++++++++----- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index b0db2d1..5e2e084 100644 --- a/debian/changelog +++ b/debian/changelog @@ -18,6 +18,7 @@ ubuntu-dev-tools (0.137) UNRELEASED; urgency=low * mk-sbuild, pbuilder-dist, ubuntu-build: Add armhf. * pull-debian-source, pull-lp-source: Resolve the source package (via DDE), if a binary package was requested (LP: #617349) + * submittodebian: Check existing bug reports before editing anything. [ Andreas Moog ] * sponsor-patch: Check permission to unsubscribe sponsors-team (LP: #896884) diff --git a/submittodebian b/submittodebian index f7501bb..839c57e 100755 --- a/submittodebian +++ b/submittodebian @@ -30,7 +30,7 @@ from tempfile import mkdtemp from distro_info import UbuntuDistroInfo from ubuntutools.config import ubu_email -from ubuntutools.question import YesNoQuestion, EditFile +from ubuntutools.question import YesNoQuestion, EditFile, confirmation_prompt from ubuntutools.subprocess import call, check_call, Popen, PIPE try: @@ -118,12 +118,32 @@ def check_file(fname, critical = True): def submit_bugreport(body, debdiff, deb_version, changelog): devel = UbuntuDistroInfo().devel() - cmd = ('reportbug', '-P', 'User: ubuntu-devel@lists.ubuntu.com', - '-P', 'Usertags: origin-ubuntu %s ubuntu-patch' % devel, - '-T', 'patch', '-A', debdiff, '-B', 'debian', '-i', body, - '-V', deb_version, changelog.package) + cmd = ('reportbug', + '--no-check-available', + '--no-check-installed', + '--no-query-bts', + '--pseudo-header', 'User: ubuntu-devel@lists.ubuntu.com', + '--pseudo-header', 'Usertags: origin-ubuntu %s ubuntu-patch' % devel, + '--tag', 'patch', + '--attach', debdiff, + '--bts', 'debian', + '--include', body, + '--package-version', deb_version, + changelog.package) check_call(cmd) +def check_existing_bugreports(package, deb_version): + print "Checking existing bug reports first." + print + cmd = ('reportbug', + '--no-check-available', + '--no-check-installed', + '--query-only', + '--bts', 'debian', + '--package-version', deb_version, package) + check_call(cmd) + confirmation_prompt(action='continue filing this bug') + def check_reportbug_config(): fn = os.path.expanduser('~/.reportbugrc') if os.path.exists(fn): @@ -173,6 +193,8 @@ def main(): deb_version = get_most_recent_debian_version(changelog) bug_body = get_bug_body(changelog) + check_existing_bugreports(changelog.package, deb_version) + tmpdir = mkdtemp() body = os.path.join(tmpdir, 'bug_body') fp = open(body, 'w')