summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-01-20 15:54:29 +0100
committerPawel Hajdan, Jr <phajdan.jr@gentoo.org>2011-01-20 16:05:10 +0100
commitf792011e6f123644dfd8e79004a73964c6f99c99 (patch)
tree7102cb479118a5e53a3cff1f7a6c26a52eb9532b
parentMake subversion dependency optional. (diff)
downloadchromium-tools-f792011e6f123644dfd8e79004a73964c6f99c99.tar.gz
chromium-tools-f792011e6f123644dfd8e79004a73964c6f99c99.tar.bz2
chromium-tools-f792011e6f123644dfd8e79004a73964c6f99c99.zip
Double-check version.cc when creating the tarball.
Sometimes upstream mistags the releases.
-rw-r--r--.gitignore1
-rw-r--r--chromium_tools.py28
-rw-r--r--setup.py1
-rwxr-xr-xv8-create-tarball10
-rwxr-xr-xv8-extract-version21
5 files changed, 42 insertions, 19 deletions
diff --git a/.gitignore b/.gitignore
index 551698e..b057d7f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
MANIFEST
+*.pyc
diff --git a/chromium_tools.py b/chromium_tools.py
new file mode 100644
index 0000000..9fbf9f9
--- /dev/null
+++ b/chromium_tools.py
@@ -0,0 +1,28 @@
+"""Common utilities for chromium-tools scripts."""
+
+import re
+
+_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)
diff --git a/setup.py b/setup.py
index 685eefe..2c1b88d 100644
--- a/setup.py
+++ b/setup.py
@@ -74,6 +74,7 @@ if enable_subversion:
setup(
name="chromium-tools",
version=get_version(),
+ py_modules=["chromium_tools"],
scripts=scripts,
cmdclass=cmdclass,
script_args=args
diff --git a/v8-create-tarball b/v8-create-tarball
index 08d8b06..8306819 100755
--- a/v8-create-tarball
+++ b/v8-create-tarball
@@ -11,6 +11,8 @@ 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:
@@ -29,6 +31,13 @@ try:
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')
@@ -40,3 +49,4 @@ try:
archive.close()
finally:
shutil.rmtree(tmpdir)
+ pass
diff --git a/v8-extract-version b/v8-extract-version
index a6e271b..277df29 100755
--- a/v8-extract-version
+++ b/v8-extract-version
@@ -4,25 +4,8 @@
"""Extracts V8 version number based on given version.cc file."""
-import re
import sys
-MAJOR_VERSION_PATTERN = re.compile(r"#define\s+MAJOR_VERSION\s+(.*)")
-MINOR_VERSION_PATTERN = re.compile(r"#define\s+MINOR_VERSION\s+(.*)")
-BUILD_NUMBER_PATTERN = re.compile(r"#define\s+BUILD_NUMBER\s+(.*)")
-PATCH_LEVEL_PATTERN = re.compile(r"#define\s+PATCH_LEVEL\s+(.*)")
+import chromium_tools
-patterns = [MAJOR_VERSION_PATTERN,
- MINOR_VERSION_PATTERN,
- BUILD_NUMBER_PATTERN,
- PATCH_LEVEL_PATTERN]
-
-source = open(sys.argv[1]).read()
-version_components = []
-for pattern in patterns:
- version_components.append(pattern.search(source).group(1).strip())
-
-if version_components[len(version_components) - 1] == '0':
- version_components.pop()
-
-print '.'.join(version_components)
+print chromium_tools.v8_extract_version(open(sys.argv[1]).read())