-------------------------
Subcommand `import-orig` is used to import original upstream tar ball to current
-git repository. This subcommand is mostlly used for upgrade packages. usage of
-subcommand `import-orig` can be available from `gbs import-orig --help`
+git repository. This subcommand is mostlly used for upgrade packages. upstream
+tar ball format can be tar.gz, tar.bz2, tar.xz, tar.lzma or .zip.
+
+Usage of subcommand `import-orig` can be available from `gbs import-orig --help`
::
root@test-virtual-machine:~/gbs# gbs import-orig -h
Examples:
- $ gbs import original-tar-ball
+ $ gbs import-orig original-tar-ball
Options:
-h, --help show this help message and exit
--tag Create tag while import new version of upstream tar
msger.info('unpack upstream tar ball ...')
upstream = utils.UpstreamTarball(tarball)
(pkgname, pkgversion) = upstream.guess_version() or ('', '')
- upstream.unpack(tardir)
+
+ try:
+ import pdb;pdb.set_trace()
+ upstream.unpack(tardir)
+ except errors.UnpackError:
+ msger.error('Unpacking %s fail' % tarball)
tag = repo.version_to_tag("%(version)s", pkgversion)
msg = "Upstream version %s" % (pkgversion)
import msger
import runner
+import errors
compressor_opts = { 'gzip' : [ '-n', 'gz' ],
'bzip2' : [ '', 'bz2' ],
compression = '-a'
cmd = ' '.join(['tar']+ exclude + ['-C', dir, compression, '-xf', archive ])
- runner.quiet(cmd)
+ ret = runner.quiet(cmd)
+ if ret != 0:
+ raise errors.UnpackError("Unpacking of %s failed" % archive)
class UnpackZipArchive(object):
"""Wrap zip to Unpack a zip file"""
self.dir = dir
cmd = ' '.join(['unzip'] + [ "-q", archive, '-d', dir ])
- msger.info(cmd)
- runner.quiet(cmd)
+ ret = runner.quiet(cmd)
+ if ret != 0:
+ raise errors.UnpackError("Unpacking of %s failed" % archive)
class UpstreamTarball(object):
def __init__(self, name, unpacked=None):
filters = []
if type(filters) != type([]):
- raise GbpError, "Filters must be a list"
+ raise errors.UnpackError ('Filters must be a list')
self._unpack_archive(dir, filters)
self.unpacked = self._unpacked_toplevel(dir)
self._unpack_tar(dir, filters)
def _unpack_zip(self, dir):
- try:
- UnpackZipArchive(self.path, dir)
- except CmdError:
- raise CmdError, "Unpacking of %s failed" % self.path
+ UnpackZipArchive(self.path, dir)
def _unpacked_toplevel(self, dir):
"""unpacked archives can contain a leading directory or not"""
"""
Unpack a tarball to dir applying a list of filters.
"""
- try:
- unpackArchive = UnpackTarArchive(self.path, dir, filters)
- except gbpc.CommandExecFailed:
- raise GbpError
+ UnpackTarArchive(self.path, dir, filters)
def guess_version(self, extra_regex=r''):
"""