Merge lp:~jelmer/bzr-builddeb/fix-bz2-repack into lp:bzr-builddeb

Proposed by Jelmer Vernooij
Status: Merged
Approved by: James Westby
Approved revision: no longer in the source branch.
Merged at revision: 550
Proposed branch: lp:~jelmer/bzr-builddeb/fix-bz2-repack
Merge into: lp:bzr-builddeb
Diff against target: 62 lines (+22/-4)
3 files modified
debian/changelog (+6/-0)
tests/test_upstream.py (+14/-0)
upstream/__init__.py (+2/-4)
To merge this branch: bzr merge lp:~jelmer/bzr-builddeb/fix-bz2-repack
Reviewer Review Type Date Requested Status
James Westby Approve
Review via email: mp+54991@code.launchpad.net

Description of the change

Fix repacking of bz2 tarballs during "bzr merge-upstream".

To post a comment you must log in.
547. By Jelmer Vernooij

Merge support for lazy opening upstream branch.

548. By Jelmer Vernooij

Merge --launchpad option to 'bzr merge-upstream'.

549. By Jelmer Vernooij

Merge support for using lazy hooks if available.

Revision history for this message
Jelmer Vernooij (jelmer) wrote :

Ping!

This still do double repacking of some tarballs but it's the simplest implementation in terms of code. I'd be happy to attack the double repacking as well, but preferably in a separate MP (it already happens at the moment, this just adds another codepath that triggers it).

Revision history for this message
James Westby (james-w) wrote :

Hi,

Sorry, I didn't know you were wanting to do this in two branches.

Approving, as it looks ok to me, but I wonder if the force_gz=True will
lead to unexpected results with --v3. Go ahead and land either way.

Thanks,

James

review: Approve
550. By Jelmer Vernooij

Fix merge of bz2 upstream tarballs. LP: #737012

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2011-03-14 22:28:24 +0000
3+++ debian/changelog 2011-03-27 00:30:48 +0000
4@@ -1,3 +1,9 @@
5+bzr-builddeb (2.7.3) UNRELEASED; urgency=low
6+
7+ * Fix merge of bz2 upstream tarballs. LP: #737012
8+
9+ -- Jelmer Vernooij <jelmer@debian.org> Sun, 27 Mar 2011 01:25:57 +0100
10+
11 bzr-builddeb (2.7.2) unstable; urgency=high
12
13 [ Andrew Mitchell ]
14
15=== modified file 'tests/test_upstream.py'
16--- tests/test_upstream.py 2011-02-26 21:08:36 +0000
17+++ tests/test_upstream.py 2011-03-27 00:30:48 +0000
18@@ -24,6 +24,8 @@
19
20 from base64 import standard_b64encode
21
22+import bz2
23+import gzip
24 import os
25 import tarfile
26 import zipfile
27@@ -616,6 +618,18 @@
28 self.assertRaises(PackageVersionNotPresent,
29 source.fetch_tarball, "foo", "0.9", "bar")
30
31+ def test_fetch_tarball_bz2(self):
32+ tar = tarfile.open("foo-1.0.tar.bz2", "w:bz2")
33+ tar.close()
34+ # verify this is a bzip2 file
35+ bz2.BZ2File("foo-1.0.tar.bz2").close()
36+ source = TarfileSource("foo-1.0.tar.bz2", "1.0")
37+ os.mkdir("bar")
38+ self.assertEquals("bar/foo_1.0.orig.tar.gz",
39+ source.fetch_tarball("foo", "1.0", "bar"))
40+ self.failUnlessExists("bar/foo_1.0.orig.tar.gz")
41+ gzip.open("bar/foo_1.0.orig.tar.gz").close()
42+
43
44 class _MissingUpstreamProvider(UpstreamProvider):
45 """For tests"""
46
47=== modified file 'upstream/__init__.py'
48--- upstream/__init__.py 2011-02-12 01:38:40 +0000
49+++ upstream/__init__.py 2011-03-27 00:30:48 +0000
50@@ -582,10 +582,8 @@
51 if version != self.version:
52 raise PackageVersionNotPresent(package, version, self)
53 dest_name = tarball_name(package, version)
54- repack_tarball(self.path, dest_name, target_dir=target_dir)
55- target_filename = self._tarball_path(package, version, target_dir)
56- shutil.copy(self.path, target_filename)
57- return target_filename
58+ repack_tarball(self.path, dest_name, target_dir=target_dir, force_gz=True)
59+ return os.path.join(target_dir, dest_name)
60
61 def get_latest_version(self, package, version):
62 return self.version

Subscribers

People subscribed via source and target branches