summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-16 21:26:10 -0500
committerYaakov M. Nemoy <loupgaroublond@gmail.com>2009-01-16 21:26:10 -0500
commitc5b381c3af851468406f8ee71cbf24b5f11becdf (patch)
tree4d6dfaa19f2addae77c78990013a24e3fb8ed9b9
parent2033632cb3fc1ed5d9d16be5552ac941033beb66 (diff)
downloadfedora-devshell-c5b381c3af851468406f8ee71cbf24b5f11becdf.tar.gz
fedora-devshell-c5b381c3af851468406f8ee71cbf24b5f11becdf.tar.xz
fedora-devshell-c5b381c3af851468406f8ee71cbf24b5f11becdf.zip
Small bugfixes
-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()