Fix parsing of CLANG_REVISON from tools/clang/scripts/update.py

The regex didn't match the revision before after the switch
from tools/clang/scripts/update.sh to
tools/clang/scripts/update.py.
This should have been done in https://codereview.webrtc.org/1493683003
when the filename changed.

TESTED=Ran the script and verified parsing worked and showed
the currently pending Clang change in ongoing roll in
https://codereview.webrtc.org/1593713013/
NOTRY=True

Review URL: https://codereview.webrtc.org/1608813002

Cr-Commit-Position: refs/heads/master@{#11299}
This commit is contained in:
kjellander 2016-01-19 02:04:41 -08:00 committed by Commit bot
parent c4c8485662
commit 3860c7f873

View File

@ -26,7 +26,7 @@ CHROMIUM_LOG_TEMPLATE = CHROMIUM_SRC_URL + '/+log/%s'
CHROMIUM_FILE_TEMPLATE = CHROMIUM_SRC_URL + '/+/%s/%s'
COMMIT_POSITION_RE = re.compile('^Cr-Commit-Position: .*#([0-9]+).*$')
CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION=(\d+)$')
CLANG_REVISION_RE = re.compile(r'^CLANG_REVISION = \'(\d+)\'$')
ROLL_BRANCH_NAME = 'roll_chromium_revision'
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@ -48,6 +48,9 @@ DepsEntry = collections.namedtuple('DepsEntry', 'path url revision')
ChangedDep = collections.namedtuple('ChangedDep',
'path url current_rev new_rev')
class RollError(Exception):
pass
def ParseDepsDict(deps_content):
local_scope = {}
@ -234,7 +237,7 @@ def CalculateChangedClang(new_cr_rev):
match = CLANG_REVISION_RE.match(line)
if match:
return match.group(1)
return None
raise RollError('Could not parse Clang revision!')
chromium_src_path = os.path.join(CHECKOUT_ROOT_DIR, 'chromium', 'src',
CLANG_UPDATE_SCRIPT_LOCAL_PATH)
@ -242,9 +245,9 @@ def CalculateChangedClang(new_cr_rev):
current_lines = f.readlines()
current_rev = GetClangRev(current_lines)
new_clang_update_sh = ReadRemoteCrFile(CLANG_UPDATE_SCRIPT_URL_PATH,
new_cr_rev).splitlines()
new_rev = GetClangRev(new_clang_update_sh)
new_clang_update_py = ReadRemoteCrFile(CLANG_UPDATE_SCRIPT_URL_PATH,
new_cr_rev).splitlines()
new_rev = GetClangRev(new_clang_update_py)
return ChangedDep(CLANG_UPDATE_SCRIPT_LOCAL_PATH, None, current_rev, new_rev)