Merge lp:~jelmer/bzr-builddeb/integration into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Merged at revision: not available
Proposed branch: lp:~jelmer/bzr-builddeb/integration
Merge into: lp:bzr-builddeb
Diff against target: 105 lines (+36/-21)
3 files modified
cmds.py (+7/-20)
merge_upstream.py (+28/-0)
upstream.py (+1/-1)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/integration
Reviewer Review Type Date Requested Status
Bzr-builddeb-hackers Pending
Review via email: mp+21889@code.launchpad.net

Description of the change

Branch with two unrelated trivial changes:

* Move changelog addition function out of cmds.py
* Fix the fix for bug 572093 - getattr() with two arguments raises an AttributeError if the attribute was not found.

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 'cmds.py'
2--- cmds.py 2010-03-04 16:34:03 +0000
3+++ cmds.py 2010-03-22 21:18:27 +0000
4@@ -471,29 +471,13 @@
5 distribution_opt, directory_opt, last_version_opt,
6 force_opt, v3_opt, 'revision', 'merge-type']
7
8- def _update_changelog(self, tree, version, distribution_name, changelog,
9- package):
10- from bzrlib.plugins.builddeb.merge_upstream import package_version
11- if "~bzr" in str(version) or "+bzr" in str(version):
12- entry_description = "New upstream snapshot."
13- else:
14- entry_description = "New upstream release."
15- proc = subprocess.Popen(["dch", "-v",
16- str(package_version(version, distribution_name)),
17- "-D", "UNRELEASED", "--release-heuristic", "changelog",
18- entry_description], cwd=tree.basedir)
19- proc.wait()
20- if proc.returncode != 0:
21- raise BzrCommandError('Adding a new changelog stanza after the '
22- 'merge had completed failed. Add the new changelog entry '
23- 'yourself, review the merge, and then commit.')
24-
25 def run(self, location=None, upstream_branch=None, version=None, distribution=None,
26 package=None, no_user_config=None, directory=".", revision=None,
27 merge_type=None, last_version=None, force=None, v3=None):
28 from bzrlib.plugins.builddeb.errors import MissingChangelogError
29 from bzrlib.plugins.builddeb.repack_tarball import repack_tarball
30- from bzrlib.plugins.builddeb.merge_upstream import upstream_branch_version
31+ from bzrlib.plugins.builddeb.merge_upstream import (changelog_add_new_version,
32+ upstream_branch_version)
33 tree, _ = WorkingTree.open_containing(directory)
34 tree.lock_write()
35 try:
36@@ -619,8 +603,11 @@
37 upstream_revision=upstream_revision,
38 merge_type=merge_type, force=force)
39
40- self._update_changelog(tree, version, distribution_name, changelog,
41- package)
42+ if not changelog_add_new_version(tree, version, distribution_name,
43+ changelog, package):
44+ raise BzrCommandError('Adding a new changelog stanza after the '
45+ 'merge had completed failed. Add the new changelog '
46+ 'entry yourself, review the merge, and then commit.')
47 finally:
48 tree.unlock()
49 note("The new upstream version has been imported.")
50
51=== modified file 'merge_upstream.py'
52--- merge_upstream.py 2009-03-10 01:57:05 +0000
53+++ merge_upstream.py 2010-03-22 21:18:27 +0000
54@@ -27,6 +27,7 @@
55 #
56
57 import itertools
58+import subprocess
59
60 from debian_bundle.changelog import Version
61
62@@ -163,3 +164,30 @@
63 else:
64 ret.debian_version = "%d" % (prev_packaging_revnum+1)
65 return ret
66+
67+
68+def changelog_add_new_version(tree, version, distribution_name, changelog,
69+ package):
70+ """Add an entry to the changelog for a new version.
71+
72+ :param tree: WorkingTree in which the package lives
73+ :param version: Version to add
74+ :param distribution_name: Distribution name (debian, ubuntu, ...)
75+ :param changelog: Changelog object
76+ :param package: Package name
77+ :return: Whether an entry was successfully added
78+ """
79+ from bzrlib.plugins.builddeb.merge_upstream import package_version
80+ if "~bzr" in str(version) or "+bzr" in str(version):
81+ entry_description = "New upstream snapshot."
82+ else:
83+ entry_description = "New upstream release."
84+ proc = subprocess.Popen(["dch", "-v",
85+ str(package_version(version, distribution_name)),
86+ "-D", "UNRELEASED", "--release-heuristic", "changelog",
87+ entry_description], cwd=tree.basedir)
88+ proc.wait()
89+ # FIXME: Raise insightful exception here rather than just checking
90+ # return code.
91+ return proc.returncode == 0
92+
93
94=== modified file 'upstream.py'
95--- upstream.py 2010-03-11 23:44:57 +0000
96+++ upstream.py 2010-03-22 21:18:27 +0000
97@@ -110,7 +110,7 @@
98 # URIs (LP:375897)
99 try:
100 get_sources = getattr(apt_pkg, 'SourceRecords',
101- getattr(apt_pkg, 'GetPkgSrcRecords'))
102+ getattr(apt_pkg, 'GetPkgSrcRecords', None))
103 sources = get_sources()
104 except SystemError:
105 raise PackageVersionNotPresent(package, upstream_version, self)

Subscribers

People subscribed via source and target branches