Merge lp:~umang/python-distutils-extra/608589-target-dist into lp:python-distutils-extra

Proposed by Umang Varma
Status: Merged
Merged at revision: 188
Proposed branch: lp:~umang/python-distutils-extra/608589-target-dist
Merge into: lp:python-distutils-extra
Diff against target: 92 lines (+23/-17)
1 file modified
debian/local/python-mkdebian (+23/-17)
To merge this branch: bzr merge lp:~umang/python-distutils-extra/608589-target-dist
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+30644@code.launchpad.net

Description of the change

This branch allows you to use a --distribution switch with python-mkdebian that will be used to make a changelog. If not specified, python-mkdebian will detect the distribution as before.

Note: I have had to use the --force-distribution flag with dch because if the user is actually setting the distribution manually, he/she should not be bugged with a "Did you see that? Hit enter to continue". Just the message should be fine.

EDIT: as the name suggests, this merge will fix lp:608589

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/local/python-mkdebian'
--- debian/local/python-mkdebian 2010-07-21 08:41:33 +0000
+++ debian/local/python-mkdebian 2010-07-22 12:46:51 +0000
@@ -45,7 +45,7 @@
45 finally:45 finally:
46 shutil.rmtree(instdir)46 shutil.rmtree(instdir)
4747
48def make_debian(egg, force_control, changelog, additional_dependencies):48def make_debian(egg, force_control, changelog, additional_dependencies, distribution):
49 '''Create/update debian/* from information in egg dictionary'''49 '''Create/update debian/* from information in egg dictionary'''
5050
51 if not os.path.isdir('debian'):51 if not os.path.isdir('debian'):
@@ -73,7 +73,7 @@
73 make_copyright(egg)73 make_copyright(egg)
7474
75 make_control(egg, force_control, additional_dependencies)75 make_control(egg, force_control, additional_dependencies)
76 make_changelog(egg, changelog)76 make_changelog(egg, changelog, distribution)
7777
78def make_copyright(egg):78def make_copyright(egg):
79 author = egg.get('Author', '')79 author = egg.get('Author', '')
@@ -197,20 +197,23 @@
197 raise197 raise
198 os.rename('debian/control.new', 'debian/control')198 os.rename('debian/control.new', 'debian/control')
199199
200def make_changelog(egg, changelog):200def make_changelog(egg, changelog, distribution):
201 lsb_release = subprocess.Popen(['lsb_release', '-si'],201 if not distribution:
202 stdout=subprocess.PIPE)202 lsb_release = subprocess.Popen(['lsb_release', '-si'],
203 distro = lsb_release.communicate()[0].strip()
204 assert lsb_release.returncode == 0
205
206 if distro == 'Debian':
207 release = 'unstable'
208 else:
209 lsb_release = subprocess.Popen(['lsb_release', '-sc'],
210 stdout=subprocess.PIPE)203 stdout=subprocess.PIPE)
211 release = lsb_release.communicate()[0].strip()204 distro = lsb_release.communicate()[0].strip()
212 assert lsb_release.returncode == 0205 assert lsb_release.returncode == 0
213206
207 if distro == 'Debian':
208 release = 'unstable'
209 else:
210 lsb_release = subprocess.Popen(['lsb_release', '-sc'],
211 stdout=subprocess.PIPE)
212 release = lsb_release.communicate()[0].strip()
213 assert lsb_release.returncode == 0
214 else:
215 release = distribution
216
214 if not os.path.exists('/usr/bin/debchange'):217 if not os.path.exists('/usr/bin/debchange'):
215 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \218 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \
216 'You need to install the "devscripts" package for this.'219 'You need to install the "devscripts" package for this.'
@@ -221,7 +224,7 @@
221 changelog = ['Initial release.']224 changelog = ['Initial release.']
222 try:225 try:
223 assert subprocess.call(['debchange', '--create', '--package', egg['Name'],226 assert subprocess.call(['debchange', '--create', '--package', egg['Name'],
224 '-D' + release, '-v' + egg['Version'], changelog[0]]) == 0227 '-D' + release, '-v' + egg['Version'], changelog[0], '--force-distribution']) == 0
225 except OSError, e:228 except OSError, e:
226 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \229 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \
227 'You need to install the "devscripts" package for this.' % str(e)230 'You need to install the "devscripts" package for this.' % str(e)
@@ -231,7 +234,7 @@
231 changelog = ['New release.']234 changelog = ['New release.']
232 # this will just fail if we already have that version, which is okay.235 # this will just fail if we already have that version, which is okay.
233 subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'],236 subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'],
234 changelog[0]], stderr=subprocess.PIPE)237 changelog[0], '--force-distribution'], stderr=subprocess.PIPE)
235 for message in changelog[1:]:238 for message in changelog[1:]:
236 subprocess.call(['debchange', message])239 subprocess.call(['debchange', message])
237240
@@ -298,7 +301,9 @@
298 help='Add string changelog to debian/changelog (can be specified multiple times)')301 help='Add string changelog to debian/changelog (can be specified multiple times)')
299parser.add_option('', '--dependency', dest='dependencies', action='append',302parser.add_option('', '--dependency', dest='dependencies', action='append',
300 help='Add additional debian package dependency (can be specified multiple times)')303 help='Add additional debian package dependency (can be specified multiple times)')
301parser.set_defaults(changelog=None, dependencies=[])304parser.add_option('-D', '--distribution', dest='distribution', action='store',
305 help='Specify which Debian/Ubuntu distribution should be used in the changelog')
306parser.set_defaults(changelog=None, dependencies=[], distribution=None)
302options, args = parser.parse_args()307options, args = parser.parse_args()
303308
304# switch stdout to line buffering, for scripts reading our output on the fly309# switch stdout to line buffering, for scripts reading our output on the fly
@@ -307,4 +312,5 @@
307egg = get_egg_info()312egg = get_egg_info()
308make_debian(egg, force_control=options.force_control,313make_debian(egg, force_control=options.force_control,
309 changelog=options.changelog,314 changelog=options.changelog,
310 additional_dependencies=options.dependencies)315 additional_dependencies=options.dependencies,
316 distribution=options.distribution)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: