submittodebian: Write a usable .reportbugrc if it doesn't exist.

(LP: #800429)
This commit is contained in:
Stefano Rivera 2011-06-22 12:15:57 +02:00
parent 814fba1ade
commit dd46215fbe
2 changed files with 44 additions and 0 deletions

2
debian/changelog vendored
View File

@ -10,6 +10,8 @@ ubuntu-dev-tools (0.125) UNRELEASED; urgency=low
guessing at the cause. (LP: #788447)
* sponsor-patch: Use dch --release instead of --edit to work with
DEBCHANGE_RELEASE_HEURISTIC=changelog.
* submittodebian: Write a usable .reportbugrc if it doesn't exist.
(LP: #800429)
[ Dustin Kirkland ]
* doc/lp-project-upload.1, lp-project-upload:

View File

@ -25,6 +25,8 @@
import re, os, sys
from tempfile import mkstemp
from ubuntutools.config import ubu_email
from ubuntutools.question import YesNoQuestion
from ubuntutools.distro_info import UbuntuDistroInfo
try:
@ -119,7 +121,47 @@ def run_cmd(cmd):
print "%s\n" % cmd
os.system(cmd)
def check_reportbug_config():
fn = os.path.expanduser('~/.reportbugrc')
if os.path.exists(fn):
return
email = ubu_email()[1]
reportbugrc = """# Reportbug configuration generated by submittodebian(1)
# See reportbug.conf(5) for the configuration file format.
# Use Debian's reportbug SMTP Server:
# Note: it's limited to 5 connections per hour, and cannot CC you at submission
# time. See /usr/share/doc/reportbug/README.Users.gz for more details.
smtphost reportbug.debian.org:587
header "X-Debbugs-CC: %s"
no-cc
# Use GMail's SMTP Server:
#smtphost smtp.googlemail.com:587
#smtpuser "<your address>@gmail.com"
#smtptls
""" % email
with file(fn, 'w') as f:
f.write(reportbugrc)
print """You have not configured reportbug. Assuming this is the first time you have used it.
Writing a ~/.reportbugrc that will use Debian's mailserver, and CC the bug to
you at <%s>
--- Generated ~/.reportbugrc ---
%s
--- End of ~/.reportbugrc ---
If this is not correct, please exit now and edit ~/.reportbugrc or run
reportbug --configure for its configuration wizard.
""" % (email, reportbugrc.strip())
if YesNoQuestion().ask("Continue submitting this bug?", "yes") == "no":
sys.exit(1)
def main():
check_reportbug_config()
changelog_file = (check_file('debian/changelog', critical = False) or
check_file('../debian/changelog'))
changelog = Changelog(file(changelog_file).read())