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
1=== modified file 'debian/local/python-mkdebian'
2--- debian/local/python-mkdebian 2010-07-23 13:48:20 +0000
3+++ debian/local/python-mkdebian 2010-07-26 08:57:44 +0000
4@@ -45,7 +45,7 @@
5 finally:
6 shutil.rmtree(instdir)
7
8-def make_debian(egg, force_control, changelog, additional_dependencies, distribution):
9+def make_debian(egg, force_control, changelog, additional_dependencies, distribution, use_old_changelog):
10 '''Create/update debian/* from information in egg dictionary'''
11
12 if not os.path.isdir('debian'):
13@@ -73,7 +73,7 @@
14 make_copyright(egg)
15
16 make_control(egg, force_control, additional_dependencies)
17- make_changelog(egg, changelog, distribution)
18+ make_changelog(egg, changelog, distribution, use_old_changelog)
19
20 def make_copyright(egg):
21 author = egg.get('Author', '')
22@@ -196,7 +196,8 @@
23 raise
24 os.rename('debian/control.new', 'debian/control')
25
26-def make_changelog(egg, changelog, distribution):
27+def make_changelog(egg, changelog, distribution, use_old_changelog):
28+ command = ['debchange']
29 if not distribution:
30 lsb_release = subprocess.Popen(['lsb_release', '-si'],
31 stdout=subprocess.PIPE)
32@@ -212,6 +213,10 @@
33 assert lsb_release.returncode == 0
34 else:
35 release = distribution
36+ # Use --force-distribution only if distribution specified by user
37+ command.append('--force-distribution')
38+
39+ command.append('-D' + release)
40
41 if not os.path.exists('/usr/bin/debchange'):
42 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \
43@@ -222,18 +227,21 @@
44 if not changelog:
45 changelog = ['Initial release.']
46 try:
47- assert subprocess.call(['debchange', '--create', '--package', egg['Name'],
48- '-D' + release, '-v' + egg['Version'], changelog[0], '--force-distribution']) == 0
49+ command.extend(['--create', '--package', egg['Name'],
50+ '-v' + egg['Version'], changelog[0]])
51+ assert subprocess.call(command) == 0
52 except OSError, e:
53 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \
54 'You need to install the "devscripts" package for this.' % str(e)
55 sys.exit(0)
56 else:
57 if not changelog:
58- changelog = ['New release.']
59- # this will just fail if we already have that version, which is okay.
60- subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'],
61- changelog[0], '--force-distribution'], stderr=subprocess.PIPE)
62+ changelog = use_old_changelog and [''] or ['New release.']
63+ if not use_old_changelog:
64+ command.append('-v' + egg['Version'])
65+ command.append(changelog[0])
66+
67+ subprocess.call(command, stderr=subprocess.PIPE)
68 for message in changelog[1:]:
69 subprocess.call(['debchange', message])
70
71@@ -302,7 +310,9 @@
72 help='Add additional debian package dependency (can be specified multiple times)')
73 parser.add_option('-D', '--distribution', dest='distribution', action='store',
74 help='Specify which Debian/Ubuntu distribution should be used in the changelog')
75-parser.set_defaults(changelog=None, dependencies=[], distribution=None)
76+parser.add_option('', '--no-changelog', dest='use_old_changelog', action='store_true',
77+ help='Don\'t create a new changelog entry')
78+parser.set_defaults(changelog=None, dependencies=[], distribution=None, use_old_changelog=False)
79 options, args = parser.parse_args()
80
81 # switch stdout to line buffering, for scripts reading our output on the fly
82@@ -312,4 +322,5 @@
83 make_debian(egg, force_control=options.force_control,
84 changelog=options.changelog,
85 additional_dependencies=options.dependencies,
86- distribution=options.distribution)
87+ distribution=options.distribution,
88+ use_old_changelog = options.use_old_changelog)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: