Merge lp:~vila/bzr-builddeb/debug-pristine-tar into lp:bzr-builddeb

Proposed by Vincent Ladeuil
Status: Merged
Merged at revision: 732
Proposed branch: lp:~vila/bzr-builddeb/debug-pristine-tar
Merge into: lp:bzr-builddeb
Diff against target: 74 lines (+27/-2)
3 files modified
config.py (+4/-0)
info.py (+1/-1)
upstream/pristinetar.py (+22/-1)
To merge this branch: bzr merge lp:~vila/bzr-builddeb/debug-pristine-tar
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+110852@code.launchpad.net

Description of the change

This helped me to debug pristine-tar failures by preserving the exported
tree used as input by pristine-tar. This tree is normally removed as it's
part of a temp dir used to produce the delta. As such, when pristine-tar
failed, it was removed when unwinding the stack leaving nothing for
diagnosis.

This is mainly intended to be used on jubany or on a dev setup where
'debug-pristine-tar=True' should be specified in ~/.bazaar/builddeb.conf.

The option defaults to False.

To post a comment you must log in.
735. By Vincent Ladeuil

Fix typos.

Revision history for this message
Vincent Ladeuil (vila) wrote :

Re-testing after the last change revealed typos fixed in revno 735.

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 'config.py'
2--- config.py 2012-01-13 10:25:27 +0000
3+++ config.py 2012-06-19 08:10:27 +0000
4@@ -265,6 +265,10 @@
5
6 merge = _bool_property('merge', "Run in merge mode")
7
8+ debug_pristine_tar = _bool_property(
9+ 'debug-pristine-tar',
10+ "Save some context when pristine-tar fails")
11+
12 @property
13 def build_type(self):
14 if self.merge:
15
16=== modified file 'info.py'
17--- info.py 2011-02-16 13:19:52 +0000
18+++ info.py 2012-06-19 08:10:27 +0000
19@@ -18,7 +18,7 @@
20
21 bzr_plugin_name = 'builddeb'
22
23-bzr_plugin_version = (2, 7, 0, 'dev', 0)
24+bzr_plugin_version = (2, 8, 5, 'dev', 0)
25
26 bzr_commands = [
27 "test_builddeb",
28
29=== modified file 'upstream/pristinetar.py'
30--- upstream/pristinetar.py 2012-02-17 14:38:45 +0000
31+++ upstream/pristinetar.py 2012-06-19 08:10:27 +0000
32@@ -18,6 +18,7 @@
33 # along with bzr-builddeb; if not, write to the Free Software
34 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35
36+
37 from base64 import (
38 standard_b64decode,
39 standard_b64encode,
40@@ -34,6 +35,7 @@
41 )
42 from bzrlib.plugins.builddeb.upstream import UpstreamSource
43 from bzrlib.plugins.builddeb.util import (
44+ debuild_config,
45 export,
46 subprocess_setup,
47 )
48@@ -409,7 +411,26 @@
49 export(tree, dest, format='dir', subdir=subdir)
50 finally:
51 tree.unlock()
52- return make_pristine_tar_delta(dest, tarball_path)
53+ try:
54+ return make_pristine_tar_delta(dest, tarball_path)
55+ except PristineTarDeltaTooLarge:
56+ raise
57+ except PristineTarError: # I.e. not PristineTarDeltaTooLarge
58+ conf = debuild_config(tree, True)
59+ if conf.debug_pristine_tar:
60+ revno, revid = tree.branch.last_revision_info()
61+ preserved = osutils.pathjoin(osutils.dirname(tarball_path),
62+ 'orig-%s' % (revno,))
63+ mutter('pristine-tar failed for delta between %s rev: %s'
64+ ' and tarball %s'
65+ % (tree.basedir, (revno, revid), tarball_path))
66+ osutils.copy_tree(
67+ dest, preserved)
68+ mutter('The failure can be reproduced with:\n'
69+ ' cd %s\n'
70+ ' pristine-tar -vdk gendelta %s -'
71+ % (preserved, tarball_path))
72+ raise
73 finally:
74 shutil.rmtree(tmpdir)
75

Subscribers

People subscribed via source and target branches