diff options
Diffstat (limited to 'scripts/v8-create-tarball')
-rwxr-xr-x | scripts/v8-create-tarball | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/scripts/v8-create-tarball b/scripts/v8-create-tarball new file mode 100755 index 0000000..8306819 --- /dev/null +++ b/scripts/v8-create-tarball @@ -0,0 +1,52 @@ +#!/usr/bin/python2 +# Copyright 2010 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +"""Creates a tarball containing V8 sources based on an SVN tag.""" + +import optparse +import os.path +import pysvn +import shutil +import tarfile +import tempfile + +import chromium_tools + +parser = optparse.OptionParser(usage="%prog <v8-version>") +(options, args) = parser.parse_args() +if len(args) != 1: + parser.error("Exactly one argument required: <v8-version>") + +target_name = 'v8-%s' % args[0] + +tmpdir = tempfile.mkdtemp() + +try: + checkout_dir = os.path.join(tmpdir, target_name) + os.makedirs(checkout_dir) + + checkout_url = 'http://v8.googlecode.com/svn/tags/%s' % args[0] + + svn_client = pysvn.Client() + svn_client.checkout(checkout_url, checkout_dir) + + version_contents = open(os.path.join(checkout_dir, 'src', 'version.cc')).read() + actual_version = chromium_tools.v8_extract_version(version_contents) + if actual_version != args[0]: + print 'Version info inside version.cc does not match!' + print 'Expected %s, got %s. Exiting' % (args[0], actual_version) + sys.exit(1) + + archive_name = '%s.tar.gz' % target_name + try: + archive = tarfile.open(archive_name, 'w:gz') + archive.add(checkout_dir, target_name, exclude=(lambda x: '.svn' in x)) + except: + os.remove(archive_name) + raise + finally: + archive.close() +finally: + shutil.rmtree(tmpdir) + pass |