diff options
Diffstat (limited to 'scripts/v8-create-tarball')
-rwxr-xr-x | scripts/v8-create-tarball | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/scripts/v8-create-tarball b/scripts/v8-create-tarball deleted file mode 100755 index 0f7f6bb..0000000 --- a/scripts/v8-create-tarball +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/python2 -# Copyright 2011 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 re -import shutil -import tarfile -import tempfile - -_V8_MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)") -_V8_MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)") -_V8_BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)") -_V8_PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)") - -_V8_PATTERNS = [ - _V8_MAJOR_VERSION_PATTERN, - _V8_MINOR_VERSION_PATTERN, - _V8_BUILD_NUMBER_PATTERN, - _V8_PATCH_LEVEL_PATTERN] - -def v8_extract_version(version_contents): - """ - Returns version number as string based on the string - contents of version.cc file. - """ - version_components = [] - for pattern in _V8_PATTERNS: - version_components.append(pattern.search(version_contents).group(1).strip()) - - if version_components[len(version_components) - 1] == '0': - version_components.pop() - - return '.'.join(version_components) - -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 = 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 |