Properly determine compression type of orig tarball
authorEd Bartosh <eduard.bartosh@intel.com>
Mon, 14 May 2012 08:41:59 +0000 (11:41 +0300)
committerEd Bartosh <eduard.bartosh@intel.com>
Mon, 14 May 2012 08:41:59 +0000 (11:41 +0300)
Change-Id: If70b2baad0c2f50ee0c55b8372c0e015d6aa92e9

gitbuildsys/cmd_localbuild.py

index 162b99c..4806df2 100644 (file)
@@ -30,10 +30,10 @@ import utils
 import errors
 from conf import configmgr
 
-from gbp.scripts.buildpackage_rpm import git_archive
-from gbp.pkg import compressor_aliases
+from gbp.scripts.buildpackage_rpm import git_archive, guess_comp_type
 from gbp.rpm.git import GitRepositoryError, RpmGitRepository
 import gbp.rpm as rpm
+from gbp.errors import GbpError
 
 change_personality = {
             'i686':  'linux32',
@@ -225,10 +225,13 @@ def do(opts, args):
     except GitRepositoryError:
         msger.error("%s is not a git repository" % (os.path.curdir))
 
-    comp_type = compressor_aliases.get(spec.orig_comp, None)
-    if not git_archive(repo, spec, "%s/packaging" % workdir, 'HEAD', comp_type,
-                       comp_level=9, with_submodules=True):
-        msger.error("Cannot create source tarball %s" % tarball)
+    try:
+        comp_type = guess_comp_type(spec)
+        if not git_archive(repo, spec, "%s/packaging" % workdir, 'HEAD', comp_type,
+                           comp_level=9, with_submodules=True):
+            msger.error("Cannot create source tarball %s" % tarball)
+    except GbpError, exc:
+        msger.error(str(exc))
  
     # runner.show() can't support interactive mode, so use subprocess insterad.
     try: