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
1=== modified file 'debian/local/python-mkdebian'
2--- debian/local/python-mkdebian 2010-07-21 08:41:33 +0000
3+++ debian/local/python-mkdebian 2010-07-22 12:46:51 +0000
4@@ -45,7 +45,7 @@
5 finally:
6 shutil.rmtree(instdir)
7
8-def make_debian(egg, force_control, changelog, additional_dependencies):
9+def make_debian(egg, force_control, changelog, additional_dependencies, distribution):
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)
18+ make_changelog(egg, changelog, distribution)
19
20 def make_copyright(egg):
21 author = egg.get('Author', '')
22@@ -197,20 +197,23 @@
23 raise
24 os.rename('debian/control.new', 'debian/control')
25
26-def make_changelog(egg, changelog):
27- lsb_release = subprocess.Popen(['lsb_release', '-si'],
28- stdout=subprocess.PIPE)
29- distro = lsb_release.communicate()[0].strip()
30- assert lsb_release.returncode == 0
31-
32- if distro == 'Debian':
33- release = 'unstable'
34- else:
35- lsb_release = subprocess.Popen(['lsb_release', '-sc'],
36+def make_changelog(egg, changelog, distribution):
37+ if not distribution:
38+ lsb_release = subprocess.Popen(['lsb_release', '-si'],
39 stdout=subprocess.PIPE)
40- release = lsb_release.communicate()[0].strip()
41+ distro = lsb_release.communicate()[0].strip()
42 assert lsb_release.returncode == 0
43
44+ if distro == 'Debian':
45+ release = 'unstable'
46+ else:
47+ lsb_release = subprocess.Popen(['lsb_release', '-sc'],
48+ stdout=subprocess.PIPE)
49+ release = lsb_release.communicate()[0].strip()
50+ assert lsb_release.returncode == 0
51+ else:
52+ release = distribution
53+
54 if not os.path.exists('/usr/bin/debchange'):
55 print >> sys.stderr, 'ERROR: Could not find "debchange".\n' \
56 'You need to install the "devscripts" package for this.'
57@@ -221,7 +224,7 @@
58 changelog = ['Initial release.']
59 try:
60 assert subprocess.call(['debchange', '--create', '--package', egg['Name'],
61- '-D' + release, '-v' + egg['Version'], changelog[0]]) == 0
62+ '-D' + release, '-v' + egg['Version'], changelog[0], '--force-distribution']) == 0
63 except OSError, e:
64 print >> sys.stderr, 'ERROR: Could not run "debchange": %s\n' \
65 'You need to install the "devscripts" package for this.' % str(e)
66@@ -231,7 +234,7 @@
67 changelog = ['New release.']
68 # this will just fail if we already have that version, which is okay.
69 subprocess.call(['debchange', '-D' + release, '-v' + egg['Version'],
70- changelog[0]], stderr=subprocess.PIPE)
71+ changelog[0], '--force-distribution'], stderr=subprocess.PIPE)
72 for message in changelog[1:]:
73 subprocess.call(['debchange', message])
74
75@@ -298,7 +301,9 @@
76 help='Add string changelog to debian/changelog (can be specified multiple times)')
77 parser.add_option('', '--dependency', dest='dependencies', action='append',
78 help='Add additional debian package dependency (can be specified multiple times)')
79-parser.set_defaults(changelog=None, dependencies=[])
80+parser.add_option('-D', '--distribution', dest='distribution', action='store',
81+ help='Specify which Debian/Ubuntu distribution should be used in the changelog')
82+parser.set_defaults(changelog=None, dependencies=[], distribution=None)
83 options, args = parser.parse_args()
84
85 # switch stdout to line buffering, for scripts reading our output on the fly
86@@ -307,4 +312,5 @@
87 egg = get_egg_info()
88 make_debian(egg, force_control=options.force_control,
89 changelog=options.changelog,
90- additional_dependencies=options.dependencies)
91+ additional_dependencies=options.dependencies,
92+ distribution=options.distribution)

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: