summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--base/util.py6
-rw-r--r--modules/sourceball.py9
2 files changed, 10 insertions, 5 deletions
diff --git a/base/util.py b/base/util.py
index 5f71534..5193bcd 100644
--- a/base/util.py
+++ b/base/util.py
@@ -108,5 +108,9 @@ def flatten(l):
_flatten(acc, l)
return acc
+def base_dir(tarball):
+ ti = tarball.next()
+ return ti.name.split('/')[0]
+
__all__ = ['pwd', 'copy', 'with_sudo', 'with_su', 'symlink', 'move',
- 'log_file', 'one', 'remove_all', 'flatten']
+ 'log_file', 'one', 'remove_all', 'flatten', 'base_dir']
diff --git a/modules/sourceball.py b/modules/sourceball.py
index 38abf1f..17d6def 100644
--- a/modules/sourceball.py
+++ b/modules/sourceball.py
@@ -28,7 +28,7 @@ from tempfile import mkdtemp
from base.base import log
from base.dirfactory import DirFactory
from base.exceptions import ExecutionException
-from base.util import pwd, copy, move
+from base.util import pwd, copy, move, base_dir
from modules.packagesource import PackageSource
@@ -39,16 +39,17 @@ class SourceBall(PackageSource):
tmp_dir = mkdtemp()
with pwd(tmp_dir):
sourceball_name = copy(tarball, split(tarball)[1])
+ log.debug('sourceball_name ' + sourceball_name)
sourceball = tarfile.open(sourceball_name)
- extract_dir = min([(x.name, x) for x in sourceball])[0]
- extract_dir = basename(abspath(extract_dir))
+ extract_dir = base_dir(sourceball)
if name and not name == extract_dir:
+ log.debug('hahahahhaah')
raise ExecutionException("tarball is not target directory")
if not name:
name = extract_dir
super(SourceBall, self).__init__(name)
if tarball:
- with pwd(self.dir):
+ with pwd(self.parent):
sourceball.extractall()
with pwd(self.branch_dir):
sourceball.extractall()