Merge lp:~jelmer/bzr-builddeb/merge-upstream-hook into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: Jelmer Vernooij
Approved revision: 528
Merged at revision: 532
Proposed branch: lp:~jelmer/bzr-builddeb/merge-upstream-hook
Merge into: lp:bzr-builddeb
Diff against target: 69 lines (+26/-1)
4 files modified
cmds.py (+1/-0)
debian/changelog (+2/-1)
doc/user_manual/hooks.rst (+5/-0)
tests/blackbox/test_merge_upstream.py (+18/-0)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/merge-upstream-hook
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+51463@code.launchpad.net

Description of the change

This adds a hook that will be invoked after "bzr merge-upstream" has merged in a new upstream version. This can be used to e.g. update debian/ based on the new upstream sources.

E.g. in bzr-svn I plan to set this to "./debian/update-deps.py", which updates the python-subvertpy and bzr version dependencies based on upstream's info.py

To post a comment you must log in.
Revision history for this message
James Westby (james-w) :
review: Approve

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 2011-02-21 16:49:06 +0000
3+++ cmds.py 2011-02-27 16:21:16 +0000
4@@ -732,6 +732,7 @@
5 "Upstream version %s has already been merged." % version)
6 self._add_changelog_entry(tree, package, version,
7 distribution_name, changelog)
8+ run_hook(tree, 'merge-upstream', config)
9 finally:
10 tree.unlock()
11 if not need_upstream_tarball:
12
13=== modified file 'debian/changelog'
14--- debian/changelog 2011-02-27 02:08:17 +0000
15+++ debian/changelog 2011-02-27 16:21:16 +0000
16@@ -36,8 +36,9 @@
17 confusion.
18 * When building with distribution set to UNRELEASED, it is now assumed
19 the build is targetted at the same distribution as the build before.
20+ * A hook for 'bzr merge-upstream' has been added. LP: #657501
21
22- -- Jelmer Vernooij <jelmer@debian.org> Sun, 27 Feb 2011 03:08:09 +0100
23+ -- Jelmer Vernooij <jelmer@debian.org> Sun, 27 Feb 2011 17:14:07 +0100
24
25 bzr-builddeb (2.6) unstable; urgency=low
26
27
28=== modified file 'doc/user_manual/hooks.rst'
29--- doc/user_manual/hooks.rst 2008-05-29 23:01:55 +0000
30+++ doc/user_manual/hooks.rst 2011-02-27 16:21:16 +0000
31@@ -17,6 +17,11 @@
32 package. More hook points could be added if you have a specific need, contact
33 me to discuss it if that is the case.
34
35+ * ``merge-upstream`` - This is run after a new upstream version has
36+ been merged into the current tree using ``bzr merge-upstream``.
37+ This allows you to update the debian/ metadata based on the new upstream
38+ release that has been merged in.
39+
40 * ``pre-export`` - This is run before the branch is exported to create
41 the build directory. This allows you to modify the branch or the working
42 tree. Note however that the tree to export is grabbed before the hook is
43
44=== modified file 'tests/blackbox/test_merge_upstream.py'
45--- tests/blackbox/test_merge_upstream.py 2010-07-29 18:46:35 +0000
46+++ tests/blackbox/test_merge_upstream.py 2011-02-27 16:21:16 +0000
47@@ -164,4 +164,22 @@
48 os.path.abspath(rel2.tarball), changed_upstream.tree.basedir],
49 working_dir=package.tree.basedir)
50
51+ def test_hooks(self):
52+ upstream = self.make_upstream()
53+ rel1 = self.release_upstream(upstream)
54+ package = self.import_upstream(rel1, upstream)
55+ package_path = package.tree.basedir
56+ os.mkdir(os.path.join(package_path, '.bzr-builddeb/'))
57+ f = open(os.path.join(package_path, '.bzr-builddeb/local.conf'), 'wb')
58+ try:
59+ f.write('[HOOKS]\nmerge-upstream = touch muhook\n')
60+ finally:
61+ f.close()
62+ changed_upstream = self.file_moved_replaced_upstream(upstream)
63+ rel2 = self.release_upstream(changed_upstream)
64+ self.run_bzr(['merge-upstream', '--version', str(rel2.version),
65+ os.path.abspath(rel2.tarball), changed_upstream.tree.basedir],
66+ working_dir=package.tree.basedir)
67+ self.failUnlessExists(os.path.join(package.tree.basedir, 'muhook'))
68+
69 # vim: ts=4 sts=4 sw=4

Subscribers

People subscribed via source and target branches