From f7b6f0651f693b4f294fb3bc7fdc04fae63335a3 Mon Sep 17 00:00:00 2001 From: Zhang Qiang Date: Thu, 5 Apr 2012 15:55:32 +0800 Subject: [PATCH] Support more tar ball format, tar.bz2, tar.gz, tar.xz, etc. --- README.rst | 9 ++++++++- gitbuildsys/cmd_build.py | 6 +++++- gitbuildsys/cmd_localbuild.py | 6 +++++- gitbuildsys/git.py | 2 ++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index e262df8..c8fdec0 100644 --- a/README.rst +++ b/README.rst @@ -235,7 +235,12 @@ to build. The usage of subcommand `build` can be available using `gbs build --he "home::gbs:Trunk" if not specified Before running gbs build, you need to prepare a package git repository first, -then goto the root directory of git repository, run gbs build as follows: +and packaging directory must be exist and have spec file in it. The spec file +is used to prepare package name, version and tar ball format, and tar ball +format is specified using SOURCE field in specfile. + +Once git reposoritory and packaging directory are ready, goto the root +directory of git repository, run gbs build as follows: :: $ gbs build @@ -278,6 +283,8 @@ usage of subcommand `localbuild` can be available using `gbs localbuild --help` Specify distribution configure file, which should be full path +git repository and packaging directory should be prepared like `gbs build`. + Examples to run gbs localbuild: 1) Use specified dist file in command line using -D option diff --git a/gitbuildsys/cmd_build.py b/gitbuildsys/cmd_build.py index 913bd9d..007788b 100644 --- a/gitbuildsys/cmd_build.py +++ b/gitbuildsys/cmd_build.py @@ -24,6 +24,7 @@ import time import tempfile import glob import shutil +import urlparse import msger import runner @@ -115,7 +116,10 @@ def do(opts, args): oscworkdir = localpkg.get_workdir() localpkg.remove_all() - tarball = '%s/%s-%s-tizen.tar.bz2' % (oscworkdir, name, version) + source = utils.parse_spec(specfile, 'SOURCE0') + urlres = urlparse.urlparse(source) + + tarball = '%s/%s' % (oscworkdir, os.path.basename(urlres.path)) msger.info('archive git tree to tarball: %s' % os.path.basename(tarball)) mygit = git.Git(workdir) mygit.archive("%s-%s/" % (name, version), tarball) diff --git a/gitbuildsys/cmd_localbuild.py b/gitbuildsys/cmd_localbuild.py index 4f47667..23a977d 100644 --- a/gitbuildsys/cmd_localbuild.py +++ b/gitbuildsys/cmd_localbuild.py @@ -26,6 +26,7 @@ import tempfile import glob import shutil import subprocess +import urlparse import msger import runner @@ -210,7 +211,10 @@ def do(opts, args): if not name or not version: msger.error('can\'t get correct name or version from spec file.') - tarball = 'packaging/%s-%s-tizen.tar.bz2' % (name, version) + source = utils.parse_spec(specfile, 'SOURCE0') + urlres = urlparse.urlparse(source) + + tarball = '%s/%s' % (oscworkdir, os.path.basename(urlres.path)) msger.info('generate tar ball: %s' % tarball) mygit = git.Git(workdir) mygit.archive("%s-%s/" % (name, version), tarball) diff --git a/gitbuildsys/git.py b/gitbuildsys/git.py index e7aa41a..fe71ff2 100644 --- a/gitbuildsys/git.py +++ b/gitbuildsys/git.py @@ -278,12 +278,14 @@ class Git: '.tgz': ('tar', 'gz'), '.tar.bz2': ('tar', 'bz2'), '.tbz2': ('tar', 'bz2'), + '.tar.xz': ('tar', 'xz'), '.zip': ('zip', ''), } zipcmds = { 'gz': 'gzip', 'bz2': 'bzip2 -f', + 'xz': 'xz -f', } for extname in filetypes: -- 2.7.4