mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-06-25 15:11:29 +00:00
Merge with Daniel Hahler's changes.
This commit is contained in:
commit
5b776a3b65
11
debian/changelog
vendored
11
debian/changelog
vendored
@ -1,9 +1,18 @@
|
|||||||
ubuntu-dev-tools (0.26) UNRELEASED; urgency=low
|
ubuntu-dev-tools (0.26) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
[ Stephan Hermann ]
|
||||||
* pbuild-dist: fixed a bug with the *sudo call.
|
* pbuild-dist: fixed a bug with the *sudo call.
|
||||||
changed from $SUDOREPLACE "pbuilder" to $SUDOREPLACE -- pbuilder ...
|
changed from $SUDOREPLACE "pbuilder" to $SUDOREPLACE -- pbuilder ...
|
||||||
|
|
||||||
-- Stephan Hermann <sh@sourcecode.de> Wed, 23 Jan 2008 20:21:42 +0100
|
[ Daniel Hahler ]
|
||||||
|
* requestsync:
|
||||||
|
* If interaction is required (for an explanation to drop the Ubuntu
|
||||||
|
changes), edit the report in the sensible-editor.
|
||||||
|
When interaction is not required, ask the user if she wants to edit.
|
||||||
|
(LP: #190351)
|
||||||
|
* Exit, if versions in Ubuntu and Debian are the same already.
|
||||||
|
|
||||||
|
-- Daniel Hahler <ubuntu@thequod.de> Sat, 09 Feb 2008 02:23:44 +0100
|
||||||
|
|
||||||
ubuntu-dev-tools (0.25) hardy; urgency=low
|
ubuntu-dev-tools (0.25) hardy; urgency=low
|
||||||
|
|
||||||
|
104
requestsync
104
requestsync
@ -9,7 +9,7 @@
|
|||||||
#
|
#
|
||||||
# License: GPLv2, see /usr/share/common-licenses/GPL
|
# License: GPLv2, see /usr/share/common-licenses/GPL
|
||||||
|
|
||||||
import os, sys, urllib, subprocess, getopt, readline
|
import os, sys, urllib, subprocess, getopt
|
||||||
|
|
||||||
def cur_version_component(sourcepkg, release):
|
def cur_version_component(sourcepkg, release):
|
||||||
'''Determine current package version in ubuntu.'''
|
'''Determine current package version in ubuntu.'''
|
||||||
@ -19,11 +19,11 @@ def cur_version_component(sourcepkg, release):
|
|||||||
assert (madison.returncode == 0)
|
assert (madison.returncode == 0)
|
||||||
|
|
||||||
for l in out.splitlines():
|
for l in out.splitlines():
|
||||||
(pkg, version, rel, builds) = l.split('|')
|
(pkg, version, rel, builds) = l.split('|')
|
||||||
component = 'main'
|
component = 'main'
|
||||||
if rel.find('/') != -1:
|
if rel.find('/') != -1:
|
||||||
component = rel.split('/')[1]
|
component = rel.split('/')[1]
|
||||||
return (version.strip(), component.strip())
|
return (version.strip(), component.strip())
|
||||||
|
|
||||||
print "%s doesn't appear to exist in %s, specify -n for a package not in Ubuntu." % (sourcepkg, release)
|
print "%s doesn't appear to exist in %s, specify -n for a package not in Ubuntu." % (sourcepkg, release)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -83,6 +83,14 @@ def debian_component(sourcepkg):
|
|||||||
component = raw_comp[1].strip()
|
component = raw_comp[1].strip()
|
||||||
return component
|
return component
|
||||||
|
|
||||||
|
def wait_for_enter_or_exit():
|
||||||
|
"""Helper function to wait for ENTER and catch Control-C for abortion."""
|
||||||
|
try:
|
||||||
|
raw_input()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print 'Abort requested. No sync request filed.'
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print '''Usage: requestsync [-h|-n|-s|-k <keyid>|--lp] <source package> <target release> [basever]
|
print '''Usage: requestsync [-h|-n|-s|-k <keyid>|--lp] <source package> <target release> [basever]
|
||||||
|
|
||||||
@ -138,12 +146,8 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None)
|
|||||||
|
|
||||||
print mail
|
print mail
|
||||||
|
|
||||||
print 'Press enter to file this bug, Control-C to abort.'
|
print 'Press ENTER to file this bug, Control-C to abort.'
|
||||||
try:
|
wait_for_enter_or_exit()
|
||||||
raw_input()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print 'Abort requested. No sync request filed.'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# get server address
|
# get server address
|
||||||
mailserver = os.getenv('DEBSMTP')
|
mailserver = os.getenv('DEBSMTP')
|
||||||
@ -167,7 +171,7 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None)
|
|||||||
mailserver_pass = os.getenv('DEBSMTP_PASS')
|
mailserver_pass = os.getenv('DEBSMTP_PASS')
|
||||||
if mailserver_user and mailserver_pass:
|
if mailserver_user and mailserver_pass:
|
||||||
try:
|
try:
|
||||||
s.login(mailserver_user, mailserver_pass)
|
s.login(mailserver_user, mailserver_pass)
|
||||||
except smtplib.SMTPAuthenticationError:
|
except smtplib.SMTPAuthenticationError:
|
||||||
print 'Error authenticating to the server: invalid username and password.'
|
print 'Error authenticating to the server: invalid username and password.'
|
||||||
s.quit()
|
s.quit()
|
||||||
@ -183,7 +187,7 @@ def mail_bug(source_package, subscribe, status, bugtitle, bugtext, keyid = None)
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def post_bug(source_package, subscibe, status, bugtitle, bugtext):
|
def post_bug(source_package, subscribe, status, bugtitle, bugtext):
|
||||||
'''Use python-launchpad-bugs to submit the sync request.
|
'''Use python-launchpad-bugs to submit the sync request.
|
||||||
Return True if email successfully send, otherwise False.'''
|
Return True if email successfully send, otherwise False.'''
|
||||||
|
|
||||||
@ -207,16 +211,12 @@ def post_bug(source_package, subscibe, status, bugtitle, bugtext):
|
|||||||
product = {'name': source_package, 'target': 'ubuntu'}
|
product = {'name': source_package, 'target': 'ubuntu'}
|
||||||
else:
|
else:
|
||||||
# new source package
|
# new source package
|
||||||
product = {'name': 'ubuntu'}
|
product = {'name': 'ubuntu'}
|
||||||
|
|
||||||
print 'Summary:\n%s\n\nDescription:\n%s' % (bugtitle, bugtext)
|
print 'Summary:\n%s\n\nDescription:\n%s' % (bugtitle, bugtext)
|
||||||
|
|
||||||
print 'Press enter to file this bug, Control-C to abort.'
|
print 'Press ENTER to file this bug, Control-C to abort.'
|
||||||
try:
|
wait_for_enter_or_exit()
|
||||||
raw_input()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print 'Abort requested. No sync request filed.'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
# Create bug
|
# Create bug
|
||||||
Bug = launchpadbugs.connector.ConnectBug()
|
Bug = launchpadbugs.connector.ConnectBug()
|
||||||
@ -241,6 +241,8 @@ if __name__ == '__main__':
|
|||||||
sponsorship = False
|
sponsorship = False
|
||||||
keyid = None
|
keyid = None
|
||||||
use_lp_bugs = False
|
use_lp_bugs = False
|
||||||
|
need_interaction = False
|
||||||
|
edit_report = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnsk:', ('lp'))
|
opts, args = getopt.gnu_getopt(sys.argv[1:], 'hnsk:', ('lp'))
|
||||||
@ -267,6 +269,10 @@ if __name__ == '__main__':
|
|||||||
debiancomponent = debian_component(srcpkg)
|
debiancomponent = debian_component(srcpkg)
|
||||||
deb_version = cur_deb_version(srcpkg)
|
deb_version = cur_deb_version(srcpkg)
|
||||||
|
|
||||||
|
if deb_version == cur_ver:
|
||||||
|
print 'The versions in Debian and Ubuntu are the same already (%s). Aborting.' % (deb_version,)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# generate bug report
|
# generate bug report
|
||||||
subscribe = 'ubuntu-archive'
|
subscribe = 'ubuntu-archive'
|
||||||
status = 'confirmed'
|
status = 'confirmed'
|
||||||
@ -277,24 +283,21 @@ if __name__ == '__main__':
|
|||||||
else:
|
else:
|
||||||
subscribe = 'ubuntu-universe-sponsors'
|
subscribe = 'ubuntu-universe-sponsors'
|
||||||
|
|
||||||
report = '''Please sync %s %s (%s) from Debian unstable (%s).
|
report = 'Please sync %s %s (%s) from Debian unstable (%s).\n\n' % (srcpkg, deb_version, component, debiancomponent)
|
||||||
''' % (srcpkg, deb_version, component, debiancomponent)
|
|
||||||
title = report[:-2]
|
title = report[:-2]
|
||||||
|
|
||||||
base_ver = cur_ver
|
base_ver = cur_ver
|
||||||
uidx = base_ver.find('ubuntu')
|
uidx = base_ver.find('ubuntu')
|
||||||
if uidx > 0:
|
if uidx > 0:
|
||||||
base_ver = base_ver[:uidx]
|
base_ver = base_ver[:uidx]
|
||||||
|
need_interaction = True
|
||||||
|
|
||||||
print 'Explanation of the Ubuntu delta and why it can be dropped:'
|
print 'There have been changes made in Ubuntu.'
|
||||||
explanation = '\nExplanation of the Ubuntu delta and why it can be dropped:\n'
|
print 'Please edit the report and give an explanation.'
|
||||||
while (explanation[-2:] != '\n\n'):
|
print 'Press ENTER to start your editor. Press Control-C to abort now. Not saving the report file will abort the request, too.'
|
||||||
try:
|
wait_for_enter_or_exit()
|
||||||
explanation += raw_input() + '\n'
|
report += '\nExplanation of the Ubuntu delta and why it can be dropped:\n\n' + \
|
||||||
except KeyboardInterrupt:
|
'ENTER_EXPLANATION_HERE\n\n'
|
||||||
print 'Abort requested. No sync request filed.'
|
|
||||||
sys.exit(1)
|
|
||||||
report += explanation
|
|
||||||
|
|
||||||
uidx = base_ver.find('build')
|
uidx = base_ver.find('build')
|
||||||
if uidx > 0:
|
if uidx > 0:
|
||||||
@ -306,16 +309,49 @@ if __name__ == '__main__':
|
|||||||
report += 'Changelog since current %s version %s:\n\n' % (release, cur_ver)
|
report += 'Changelog since current %s version %s:\n\n' % (release, cur_ver)
|
||||||
report += debian_changelog(srcpkg, debiancomponent, base_ver) + '\n'
|
report += debian_changelog(srcpkg, debiancomponent, base_ver) + '\n'
|
||||||
|
|
||||||
|
# Do we want to edit the report?
|
||||||
|
if need_interaction:
|
||||||
|
edit_report = True
|
||||||
|
else:
|
||||||
|
val = raw_input('Do you want to edit the report [y/N]? ')
|
||||||
|
if val.lower() in ('y', 'yes'):
|
||||||
|
edit_report = True
|
||||||
|
|
||||||
|
if edit_report:
|
||||||
|
# Create tempfile and remember mtime
|
||||||
|
import tempfile
|
||||||
|
report_file = tempfile.NamedTemporaryFile( prefix='requestsync_' )
|
||||||
|
report_file.file.write(report)
|
||||||
|
report_file.file.flush()
|
||||||
|
mtime_before = os.stat( report_file.name ).st_mtime
|
||||||
|
|
||||||
|
# Launch editor
|
||||||
|
try:
|
||||||
|
editor = subprocess.check_call( ['sensible-editor', report_file.name] )
|
||||||
|
except subprocess.CalledProcessError, e:
|
||||||
|
print >> sys.stderr, 'Error calling sensible-editor: %s\nAborting.' % (e,)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
# Check if the tempfile has been changed
|
||||||
|
report_file_info = os.stat( report_file.name )
|
||||||
|
if mtime_before == os.stat( report_file.name ).st_mtime:
|
||||||
|
print >> sys.stderr, 'The temporary file %s has not been changed. Aborting. [Press ENTER]' % (report_file.name,)
|
||||||
|
raw_input()
|
||||||
|
sys.exit(1)
|
||||||
|
report_file.file.seek(0)
|
||||||
|
report = report_file.file.read()
|
||||||
|
report_file.file.close()
|
||||||
|
|
||||||
# mail or post the sync request
|
# mail or post the sync request
|
||||||
srcpkg = not newsource and srcpkg or None
|
srcpkg = not newsource and srcpkg or None
|
||||||
if use_lp_bugs:
|
if use_lp_bugs:
|
||||||
# Map status to the values expected by lp-bugs
|
# Map status to the values expected by lp-bugs
|
||||||
mapping = {'new': 'New', 'confirmed': 'Confirmed'}
|
mapping = {'new': 'New', 'confirmed': 'Confirmed'}
|
||||||
if post_bug(srcpkg, subscribe, mapping[status], title, report):
|
if post_bug(srcpkg, subscribe, mapping[status], title, report):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if mail_bug(srcpkg, subscribe, status, title, report, keyid):
|
if mail_bug(srcpkg, subscribe, status, title, report, keyid):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
print 'Something went wrong. No sync request filed.'
|
print 'Something went wrong. No sync request filed.'
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user