summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Lehtonen <markus.lehtonen@linux.intel.com>2012-06-15 08:43:12 +0300
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>2013-04-03 09:13:50 +0300
commit2e8c39172c7c41fa67a7a3e95eb7e1cd2dbd4d38 (patch)
tree445ffa0e00823bce870a124561c47454ca4f3b50
parentba0e9e9452c7ad97c4dfcfcc1660a5b4bd0fd9a2 (diff)
downloadgit-buildpackage-2e8c39172c7c41fa67a7a3e95eb7e1cd2dbd4d38.tar.gz
git-buildpackage-2e8c39172c7c41fa67a7a3e95eb7e1cd2dbd4d38.tar.bz2
git-buildpackage-2e8c39172c7c41fa67a7a3e95eb7e1cd2dbd4d38.zip
import-orig: simplify repack_source() and tmpdir handling
Now a tmpdir is always created and sources are always unpacked into there. Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
-rw-r--r--gbp/scripts/common/import_orig.py9
-rw-r--r--gbp/scripts/import_orig.py9
2 files changed, 8 insertions, 10 deletions
diff --git a/gbp/scripts/common/import_orig.py b/gbp/scripts/common/import_orig.py
index a884573f..2d1e2259 100644
--- a/gbp/scripts/common/import_orig.py
+++ b/gbp/scripts/common/import_orig.py
@@ -117,16 +117,13 @@ def repacked_tarball_name(source, name, version):
return name
-def repack_source(source, name, version, tmpdir, filters):
+def repack_source(source, name, version, unpack_dir, filters):
"""Repack the source tree"""
name = repacked_tarball_name(source, name, version)
repacked = source.pack(name, filters)
if source.is_orig(): # the tarball was filtered on unpack
repacked.unpacked = source.unpacked
else: # otherwise unpack the generated tarball get a filtered tree
- if tmpdir:
- cleanup_tmp_tree(tmpdir)
- tmpdir = tempfile.mkdtemp(dir='../')
- repacked.unpack(tmpdir, filters)
- return (repacked, tmpdir)
+ repacked.unpack(unpack_dir, filters)
+ return repacked
diff --git a/gbp/scripts/import_orig.py b/gbp/scripts/import_orig.py
index 5e68a42d..5a6f2e58 100644
--- a/gbp/scripts/import_orig.py
+++ b/gbp/scripts/import_orig.py
@@ -247,7 +247,7 @@ def parse_args(argv):
def main(argv):
ret = 0
- tmpdir = ''
+ tmpdir = tempfile.mkdtemp(dir='../')
pristine_orig = None
linked = False
@@ -280,13 +280,14 @@ def main(argv):
set_bare_repo_options(options)
if not source.is_dir():
- tmpdir = tempfile.mkdtemp(dir='../')
- source.unpack(tmpdir, options.filters)
+ unpack_dir = tempfile.mkdtemp(prefix='unpack', dir=tmpdir)
+ source.unpack(unpack_dir, options.filters)
gbp.log.debug("Unpacked '%s' to '%s'" % (source.path, source.unpacked))
if source.needs_repack(options):
gbp.log.debug("Filter pristine-tar: repacking '%s' from '%s'" % (source.path, source.unpacked))
- (source, tmpdir) = repack_source(source, sourcepackage, version, tmpdir, options.filters)
+ repack_dir = tempfile.mkdtemp(prefix='repack', dir=tmpdir)
+ source = repack_source(source, sourcepackage, version, repack_dir, options.filters)
(pristine_orig, linked) = prepare_pristine_tar(source.path,
sourcepackage,