Merge lp:~umang/python-distutils-extra/587538-no-changelog into lp:python-distutils-extra

Proposed by Umang Varma
Status: Merged
Merged at revision: 189
Proposed branch: lp:~umang/python-distutils-extra/587538-no-changelog
Merge into: lp:python-distutils-extra
Diff against target: 88 lines (+22/-11)
1 file modified
debian/local/python-mkdebian (+22/-11)
To merge this branch: bzr merge lp:~umang/python-distutils-extra/587538-no-changelog
Reviewer Review Type Date Requested Status
Registry Administrators Pending
Review via email: mp+30919@code.launchpad.net

Description of the change

Fixed lp:587538 (on distutils-extra) by adding a --no-changelog flag.

Note: I've got rid of the big lists of arguments being sent to dch. Instead, I've made a list called `command` and added arguments to it as and when required.

(Things would have become messy with many if statements each using a slightly different dch command)

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-23 13:48:20 +0000
+++ debian/local/python-mkdebian 2010-07-26 08:57:44 +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, distribution):48def make_debian(egg, force_control, changelog, additional_dependencies, distribution, use_old_changelog):
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, distribution)76 make_changelog(egg, changelog, distribution, use_old_changelog)
7777
78def make_copyright(egg):78def make_copyright(egg):
79 author = egg.get('Author', '')79 author = egg.get('Author', '')
@@ -196,7 +196,8 @@
196 raise196 raise
197 os.rename('debian/control.new', 'debian/control')197 os.rename('debian/control.new', 'debian/control')
198198
199def make_changelog(egg, changelog, distribution):199def make_changelog(egg, changelog, distribution, use_old_changelog):
200 command = ['debchange']
200 if not distribution:201 if not distribution:
201 lsb_release = subprocess.Popen(['lsb_release', '-si'],202 lsb_release = subprocess.Popen(['lsb_release', '-si'],
202 stdout=subprocess.PIPE)203 stdout=subprocess.PIPE)
@@ -212,6 +213,10 @@
212 assert lsb_release.returncode == 0213 assert lsb_release.returncode == 0
213 else:214 else:
214 release = distribution215 release = distribution
216 # Use --force-distribution only if distribution specified by user
217 command.append('--force-distribution')
218
219 command.append('-D' + release)
215220
216 if not os.path.exists('/usr/bin/debchange'):221 if not os.path.exists('/usr/bin/debchange'):
217 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \222 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \
@@ -222,18 +227,21 @@
222 if not changelog:227 if not changelog:
223 changelog = ['Initial release.']228 changelog = ['Initial release.']
224 try:229 try:
225 assert subprocess.call(['debchange', '--create', '--package', egg['Name'],230 command.extend(['--create', '--package', egg['Name'],
226 '-D' + release, '-v' + egg['Version'], changelog[0], '--force-distribution']) == 0231 '-v' + egg['Version'], changelog[0]])
232 assert subprocess.call(command) == 0
227 except OSError, e:233 except OSError, e:
228 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \234 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \
229 'You need to install the "devscripts" package for this.' % str(e)235 'You need to install the "devscripts" package for this.' % str(e)
230 sys.exit(0)236 sys.exit(0)
231 else:237 else:
232 if not changelog:238 if not changelog:
233 changelog = ['New release.']239 changelog = use_old_changelog and [''] or ['New release.']
234 # this will just fail if we already have that version, which is okay.240 if not use_old_changelog:
235 subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'],241 command.append('-v' + egg['Version'])
236 changelog[0], '--force-distribution'], stderr=subprocess.PIPE)242 command.append(changelog[0])
243
244 subprocess.call(command, stderr=subprocess.PIPE)
237 for message in changelog[1:]:245 for message in changelog[1:]:
238 subprocess.call(['debchange', message])246 subprocess.call(['debchange', message])
239247
@@ -302,7 +310,9 @@
302 help='Add additional debian package dependency (can be specified multiple times)')310 help='Add additional debian package dependency (can be specified multiple times)')
303parser.add_option('-D', '--distribution', dest='distribution', action='store',311parser.add_option('-D', '--distribution', dest='distribution', action='store',
304 help='Specify which Debian/Ubuntu distribution should be used in the changelog')312 help='Specify which Debian/Ubuntu distribution should be used in the changelog')
305parser.set_defaults(changelog=None, dependencies=[], distribution=None)313parser.add_option('', '--no-changelog', dest='use_old_changelog', action='store_true',
314 help='Don\'t create a new changelog entry')
315parser.set_defaults(changelog=None, dependencies=[], distribution=None, use_old_changelog=False)
306options, args = parser.parse_args()316options, args = parser.parse_args()
307317
308# switch stdout to line buffering, for scripts reading our output on the fly318# switch stdout to line buffering, for scripts reading our output on the fly
@@ -312,4 +322,5 @@
312make_debian(egg, force_control=options.force_control,322make_debian(egg, force_control=options.force_control,
313 changelog=options.changelog,323 changelog=options.changelog,
314 additional_dependencies=options.dependencies,324 additional_dependencies=options.dependencies,
315 distribution=options.distribution)325 distribution=options.distribution,
326 use_old_changelog = options.use_old_changelog)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: