aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-06-01 22:36:07 +0200
committerGuido Günther <agx@sigxcpu.org>2012-06-01 22:37:51 +0200
commit16f0309320763a5d32330b97be8ff00b871d1d84 (patch)
tree57571c818e1dfc5f8aafa3264dd40f2db4cc4471
parentf52a417b0908d93772479af6d9131cb5dbe7f720 (diff)
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
-rwxr-xr-xgbp/scripts/buildpackage.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/gbp/scripts/buildpackage.py b/gbp/scripts/buildpackage.py
index 09d51e3..2a3a092 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):