Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/python | |
| 2 # Copyright 2014 Google Inc. | |
| 3 # | |
| 4 # Use of this source code is governed by a BSD-style license that can be | |
| 5 # found in the LICENSE file. | |
| 6 | |
| 7 | |
| 8 import sys | |
| 9 import os | |
| 10 import subprocess | |
| 11 import git_utils | |
| 12 import subprocess | |
| 13 import misc_utils | |
| 14 | |
| 15 | |
| 16 deps = { | |
|
borenet
2014/03/10 18:36:12
We should definitely be reading the DEPS file inst
hal.canary
2014/03/10 20:03:08
Why write a parser?
epoger
2014/03/10 20:11:39
Because certain important users of Skia use DEPS f
borenet
2014/03/10 20:13:30
No parser is needed; we can do something like:
env
| |
| 17 "ALL" : { | |
| 18 "third_party/externals/depot_tools" : ( | |
|
tfarina
2014/03/10 19:00:21
Then why we need an 'extra' copy of depot_tools. W
| |
| 19 'https://chromium.googlesource.com/chromium/tools/depot_tools.git', | |
| 20 None # None means 'track origin/master' | |
| 21 ), | |
| 22 "third_party/externals/angle" : ( | |
| 23 "https://chromium.googlesource.com/external/angleproject.git", | |
| 24 None | |
| 25 ), | |
| 26 "third_party/externals/fontconfig" : ( | |
| 27 "https://skia.googlesource.com/third_party/fontconfig.git", | |
| 28 "2.11.0" | |
| 29 ), | |
| 30 "third_party/externals/freetype" : ( | |
| 31 "https://skia.googlesource.com/third_party/freetype2.git", | |
| 32 "VER-2-5-0-1" | |
| 33 ), | |
| 34 "third_party/externals/gyp" : ( | |
| 35 "https://chromium.googlesource.com/external/gyp.git", | |
| 36 "5917c6a6b77c9e97a0cbb66847194381bd36ec4c" | |
| 37 ), | |
| 38 "third_party/externals/iconv" : ( | |
| 39 "https://skia.googlesource.com/third_party/libiconv.git", | |
| 40 "v1.14" | |
| 41 ), | |
| 42 "third_party/externals/libjpeg" : ( | |
| 43 "https://chromium.googlesource.com/chromium/deps/libjpeg_turbo.git", | |
| 44 "82ce8a6d4ebe12a177c0c3597192f2b4f09e81c3" | |
| 45 ), | |
| 46 "third_party/externals/jsoncpp" : ( | |
| 47 "https://chromium.googlesource.com/external/jsoncpp/jsoncpp.git", | |
| 48 "ab1e40f3bce061ea6f9bdc60351d6cde2a4f872b", | |
| 49 ), | |
| 50 "third_party/externals/jsoncpp-chromium" : ( | |
| 51 "https://chromium.googlesource.com/chromium/src/third_party/jsoncpp.git", | |
| 52 "41239939c0c60481f34887d52c038facf05f5533" | |
| 53 ), | |
| 54 "third_party/externals/libwebp" : ( | |
| 55 "https://chromium.googlesource.com/webm/libwebp.git", | |
| 56 "3fe91635df8734b23f3c1b9d1f0c4fa8cfaf4e39" | |
| 57 ), | |
| 58 "third_party/externals/poppler" : ( | |
| 59 "https://skia.googlesource.com/third_party/poppler.git", | |
| 60 "poppler-0.22.5", | |
| 61 ), | |
| 62 }, | |
| 63 "android" : { | |
| 64 "platform_tools/android/third_party/externals/expat" : ( | |
| 65 "https://android.googlesource.com/platform/external/expat.git", | |
| 66 "android-4.2.2_r1.2", | |
| 67 ), | |
| 68 "platform_tools/android/third_party/externals/gif" : ( | |
| 69 "https://android.googlesource.com/platform/external/giflib.git", | |
| 70 "android-4.2.2_r1.2", | |
| 71 ), | |
| 72 "platform_tools/android/third_party/externals/png" : ( | |
| 73 "https://android.googlesource.com/platform/external/libpng.git", | |
| 74 "android-4.2.2_r1.2", | |
| 75 ), | |
| 76 "platform_tools/android/third_party/externals/jpeg" : ( | |
| 77 "https://android.googlesource.com/platform/external/jpeg.git", | |
| 78 "android-4.2.2_r1.2", | |
| 79 ), | |
| 80 }, | |
| 81 "chromeos" : { | |
| 82 "platform_tools/chromeos/third_party/externals/gif" : ( | |
| 83 "https://android.googlesource.com/platform/external/giflib.git", | |
| 84 "android-4.2.2_r1.2", | |
| 85 ), | |
| 86 "platform_tools/chromeos/toolchain/src/third_party/chromite" : ( | |
| 87 "https://chromium.googlesource.com/chromiumos/chromite.git", | |
| 88 "d6a4c7e0ee4d53ddc5238dbddfc0417796a70e54", | |
| 89 ), | |
| 90 "platform_tools/chromeos/toolchain/src/third_party/pyelftools" : ( | |
| 91 "https://chromium.googlesource.com/chromiumos/third_party/pyelftools.git", | |
| 92 "bdc1d380acd88d4bfaf47265008091483b0d614e", | |
| 93 ), | |
| 94 }, | |
| 95 # barelinux is a DEPS target that has no shared libraries to link | |
| 96 # to, similar to android or chromeos. | |
| 97 "barelinux" : { | |
| 98 "third_party/externals/giflib" : ( | |
| 99 "https://android.googlesource.com/platform/external/giflib.git", | |
| 100 "android-4.2.2_r1.2", | |
| 101 ), | |
| 102 "third_party/externals/libpng" : ( | |
| 103 "https://android.googlesource.com/platform/external/libpng.git", | |
| 104 "android-4.2.2_r1.2", | |
| 105 ), | |
| 106 "third_party/externals/zlib" : ( | |
| 107 "https://android.googlesource.com/platform/external/zlib.git", | |
| 108 "android-4.2.2_r1.2", | |
| 109 ), | |
| 110 } | |
| 111 } | |
| 112 | |
| 113 | |
| 114 def git_checkout_to_directory(repo, checkout, directory): | |
| 115 """TODO(halcanary): document this function. | |
| 116 """ | |
| 117 git = git_utils.git_executable() | |
| 118 assert git | |
| 119 git_path = os.path.join(directory, '.git') | |
| 120 if os.path.exists(directory) and not os.path.isdir(git_path): | |
| 121 if os.path.isdir(directory) and not os.path.islink(directory): | |
| 122 shutil.rmtree(directory) | |
| 123 elif os.path.isdir(directory) and not os.path.islink(directory): | |
| 124 os.remove(directory) | |
| 125 if not os.path.isdir(directory): | |
| 126 subprocess.check_call([git, 'clone', repo, directory]) | |
| 127 subprocess.check_call([git, 'fetch']) | |
| 128 with misc_utils.ChangeDir(directory): | |
| 129 if not checkout: | |
| 130 checkout = 'origin/master' | |
| 131 print '>>>>', repo | |
| 132 print '>>>>', checkout | |
| 133 subprocess.check_call([git, 'checkout', '--quiet', checkout]) | |
| 134 print | |
|
borenet
2014/03/10 18:36:12
I'd like to simplify this logic. I think we can m
hal.canary
2014/03/10 20:03:08
Your logic is fine, but I prefer git-checkout to g
borenet
2014/03/10 20:13:30
Why? Just curious. IMO reset is nice because it
| |
| 135 | |
| 136 | |
| 137 def main(argv): | |
| 138 dependencies = deps["ALL"].copy() | |
| 139 for arg in argv: | |
| 140 if arg not in deps: | |
| 141 print arg, '?' | |
| 142 exit(1) | |
| 143 for dep in deps[arg]: | |
| 144 dependencies[dep] = deps[arg][dep] | |
| 145 for directory in dependencies: | |
| 146 repo, checkout = dependencies[directory] | |
| 147 git_checkout_to_directory(repo, checkout, directory) | |
| 148 | |
| 149 | |
| 150 if __name__ == '__main__': | |
| 151 main(sys.argv[1:]) | |
| 152 | |
| OLD | NEW |