aboutsummaryrefslogtreecommitdiffhomepage
path: root/bin
diff options
context:
space:
mode:
authorGravatar Hal Canary <halcanary@google.com>2017-01-27 10:59:40 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-27 16:03:35 +0000
commit4d3adb6b0dea1c9f74fc00b007dfb1af425fc727 (patch)
tree23b7e8589597dbc996ecf431539e86f8e69993cb /bin
parent3500b77f7d08dbe4c17811733cc3e4dbab889f0a (diff)
bin/sync : call tools/git-sync-deps now
Also, update some docs. NOTRY=true Change-Id: I7ad3375fc1cbf8f71ed42a460ecfe29ef6c1d85e Reviewed-on: https://skia-review.googlesource.com/7657 Reviewed-by: Hal Canary <halcanary@google.com> Commit-Queue: Hal Canary <halcanary@google.com>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sync67
1 files changed, 18 insertions, 49 deletions
diff --git a/bin/sync b/bin/sync
index d95d4a82b7..163584d6e1 100755
--- a/bin/sync
+++ b/bin/sync
@@ -7,7 +7,7 @@
# This script will update Skia's dependencies as necessary.
-# Depends on: Python, Git, and depot_tools.
+# Depends on: Python and Git
# To retreive and use all optional deps:
#
@@ -18,67 +18,36 @@ import os
import subprocess
import sys
-skia_dir = os.path.join(os.path.dirname(__file__), os.pardir)
+HASH_FILE = '.deps_sha1'
+DEPS_FLAG = '--deps='
+DEPS_FILE = 'DEPS'
-skia_opt_deps = [arg for arg in sys.argv[1:] if arg.startswith('--deps=')]
+skia_opt_deps = [arg[len(DEPS_FLAG):] for arg in sys.argv[1:] if arg.startswith(DEPS_FLAG)]
-os.chdir(skia_dir)
+os.chdir(os.path.join(os.path.dirname(__file__), os.pardir))
-if not os.path.isfile('DEPS'):
+if not os.path.isfile(DEPS_FILE):
sys.stderr.write('DEPS file missing')
exit(1)
deps_hasher = hashlib.sha1()
-with open('DEPS', 'r') as f:
+with open(DEPS_FILE, 'r') as f:
deps_hasher.update(f.read())
deps_hasher.update(repr(skia_opt_deps))
deps_hash = deps_hasher.hexdigest()
current_deps_hash = None
-if os.path.isfile('.deps_sha1'):
- with open('.deps_sha1', 'r') as f:
+if os.path.isfile(HASH_FILE):
+ with open(HASH_FILE, 'r') as f:
current_deps_hash = f.read().strip()
-default_gclient_config = '''
-solutions = [
- { "name" : ".",
- "url" : "https://skia.googlesource.com/skia.git",
- "deps_file" : "DEPS",
- "managed" : False,
- "custom_deps" : {
- },
- "safesync_url": "",
- },
-]
-cache_dir = None
-'''
-
-# Must use gclient.bat rather than gclient on windows (at least on mingw)
-gclient = 'gclient'
-if sys.platform == 'win32' or sys.platform == 'cygwin':
- gclient = 'gclient.bat'
-
if current_deps_hash != deps_hash:
- # `gclient sync` is very slow, so skip whenever we can.
- try:
- subprocess.call([gclient, '--version'])
- except:
- sys.stdout.write('gclient missing from $PATH, please install ' +
- 'depot_tools\n https://skia.org/user/quick/desktop\n')
- exit(1)
- if not os.path.isfile('.gclient'):
- with open('.gclient', 'w') as o:
- o.write(default_gclient_config)
- command = [gclient, 'sync'] + skia_opt_deps
- try:
- sys.stdout.write('%r\n' % command)
- subprocess.check_call(command)
- except:
- sys.stderr.write('\n%r failed.\n' % command)
- try:
- os.remove('.deps_sha1') # Unknown state.
- except:
- pass
- exit(1)
+ if os.path.isfile(HASH_FILE):
+ os.remove(HASH_FILE)
+ command = [sys.executable, os.path.join('tools', 'git-sync-deps')]
+ command.extend(skia_opt_deps)
+ sys.stdout.write('%r\n' % command)
+ sys.stdout.flush()
+ subprocess.check_call(command)
# Only write hash after a successful sync.
- with open('.deps_sha1', 'w') as o:
+ with open(HASH_FILE, 'w') as o:
o.write(deps_hash)