~laney/+junk/bzr-builddeb-test-deps

« back to all changes in this revision

Viewing changes to upstream/pristinetar.py

  • Committer: James Westby
  • Date: 2012-06-19 13:39:42 UTC
  • mfrom: (731.1.4 debug-pristine-tar)
  • Revision ID: james.westby@canonical.com-20120619133942-30jp7en0xw4mce7d
Add a config option to be able to access the intermediate state of pristine-tar when it fails.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#    along with bzr-builddeb; if not, write to the Free Software
19
19
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20
20
 
 
21
 
21
22
from base64 import (
22
23
    standard_b64decode,
23
24
    standard_b64encode,
34
35
    )
35
36
from bzrlib.plugins.builddeb.upstream import UpstreamSource
36
37
from bzrlib.plugins.builddeb.util import (
 
38
    debuild_config,
37
39
    export,
38
40
    subprocess_setup,
39
41
    )
409
411
                export(tree, dest, format='dir', subdir=subdir)
410
412
            finally:
411
413
                tree.unlock()
412
 
            return make_pristine_tar_delta(dest, tarball_path)
 
414
            try:
 
415
                return make_pristine_tar_delta(dest, tarball_path)
 
416
            except PristineTarDeltaTooLarge:
 
417
                raise
 
418
            except PristineTarError: # I.e. not PristineTarDeltaTooLarge
 
419
                conf = debuild_config(tree, True)
 
420
                if conf.debug_pristine_tar:
 
421
                    revno, revid = tree.branch.last_revision_info()
 
422
                    preserved = osutils.pathjoin(osutils.dirname(tarball_path),
 
423
                                                 'orig-%s' % (revno,))
 
424
                    mutter('pristine-tar failed for delta between %s rev: %s'
 
425
                           ' and tarball %s'
 
426
                           % (tree.basedir, (revno, revid), tarball_path))
 
427
                    osutils.copy_tree(
 
428
                        dest, preserved)
 
429
                    mutter('The failure can be reproduced with:\n'
 
430
                           '  cd %s\n'
 
431
                           '  pristine-tar -vdk gendelta %s -'
 
432
                           % (preserved, tarball_path))
 
433
                raise
413
434
        finally:
414
435
            shutil.rmtree(tmpdir)
415
436