From 7621268d39080f467f30465f4955b7c85fe37bca Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Sun, 3 Jul 2016 17:52:28 +0200 Subject: unpack_subtarball: Remove existing directory first so consecutive imports work Git-Dch: Ignore --- gbp/deb/upstreamsource.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gbp/deb/upstreamsource.py b/gbp/deb/upstreamsource.py index 76f85b4..651043e 100644 --- a/gbp/deb/upstreamsource.py +++ b/gbp/deb/upstreamsource.py @@ -46,8 +46,10 @@ def unpack_subtarball(dest, component, tarball, filters): source = DebianUpstreamSource(tarball) source.unpack(tmpdir, filters) - dest = os.path.join(dest, component) - shutil.move(source.unpacked, dest) + newdest = os.path.join(dest, component) + if os.path.exists(newdest): + shutil.rmtree(newdest) + shutil.move(source.unpacked, newdest) finally: os.chdir(olddir) if tmpdir is not None: -- cgit v1.2.3