From 16f0309320763a5d32330b97be8ff00b871d1d84 Mon Sep 17 00:00:00 2001 From: Guido Günther Date: Fri, 1 Jun 2012 22:36:07 +0200 Subject: git-buildpackage overlay-mode: don't fail on files named like tarball Instead of moving individual files around simply rename the directories. This is faster and independent of the tarballs content. Closes: #675412 --- gbp/scripts/buildpackage.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py index 09d51e3f..2a3a0928 100755 --- a/gbp/scripts/buildpackage.py +++ b/gbp/scripts/buildpackage.py @@ -135,14 +135,14 @@ def write_tree(repo, options): def export_source(repo, tree, cp, options, dest_dir, tarball_dir): """ - Export a verion of the source tree when building in a separate directory + Export a version of the source tree when building in a separate directory @param repo: the git repository to export from @type repo: L{gbp.git.GitRepository} @param cp: the package's changelog @param options: options to apply @param dest_dir: where to export the source to - @param tarball_dir: where to fetch the tarball form in overlay mode + @param tarball_dir: where to fetch the tarball from in overlay mode @returns: the temporary directory """ # Extract orig tarball if git-overlay option is selected: @@ -175,14 +175,13 @@ def extract_orig(orig_tarball, dest_dir): # Check if tarball extracts into a single folder or not: if upstream.unpacked != dest_dir: - # If it extracts a single folder, move all of its contents to dest_dir: - r = glob("%s/*" % upstream.unpacked) - r.extend(glob("%s/.*" % upstream.unpacked)) # include hidden files and folders - for f in r: - os.rename(f, os.path.join(dest_dir, os.path.basename(f))) - - # Remove that single folder: - os.rmdir(upstream.unpacked) + # If it extracts a single folder, move its contents to dest_dir: + gbp.log.debug("Moving %s to %s" % (upstream.unpacked, dest_dir)) + tmpdir = dest_dir + '.new' + os.rename(upstream.unpacked, tmpdir) + os.rmdir(dest_dir) + os.rename(tmpdir, dest_dir) + #} def fetch_changelog(repo, options, tree): -- cgit v1.2.3