Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Unified Diff: tools/release/backport_node.py

Issue 2846883002: [tools] backport_node.py increments V8 version in target. (Closed)
Patch Set: sort imports Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/release/test_backport_node.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/release/backport_node.py
diff --git a/tools/release/backport_node.py b/tools/release/backport_node.py
index 61a931aa03452e18f07c55b63f0c7cf309ad648b..862da82b1e864fe03ac9cf5d54cb7423b05c283d 100755
--- a/tools/release/backport_node.py
+++ b/tools/release/backport_node.py
@@ -14,7 +14,8 @@ Usage:
$ backport_node.py <path_to_v8> <path_to_node> <commit-hash>
This will apply the commit to <path_to_node>/deps/v8 and create a commit in
- the Node.js checkout and copy over the original commit message.
+ the Node.js checkout, increment patch level, and copy over the original
+ commit message.
Optional flags:
--no-review Run `gclient sync` on the V8 checkout before updating.
@@ -23,9 +24,19 @@ Optional flags:
import argparse
import os
import subprocess
+import re
import sys
+from common_includes import *
+
TARGET_SUBDIR = os.path.join("deps", "v8")
+VERSION_FILE = os.path.join("include", "v8-version.h")
+VERSION_PATTERN = r'(?<=#define V8_PATCH_LEVEL )\d+'
+
+def Clean(options):
+ print ">> Cleaning target directory."
+ subprocess.check_call(["git", "clean", "-fd"],
+ cwd = os.path.join(options.node_path, TARGET_SUBDIR))
def CherryPick(options):
print ">> Apply patch."
@@ -42,6 +53,16 @@ def CherryPick(options):
while raw_input("[RESOLVED]") != "RESOLVED":
print ">> You need to type RESOLVED"
+def UpdateVersion(options):
+ print ">> Increment patch level."
+ version_file = os.path.join(options.node_path, TARGET_SUBDIR, VERSION_FILE)
+ text = FileToText(version_file)
+ def increment(match):
+ patch = int(match.group(0))
+ return str(patch + 1)
+ text = re.sub(VERSION_PATTERN, increment, text, flags=re.MULTILINE)
+ TextToFile(text, version_file)
+
def CreateCommit(options):
print ">> Creating commit."
# Find short hash from source.
@@ -84,8 +105,10 @@ def ParseOptions(args):
def Main(args):
options = ParseOptions(args)
+ Clean(options)
try:
CherryPick(options)
+ UpdateVersion(options)
CreateCommit(options)
except:
print ">> Failed. Resetting."
« no previous file with comments | « no previous file | tools/release/test_backport_node.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698