Use --gclientfile instead of --spec, because windows is THE WORST.

--spec contains newlines, which are interpreted as actual newlines in the
command line, which causes gclient to fall apart at the seams.

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

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6944 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/.gitignore b/.gitignore
index 64ccdd5..2535251 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,6 +37,7 @@
 /Makefile
 /build
 /buildtools
+/chromium/.gclient.bot
 /chromium/.gclient_entries
 /chromium/.last_sync_chromium
 /chromium/src
diff --git a/sync_chromium.py b/sync_chromium.py
index 5bd7245..91d038c 100755
--- a/sync_chromium.py
+++ b/sync_chromium.py
@@ -60,19 +60,22 @@
     args.append('-vvv')
 
     if sys.platform.startswith('win'):
-      cache_path = os.path.join(os.path.splitdrive(ROOT_DIR)[0],
+      cache_path = os.path.join(os.path.splitdrive(ROOT_DIR)[0] + os.path.sep,
                                 'b', 'git-cache')
     else:
       cache_path = '/b/git-cache'
 
-    with open(os.path.join(opts.chromium_dir, '.gclient'), 'rb') as spec:
+    gclientfile = os.path.join(opts.chromium_dir, '.gclient')
+    with open(gclientfile, 'rb') as spec:
       spec = spec.read().splitlines()
       spec[-1] = 'cache_dir = %r' % (cache_path,)
-      args.append('--spec')
-      args.append('\n'.join(spec))
-      args.append('--delete_unversioned_trees')
-      args.append('--reset')
-      args.append('--upstream')
+    with open(gclientfile + '.bot', 'wb') as f:
+      f.write('\n'.join(spec))
+
+    args += [
+      '--gclientfile', '.gclient.bot',
+      '--delete_unversioned_trees', '--reset', '--upstream'
+    ]
   else:
     args.append('--no-history')