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
diff --git a/sync_chromium.py b/sync_chromium.py
index 91d038c..af7a622 100755
--- a/sync_chromium.py
+++ b/sync_chromium.py
@@ -12,6 +12,9 @@
 import subprocess
 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__))
 
@@ -39,12 +42,19 @@
   opts = p.parse_args()
   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
   # sooper fast.
   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):
     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
         return 0
     os.unlink(flag_file)
@@ -79,7 +89,6 @@
   else:
     args.append('--no-history')
 
-  target_os_list = get_target_os_list()
   if target_os_list:
     args += ['--deps=' + target_os_list]
 
@@ -87,7 +96,7 @@
   ret = subprocess.call(args, cwd=opts.chromium_dir, env=env)
   if ret == 0:
     with open(flag_file, 'wb') as f:
-      f.write(opts.target_revision)
+      f.write(flag_file_content)
 
   return ret