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.")
sys.exit(1)
def get_most_recent_debian_version(changelog):
for block in changelog:
version = block.version.full_version
if not re.search('(ubuntu|build)', version):
return version
def get_bug_body(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 ---------------------
## 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()]))
return msg
def build_source_package():
if os.path.isdir('.bzr'):
cmd = ['bzr', 'bd', '-S', '--', '-uc', '-us', '-nc']
@ -73,6 +77,7 @@ def build_source_package():
cmd = ['debuild', '-S', '-uc', '-us', '-nc']
check_call(cmd)
def gen_debdiff(tmpdir, changelog):
pkg = changelog.package
@ -112,6 +117,7 @@ def gen_debdiff(tmpdir, changelog):
return debdiff
def check_file(fname, critical=True):
if os.path.exists(fname):
return fname
@ -121,6 +127,7 @@ def check_file(fname, critical = True):
print u"Couldn't find «%s».\n" % fname
sys.exit(1)
def submit_bugreport(body, debdiff, deb_version, changelog):
try:
devel = UbuntuDistroInfo().devel()
@ -147,7 +154,8 @@ def submit_bugreport(body, debdiff, deb_version, changelog):
'--no-check-available',
'--no-check-installed',
'--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',
'--attach', debdiff,
'--bts', 'debian',
@ -197,6 +205,7 @@ reportbug --configure for its configuration wizard.
if YesNoQuestion().ask("Continue submitting this bug", "yes") == "no":
sys.exit(1)
def main():
description = 'Submit the Ubuntu changes in a package to Debian. ' + \
'Run inside an unpacked Ubuntu source package.'