Make the last_sync_chromium file a bit more comprehensive.

Adds a SCRIPT_VERSION and the target_os_list to the flag file content. The
script version is so that we can arbitrarially make all slaves/devs re-sync (in
case we change the implementation but don't want to roll chromium), and the
target_os_list is so that devs who change the target_os_list in their .gclient
file don't mysteriously fail to get the new deps.

R=kjellander@webrtc.org, agable@chromium.org, szager@chromium.org
BUG=2863, chromium:339647

Review URL: https://webrtc-codereview.appspot.com/17189004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6952 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
iannucci@chromium.org
2014-08-21 15:48:23 +00:00
parent 153c6162d2
commit 161363808b

View File

@@ -12,6 +12,9 @@ import os
import subprocess import subprocess
import sys import sys
# Bump this whenever the algorithm changes and you need bots/devs to re-sync,
# ignoring the .last_sync_chromium file
SCRIPT_VERSION = 0
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) ROOT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -39,12 +42,19 @@ def main():
opts = p.parse_args() opts = p.parse_args()
opts.chromium_dir = os.path.abspath(opts.chromium_dir) opts.chromium_dir = os.path.abspath(opts.chromium_dir)
target_os_list = get_target_os_list()
# Do a quick check to see if we were successful last time to make runhooks # Do a quick check to see if we were successful last time to make runhooks
# sooper fast. # sooper fast.
flag_file = os.path.join(opts.chromium_dir, '.last_sync_chromium') flag_file = os.path.join(opts.chromium_dir, '.last_sync_chromium')
flag_file_content = '\n'.join([
str(SCRIPT_VERSION),
opts.target_revision,
repr(target_os_list),
])
if os.path.exists(flag_file): if os.path.exists(flag_file):
with open(flag_file, 'r') as f: with open(flag_file, 'r') as f:
if f.read() == opts.target_revision: if f.read() == flag_file_content:
print "Chromium already up to date:", opts.target_revision print "Chromium already up to date:", opts.target_revision
return 0 return 0
os.unlink(flag_file) os.unlink(flag_file)
@@ -79,7 +89,6 @@ def main():
else: else:
args.append('--no-history') args.append('--no-history')
target_os_list = get_target_os_list()
if target_os_list: if target_os_list:
args += ['--deps=' + target_os_list] args += ['--deps=' + target_os_list]
@@ -87,7 +96,7 @@ def main():
ret = subprocess.call(args, cwd=opts.chromium_dir, env=env) ret = subprocess.call(args, cwd=opts.chromium_dir, env=env)
if ret == 0: if ret == 0:
with open(flag_file, 'wb') as f: with open(flag_file, 'wb') as f:
f.write(opts.target_revision) f.write(flag_file_content)
return ret return ret