Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 # TODO(hinoka): Use logging. | 6 # TODO(hinoka): Use logging. |
| 7 | 7 |
| 8 import cStringIO | 8 import cStringIO |
| 9 import codecs | 9 import codecs |
| 10 import collections | 10 import collections |
| (...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1250 # Get a checkout of each solution, without DEPS or hooks. | 1250 # Get a checkout of each solution, without DEPS or hooks. |
| 1251 # Calling git directly because there is no way to run Gclient without | 1251 # Calling git directly because there is no way to run Gclient without |
| 1252 # invoking DEPS. | 1252 # invoking DEPS. |
| 1253 print 'Fetching Git checkout' | 1253 print 'Fetching Git checkout' |
| 1254 git_ref = git_checkout(solutions, revisions, shallow, with_branch_heads) | 1254 git_ref = git_checkout(solutions, revisions, shallow, with_branch_heads) |
| 1255 | 1255 |
| 1256 patches = None | 1256 patches = None |
| 1257 if patch_url: | 1257 if patch_url: |
| 1258 patches = get_svn_patch(patch_url) | 1258 patches = get_svn_patch(patch_url) |
| 1259 | 1259 |
| 1260 already_patched = [] | |
| 1260 for solution in solutions: | 1261 for solution in solutions: |
| 1261 # At first, only patch top-level DEPS. | 1262 if (patch_root == solution['name'] or |
| 1262 if patch_root == solution['name']: | 1263 solution['name'].startswith(patch_root + '/')): |
| 1264 relative_root = solution['name'][len(patch_root) + 1:] | |
|
Ryan Tseng
2014/09/08 18:00:45
blerg, I was trying to do this with more posixpath
agable
2014/09/08 18:23:24
This is the generic path way. The only additional
| |
| 1265 target = '/'.join([relative_root, 'DEPS']).lstrip('/') | |
| 1263 if patches: | 1266 if patches: |
| 1264 apply_svn_patch(patch_root, patches, whitelist=['DEPS']) | 1267 apply_svn_patch(patch_root, patches, whitelist=[target]) |
| 1268 already_patched.append(target) | |
|
Ryan Tseng
2014/09/08 18:00:45
This can be done outside of the if/else block (and
agable
2014/09/08 18:23:24
I'd only be comfortable doing that if the below wa
| |
| 1265 elif issue: | 1269 elif issue: |
| 1266 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, | 1270 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, |
| 1267 revision_mapping, git_ref, whitelist=['DEPS']) | 1271 revision_mapping, git_ref, whitelist=[target]) |
| 1268 break | 1272 already_patched.append(target) |
| 1269 | 1273 |
| 1270 if buildspec: | 1274 if buildspec: |
| 1271 buildspecs2git(first_sln, buildspec) | 1275 buildspecs2git(first_sln, buildspec) |
| 1272 else: | 1276 else: |
| 1273 # Run deps2git if there is a DEPS change after the last .DEPS.git commit. | 1277 # Run deps2git if there is a DEPS change after the last .DEPS.git commit. |
| 1274 for solution in solutions: | 1278 for solution in solutions: |
| 1275 ensure_deps2git(solution, shallow) | 1279 ensure_deps2git(solution, shallow) |
| 1276 | 1280 |
| 1277 # Ensure our build/ directory is set up with the correct .gclient file. | 1281 # Ensure our build/ directory is set up with the correct .gclient file. |
| 1278 gclient_configure(solutions, target_os, target_os_only) | 1282 gclient_configure(solutions, target_os, target_os_only) |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1291 # TODO(hinoka): Remove this when the official builders run their own | 1295 # TODO(hinoka): Remove this when the official builders run their own |
| 1292 # runhooks step. | 1296 # runhooks step. |
| 1293 gclient_runhooks(gyp_env) | 1297 gclient_runhooks(gyp_env) |
| 1294 | 1298 |
| 1295 # Finally, ensure that all DEPS are pinned to the correct revision. | 1299 # Finally, ensure that all DEPS are pinned to the correct revision. |
| 1296 dir_names = [sln['name'] for sln in solutions] | 1300 dir_names = [sln['name'] for sln in solutions] |
| 1297 ensure_deps_revisions(gclient_output.get('solutions', {}), | 1301 ensure_deps_revisions(gclient_output.get('solutions', {}), |
| 1298 dir_names, revisions) | 1302 dir_names, revisions) |
| 1299 # Apply the rest of the patch here (sans DEPS) | 1303 # Apply the rest of the patch here (sans DEPS) |
| 1300 if patches: | 1304 if patches: |
| 1301 apply_svn_patch(patch_root, patches, blacklist=['DEPS']) | 1305 apply_svn_patch(patch_root, patches, blacklist=already_patched) |
| 1302 elif issue: | 1306 elif issue: |
| 1303 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, | 1307 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, |
| 1304 revision_mapping, git_ref, blacklist=['DEPS']) | 1308 revision_mapping, git_ref, blacklist=already_patched) |
| 1305 | 1309 |
| 1306 # Reset the deps_file point in the solutions so that hooks get run properly. | 1310 # Reset the deps_file point in the solutions so that hooks get run properly. |
| 1307 for sln in solutions: | 1311 for sln in solutions: |
| 1308 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') | 1312 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') |
| 1309 gclient_configure(solutions, target_os, target_os_only) | 1313 gclient_configure(solutions, target_os, target_os_only) |
| 1310 | 1314 |
| 1311 return gclient_output | 1315 return gclient_output |
| 1312 | 1316 |
| 1313 | 1317 |
| 1314 def parse_revisions(revisions, root): | 1318 def parse_revisions(revisions, root): |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1636 except Exception: | 1640 except Exception: |
| 1637 # Unexpected failure. | 1641 # Unexpected failure. |
| 1638 emit_flag(options.flag_file) | 1642 emit_flag(options.flag_file) |
| 1639 raise | 1643 raise |
| 1640 else: | 1644 else: |
| 1641 emit_flag(options.flag_file) | 1645 emit_flag(options.flag_file) |
| 1642 | 1646 |
| 1643 | 1647 |
| 1644 if __name__ == '__main__': | 1648 if __name__ == '__main__': |
| 1645 sys.exit(main()) | 1649 sys.exit(main()) |
| OLD | NEW |