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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 # Run deps2git if there is a DEPS change after the last .DEPS.git commit. | 1331 # Run deps2git if there is a DEPS change after the last .DEPS.git commit. |
1332 for solution in solutions: | 1332 for solution in solutions: |
1333 ensure_deps2git(solution, shallow, git_cache_dir) | 1333 ensure_deps2git(solution, shallow, git_cache_dir) |
1334 | 1334 |
1335 # Ensure our build/ directory is set up with the correct .gclient file. | 1335 # Ensure our build/ directory is set up with the correct .gclient file. |
1336 gclient_configure(solutions, target_os, target_os_only, git_cache_dir) | 1336 gclient_configure(solutions, target_os, target_os_only, git_cache_dir) |
1337 | 1337 |
1338 # Let gclient do the DEPS syncing. | 1338 # Let gclient do the DEPS syncing. |
1339 # The branch-head refspec is a special case because its possible Chrome | 1339 # The branch-head refspec is a special case because its possible Chrome |
1340 # src, which contains the branch-head refspecs, is DEPSed in. | 1340 # src, which contains the branch-head refspecs, is DEPSed in. |
1341 with_branch_heads = (buildspec or BRANCH_HEADS_REFSPEC in refs) | 1341 gclient_output = gclient_sync(buildspec or BRANCH_HEADS_REFSPEC in refs, |
1342 gclient_output = gclient_sync(with_branch_heads, shallow) | 1342 shallow) |
1343 | 1343 |
1344 # Now that gclient_sync has finished, we should revert any .DEPS.git so that | 1344 # Now that gclient_sync has finished, we should revert any .DEPS.git so that |
1345 # presubmit doesn't complain about it being modified. | 1345 # presubmit doesn't complain about it being modified. |
1346 if (not buildspec and | 1346 if (not buildspec and |
1347 git('ls-files', '.DEPS.git', cwd=first_sln).strip()): | 1347 git('ls-files', '.DEPS.git', cwd=first_sln).strip()): |
1348 git('checkout', 'HEAD', '--', '.DEPS.git', cwd=first_sln) | 1348 git('checkout', 'HEAD', '--', '.DEPS.git', cwd=first_sln) |
1349 | 1349 |
1350 if buildspec and runhooks: | 1350 if buildspec and runhooks: |
1351 # Run gclient runhooks if we're on an official builder. | 1351 # Run gclient runhooks if we're on an official builder. |
1352 # TODO(hinoka): Remove this when the official builders run their own | 1352 # TODO(hinoka): Remove this when the official builders run their own |
1353 # runhooks step. | 1353 # runhooks step. |
1354 gclient_runhooks(gyp_env) | 1354 gclient_runhooks(gyp_env) |
1355 | 1355 |
1356 # Finally, ensure that all DEPS are pinned to the correct revision. | 1356 # Finally, ensure that all DEPS are pinned to the correct revision. |
1357 dir_names = [sln['name'] for sln in solutions] | 1357 dir_names = [sln['name'] for sln in solutions] |
1358 ensure_deps_revisions(gclient_output.get('solutions', {}), | 1358 ensure_deps_revisions(gclient_output.get('solutions', {}), |
1359 dir_names, revisions) | 1359 dir_names, revisions) |
1360 # Apply the rest of the patch here (sans DEPS) | 1360 # Apply the rest of the patch here (sans DEPS) |
1361 if patches: | 1361 if patches: |
1362 apply_svn_patch(patch_root, patches, blacklist=already_patched) | 1362 apply_svn_patch(patch_root, patches, blacklist=already_patched) |
1363 elif issue: | 1363 elif issue: |
1364 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, | 1364 apply_rietveld_issue(issue, patchset, patch_root, rietveld_server, |
1365 revision_mapping, git_ref, apply_issue_email_file, | 1365 revision_mapping, git_ref, apply_issue_email_file, |
1366 apply_issue_key_file, blacklist=already_patched) | 1366 apply_issue_key_file, blacklist=already_patched) |
1367 elif gerrit_ref: | 1367 elif gerrit_ref: |
1368 apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset) | 1368 apply_gerrit_ref(gerrit_repo, gerrit_ref, patch_root, gerrit_reset) |
1369 gclient_sync(with_branch_heads, shallow) | |
1370 | 1369 |
1371 # Reset the deps_file point in the solutions so that hooks get run properly. | 1370 # Reset the deps_file point in the solutions so that hooks get run properly. |
1372 for sln in solutions: | 1371 for sln in solutions: |
1373 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') | 1372 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') |
1374 gclient_configure(solutions, target_os, target_os_only, git_cache_dir) | 1373 gclient_configure(solutions, target_os, target_os_only, git_cache_dir) |
1375 | 1374 |
1376 return gclient_output | 1375 return gclient_output |
1377 | 1376 |
1378 | 1377 |
1379 def parse_revisions(revisions, root): | 1378 def parse_revisions(revisions, root): |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1756 except Exception: | 1755 except Exception: |
1757 # Unexpected failure. | 1756 # Unexpected failure. |
1758 emit_flag(options.flag_file) | 1757 emit_flag(options.flag_file) |
1759 raise | 1758 raise |
1760 else: | 1759 else: |
1761 emit_flag(options.flag_file) | 1760 emit_flag(options.flag_file) |
1762 | 1761 |
1763 | 1762 |
1764 if __name__ == '__main__': | 1763 if __name__ == '__main__': |
1765 sys.exit(main()) | 1764 sys.exit(main()) |
OLD | NEW |