[Pkg-bazaar-commits] r176 ./bzr-builddeb/trunk: Handle multiple entries in the root of upstream's tarball when unpacking.
James Westby
jw+debian at jameswestby.net
Wed Sep 5 20:58:44 UTC 2007
------------------------------------------------------------
revno: 176
committer: James Westby <jw+debian at jameswestby.net>
branch nick: trunk
timestamp: Wed 2007-09-05 21:58:44 +0100
message:
Handle multiple entries in the root of upstream's tarball when unpacking.
When this happens then just rename the tempdir we unpacked in to to the
source dir we want to end up in. The rules take care of the extra directory
there.
modified:
builder.py
debian/changelog
tests/test_builder.py
-------------- next part --------------
=== modified file 'builder.py'
--- a/builder.py 2007-08-22 21:18:19 +0000
+++ b/builder.py 2007-09-05 20:58:44 +0000
@@ -285,9 +285,11 @@
tar.close()
files = glob.glob(tempdir+'/*')
os.makedirs(source_dir)
- for file in files:
- shutil.move(file, source_dir)
- shutil.rmtree(tempdir)
+ if len(files) == 1:
+ shutil.move(files[0], source_dir)
+ shutil.rmtree(tempdir)
+ else:
+ shutil.move(tempdir, source_dir)
if not upstream:
shutil.copy(tarball, build_dir)
else:
=== modified file 'debian/changelog'
--- a/debian/changelog 2007-09-02 14:34:53 +0000
+++ b/debian/changelog 2007-09-05 20:58:44 +0000
@@ -1,9 +1,16 @@
bzr-builddeb (0.91) unstable; urgency=low
+ [ Fr?d?ric Brin ]
* Correct unknown variable (files) when importing dsc.
* chmod 755 debian/rules when importing dsc
- -- Fr?d?ric Brin <frederic.brin at assonetworx.com> Sun, 02 Sep 2007 16:31:32 +0200
+ [ James Westby ]
+ * Now handles merge mode with multiple entries in the root of
+ upstream's tarball, which was causing havoc with dh-make-php packages.
+ Thanks to Mark A. Hershberger for the report and Adeodato Sim?
+ for the pointer to the fix. (Closes: #440069)
+
+ -- James Westby <jw+debian at jameswestby.net> Wed, 05 Sep 2007 21:56:31 +0100
bzr-builddeb (0.90) unstable; urgency=low
=== modified file 'tests/test_builder.py'
--- a/tests/test_builder.py 2007-08-22 21:18:19 +0000
+++ b/tests/test_builder.py 2007-09-05 20:58:44 +0000
@@ -130,11 +130,10 @@
self.package_version.upstream_version)
def __init__(self, *args, **kwargs):
- self.basedir = 'base'
- self.build_dir = join(self.basedir, 'build')
- self.orig_dir = join(self.basedir, 'orig')
- self.result_dir = join(self.basedir, 'result')
- self.branch_dir = join(self.basedir, 'branch')
+ self.build_dir = 'build'
+ self.orig_dir = 'orig'
+ self.result_dir = 'result'
+ self.branch_dir = 'branch'
self.source_dir = join(self.build_dir,
self.package_name + '-' + self.upstream_version)
self.tarball_name = self.package_name + '_' + self.upstream_version + \
@@ -148,7 +147,6 @@
os.chdir(self.branch_dir)
def _make_branch(self):
- os.mkdir(self.basedir)
tree = self.make_branch_and_tree(self.branch_dir)
return tree
@@ -798,11 +796,36 @@
self.assertEqual(contents, 'branch')
self.failIfExists(join(self.source_dir, basedir, 'install'))
+ def test_export_multiple_members_upstream(self):
+ """#440069: test when upstream tarball has multiple members in the root"""
+ wt = self._make_branch()
+ files = ['a']
+ self.build_branch_tree(files)
+ wt.add(files)
+ wt.commit('commit one')
+ builder = self.get_builder(wt=wt)
+ tarball_root = self.package_name + "-" + self.upstream_version
+ self.build_tree(['outside', tarball_root+'/',
+ join(tarball_root, 'inside')])
+ os.mkdir(self.orig_dir)
+ tarball = join(self.orig_dir, self.tarball_name)
+ f = tarfile.open(tarball, 'w:gz')
+ try:
+ f.add('outside')
+ f.add(tarball_root)
+ finally:
+ f.close()
+ builder.prepare()
+ builder.export()
+ self.failUnlessExists(join(self.source_dir, 'outside'))
+ self.failUnlessExists(join(self.source_dir, tarball_root, 'inside'))
+ self.failUnlessExists(join(self.source_dir, 'a'))
+
class TestMergeExportUpstreamBuilder(BuilderTestCase):
- upstream_branch = property(lambda self: join(self.basedir, 'upstream'))
- upstream_parent = property(lambda self: join(self.basedir, 'parent'))
+ upstream_branch = 'upstream'
+ upstream_parent = 'parent'
def get_builder(self, wt=None, version=None, larstiq=False,
export_revision=None, export_prepull=False,
More information about the Pkg-bazaar-commits
mailing list