submittodebian: Style tweaks

This commit is contained in:
Stefano Rivera 2012-06-20 22:17:07 +02:00
parent 1804158370
commit 4f308cdf62

View File

@ -43,15 +43,18 @@ except ImportError:
u"which isn't currently installed.") u"which isn't currently installed.")
sys.exit(1) sys.exit(1)
def get_most_recent_debian_version(changelog): def get_most_recent_debian_version(changelog):
for block in changelog: for block in changelog:
version = block.version.full_version version = block.version.full_version
if not re.search('(ubuntu|build)', version): if not re.search('(ubuntu|build)', version):
return version return version
def get_bug_body(changelog): def get_bug_body(changelog):
entry = next(iter(changelog)) entry = next(iter(changelog))
msg = """In Ubuntu, the attached patch was applied to achieve the following: msg = """
In Ubuntu, the attached patch was applied to achieve the following:
## ---------------- REPLACE THIS WITH ACTUAL INFORMATION --------------------- ## ---------------- REPLACE THIS WITH ACTUAL INFORMATION ---------------------
## Please add all necessary information about why the change needed to go in ## Please add all necessary information about why the change needed to go in
@ -66,6 +69,7 @@ Thanks for considering the patch.
""" % ("\n".join([a for a in entry.changes()])) """ % ("\n".join([a for a in entry.changes()]))
return msg return msg
def build_source_package(): def build_source_package():
if os.path.isdir('.bzr'): if os.path.isdir('.bzr'):
cmd = ['bzr', 'bd', '-S', '--', '-uc', '-us', '-nc'] cmd = ['bzr', 'bd', '-S', '--', '-uc', '-us', '-nc']
@ -73,6 +77,7 @@ def build_source_package():
cmd = ['debuild', '-S', '-uc', '-us', '-nc'] cmd = ['debuild', '-S', '-uc', '-us', '-nc']
check_call(cmd) check_call(cmd)
def gen_debdiff(tmpdir, changelog): def gen_debdiff(tmpdir, changelog):
pkg = changelog.package pkg = changelog.package
@ -112,6 +117,7 @@ def gen_debdiff(tmpdir, changelog):
return debdiff return debdiff
def check_file(fname, critical=True): def check_file(fname, critical=True):
if os.path.exists(fname): if os.path.exists(fname):
return fname return fname
@ -121,6 +127,7 @@ def check_file(fname, critical = True):
print u"Couldn't find «%s».\n" % fname print u"Couldn't find «%s».\n" % fname
sys.exit(1) sys.exit(1)
def submit_bugreport(body, debdiff, deb_version, changelog): def submit_bugreport(body, debdiff, deb_version, changelog):
try: try:
devel = UbuntuDistroInfo().devel() devel = UbuntuDistroInfo().devel()
@ -147,7 +154,8 @@ def submit_bugreport(body, debdiff, deb_version, changelog):
'--no-check-available', '--no-check-available',
'--no-check-installed', '--no-check-installed',
'--pseudo-header', 'User: ubuntu-devel@lists.ubuntu.com', '--pseudo-header', 'User: ubuntu-devel@lists.ubuntu.com',
'--pseudo-header', 'Usertags: origin-ubuntu %s ubuntu-patch' % devel, '--pseudo-header', 'Usertags: origin-ubuntu %s ubuntu-patch'
% devel,
'--tag', 'patch', '--tag', 'patch',
'--attach', debdiff, '--attach', debdiff,
'--bts', 'debian', '--bts', 'debian',
@ -197,6 +205,7 @@ reportbug --configure for its configuration wizard.
if YesNoQuestion().ask("Continue submitting this bug", "yes") == "no": if YesNoQuestion().ask("Continue submitting this bug", "yes") == "no":
sys.exit(1) sys.exit(1)
def main(): def main():
description = 'Submit the Ubuntu changes in a package to Debian. ' + \ description = 'Submit the Ubuntu changes in a package to Debian. ' + \
'Run inside an unpacked Ubuntu source package.' 'Run inside an unpacked Ubuntu source package.'