| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """ Create (if needed) and sync a nested checkout of Skia inside of Chrome. """ | 6 """ Create (if needed) and sync a nested checkout of Skia inside of Chrome. """ |
| 7 | 7 |
| 8 from config_private import SKIA_GIT_URL | 8 from config_private import SKIA_GIT_URL |
| 9 from common import chromium_utils | 9 from common import chromium_utils |
| 10 from optparse import OptionParser | 10 from optparse import OptionParser |
| 11 | 11 |
| 12 from git_utils import GIT | 12 from git_utils import GIT |
| 13 import gclient_utils | 13 import gclient_utils |
| 14 import git_utils |
| 14 import os | 15 import os |
| 15 import re | 16 import re |
| 16 import shell_utils | 17 import shell_utils |
| 17 import shlex | 18 import shlex |
| 18 import sys | 19 import sys |
| 19 import urllib2 | 20 import urllib2 |
| 20 | 21 |
| 21 | 22 |
| 22 CHROME_LKGR_URL = 'http://chromium-status.appspot.com/git-lkgr' | 23 CHROME_LKGR_URL = 'http://chromium-status.appspot.com/git-lkgr' |
| 23 FETCH = 'fetch.bat' if os.name == 'nt' else 'fetch' | 24 FETCH = 'fetch.bat' if os.name == 'nt' else 'fetch' |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 DEPS file. | 56 DEPS file. |
| 56 override_skia_checkout: boolean; whether or not to replace the default Skia | 57 override_skia_checkout: boolean; whether or not to replace the default Skia |
| 57 checkout, which is actually a set of three subdirectory checkouts in | 58 checkout, which is actually a set of three subdirectory checkouts in |
| 58 third_party/skia: src, include, and gyp, with a single checkout of skia at | 59 third_party/skia: src, include, and gyp, with a single checkout of skia at |
| 59 the root level. Default is True. | 60 the root level. Default is True. |
| 60 fetch_target: string; Calls the fetch tool in depot_tools with the specified | 61 fetch_target: string; Calls the fetch tool in depot_tools with the specified |
| 61 argument. Default is DEFAULT_FETCH_TARGET. | 62 argument. Default is DEFAULT_FETCH_TARGET. |
| 62 """ | 63 """ |
| 63 # Figure out what revision of Skia we should use. | 64 # Figure out what revision of Skia we should use. |
| 64 if not skia_revision: | 65 if not skia_revision: |
| 65 output = shell_utils.run([GIT, 'ls-remote', SKIA_GIT_URL, '--verify', | 66 output = git_utils.GetRemoteMasterHash(SKIA_GIT_URL) |
| 66 'refs/heads/master']) | |
| 67 if output: | 67 if output: |
| 68 skia_revision = shlex.split(output)[0] | 68 skia_revision = shlex.split(output)[0] |
| 69 if not skia_revision: | 69 if not skia_revision: |
| 70 raise Exception('Could not determine current Skia revision!') | 70 raise Exception('Could not determine current Skia revision!') |
| 71 skia_revision = str(skia_revision) | 71 skia_revision = str(skia_revision) |
| 72 | 72 |
| 73 # Use Chrome LKGR, since gclient_utils will force a sync to origin/master. | 73 # Use Chrome LKGR, since gclient_utils will force a sync to origin/master. |
| 74 if not chrome_revision: | 74 if not chrome_revision: |
| 75 chrome_revision = urllib2.urlopen(CHROME_LKGR_URL).read() | 75 chrome_revision = urllib2.urlopen(CHROME_LKGR_URL).read() |
| 76 | 76 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 chrome_revision=options.chrome_revision, | 225 chrome_revision=options.chrome_revision, |
| 226 fetch_target=options.fetch_target) | 226 fetch_target=options.fetch_target) |
| 227 print 'Chrome synced to %s' % actual_chrome_rev | 227 print 'Chrome synced to %s' % actual_chrome_rev |
| 228 print 'Skia synced to %s' % actual_skia_rev | 228 print 'Skia synced to %s' % actual_skia_rev |
| 229 finally: | 229 finally: |
| 230 os.chdir(cur_dir) | 230 os.chdir(cur_dir) |
| 231 | 231 |
| 232 | 232 |
| 233 if __name__ == '__main__': | 233 if __name__ == '__main__': |
| 234 sys.exit(Main()) | 234 sys.exit(Main()) |
| OLD | NEW |