Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: recipe_modules/bot_update/resources/bot_update.py

Issue 1904663002: bot_update: call gclient sync after checking out a gerrit ref (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 gclient_output = gclient_sync(buildspec or BRANCH_HEADS_REFSPEC in refs, 1341 with_branch_heads = (buildspec or BRANCH_HEADS_REFSPEC in refs)
1342 shallow) 1342 gclient_output = gclient_sync(with_branch_heads, 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)
tandrii(chromium) 2016/04/20 11:41:19 so, is this normally calling gclient sync automati
Paweł Hajdan Jr. 2016/04/20 11:48:52 My understanding is that it isn't. However, there
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)
Yoshisato Yanagisawa 2016/04/21 02:47:33 For our use case, this might revert the changes by
Paweł Hajdan Jr. 2016/04/21 11:36:29 gclient sync shouldn't touch main solution when it
Yoshisato Yanagisawa 2016/04/22 01:05:20 Yes, I seems to misunderstand the behavior. I tho
1369 1370
1370 # Reset the deps_file point in the solutions so that hooks get run properly. 1371 # Reset the deps_file point in the solutions so that hooks get run properly.
1371 for sln in solutions: 1372 for sln in solutions:
1372 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS') 1373 sln['deps_file'] = sln.get('deps_file', 'DEPS').replace('.DEPS.git', 'DEPS')
1373 gclient_configure(solutions, target_os, target_os_only, git_cache_dir) 1374 gclient_configure(solutions, target_os, target_os_only, git_cache_dir)
1374 1375
1375 return gclient_output 1376 return gclient_output
1376 1377
1377 1378
1378 def parse_revisions(revisions, root): 1379 def parse_revisions(revisions, root):
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1755 except Exception: 1756 except Exception:
1756 # Unexpected failure. 1757 # Unexpected failure.
1757 emit_flag(options.flag_file) 1758 emit_flag(options.flag_file)
1758 raise 1759 raise
1759 else: 1760 else:
1760 emit_flag(options.flag_file) 1761 emit_flag(options.flag_file)
1761 1762
1762 1763
1763 if __name__ == '__main__': 1764 if __name__ == '__main__':
1764 sys.exit(main()) 1765 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698