mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-20 21:31:35 +00:00
submittodebian: Make pylint happier.
This commit is contained in:
parent
53c5d801f8
commit
08042bf61f
@ -38,9 +38,9 @@ if not os.path.exists('/usr/bin/reportbug'):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
def get_most_recent_debian_version(changelog):
|
def get_most_recent_debian_version(changelog):
|
||||||
for v in changelog.get_versions():
|
for version in changelog.get_versions():
|
||||||
if not re.search('(ubuntu|build)', v.full_version):
|
if not re.search('(ubuntu|build)', version.full_version):
|
||||||
return v.full_version
|
return version.full_version
|
||||||
|
|
||||||
def get_bug_body(changelog):
|
def get_bug_body(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:
|
||||||
@ -95,7 +95,8 @@ def check_file(fname, critical = True):
|
|||||||
if os.path.exists(fname):
|
if os.path.exists(fname):
|
||||||
return fname
|
return fname
|
||||||
else:
|
else:
|
||||||
if not critical: return False
|
if not critical:
|
||||||
|
return False
|
||||||
print "Couldn't find «%s».\n" % fname
|
print "Couldn't find «%s».\n" % fname
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
@ -103,7 +104,7 @@ def edit_debdiff(debdiff):
|
|||||||
cmd = 'sensible-editor %s' % (debdiff)
|
cmd = 'sensible-editor %s' % (debdiff)
|
||||||
run_cmd(cmd)
|
run_cmd(cmd)
|
||||||
|
|
||||||
def submit_bugreport(body, debdiff, changelog):
|
def submit_bugreport(body, debdiff, deb_version, changelog):
|
||||||
cmd = ('reportbug -P "User: ubuntu-devel@lists.ubuntu.com" '
|
cmd = ('reportbug -P "User: ubuntu-devel@lists.ubuntu.com" '
|
||||||
'-P "Usertags: origin-ubuntu natty ubuntu-patch" -T patch -A %s '
|
'-P "Usertags: origin-ubuntu natty ubuntu-patch" -T patch -A %s '
|
||||||
'-B debian -i %s -V %s %s') % \
|
'-B debian -i %s -V %s %s') % \
|
||||||
@ -115,20 +116,24 @@ def run_cmd(cmd):
|
|||||||
print "%s\n" % cmd
|
print "%s\n" % cmd
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
|
|
||||||
changelog_file = (check_file('debian/changelog', critical = False) or
|
def main():
|
||||||
check_file('../debian/changelog'))
|
changelog_file = (check_file('debian/changelog', critical = False) or
|
||||||
changelog = Changelog(file(changelog_file).read())
|
check_file('../debian/changelog'))
|
||||||
|
changelog = Changelog(file(changelog_file).read())
|
||||||
|
|
||||||
deb_version = get_most_recent_debian_version(changelog)
|
deb_version = get_most_recent_debian_version(changelog)
|
||||||
bug_body = get_bug_body(changelog)
|
bug_body = get_bug_body(changelog)
|
||||||
|
|
||||||
fd, body = mkstemp()
|
fd, body = mkstemp()
|
||||||
fp = os.fdopen(fd, 'w')
|
fp = os.fdopen(fd, 'w')
|
||||||
fp.write(bug_body)
|
fp.write(bug_body)
|
||||||
fp.close()
|
fp.close()
|
||||||
|
|
||||||
debdiff = gen_debdiff(changelog)
|
debdiff = gen_debdiff(changelog)
|
||||||
edit_debdiff(debdiff)
|
edit_debdiff(debdiff)
|
||||||
submit_bugreport(body, debdiff, changelog)
|
submit_bugreport(body, debdiff, deb_version, changelog)
|
||||||
os.unlink(body)
|
os.unlink(body)
|
||||||
os.unlink(debdiff)
|
os.unlink(debdiff)
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user