From d49733507b5b3ca115f992f99a30df1294adddb0 Mon Sep 17 00:00:00 2001 From: "kjellander@chromium.org" Date: Mon, 16 May 2016 20:44:53 +0000 Subject: [PATCH] Fix revision for WebRTC patches sent to Chromium trybots This will have the revision set properly to 'HEAD' before attempting to apply the patch. It should also solve the problem that analyze is ending up with no changes when running 'git diff'. Expectation update in: https://codereview.chromium.org/1984673002 BUG=438952 Review-Url: https://codereview.chromium.org/1977373002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300603 0039d316-1c4b-4281-b951-d872f2087c98 --- recipe_modules/gclient/api.py | 6 + recipe_modules/gclient/config.py | 6 +- .../tryserver_webrtc_patch.json | 186 ++++++++++++++++++ recipe_modules/gclient/example.py | 10 + 4 files changed, 205 insertions(+), 3 deletions(-) create mode 100644 recipe_modules/gclient/example.expected/tryserver_webrtc_patch.json diff --git a/recipe_modules/gclient/api.py b/recipe_modules/gclient/api.py index 7565fed62b..66576b6cdc 100644 --- a/recipe_modules/gclient/api.py +++ b/recipe_modules/gclient/api.py @@ -375,5 +375,11 @@ class GclientApi(recipe_api.RecipeApi): assert patch_project is None or isinstance(patch_project, basestring) cfg = gclient_config or self.c path, revision = cfg.patch_projects.get(patch_project, (None, None)) + + # TODO(kjellander): Remove this hack when http://crbug.com/611808 is fixed. + if patch_project == 'webrtc' and path == 'src/third_party': + assert revision == 'HEAD', 'revision was %s' % revision + path = 'src/third_party/webrtc' + if path and revision and path not in cfg.revisions: cfg.revisions[path] = revision diff --git a/recipe_modules/gclient/config.py b/recipe_modules/gclient/config.py index 66781b4918..df7aa31378 100644 --- a/recipe_modules/gclient/config.py +++ b/recipe_modules/gclient/config.py @@ -172,9 +172,9 @@ def chromium_bare(c): p['pdfium'] = ('src/third_party/pdfium', 'HEAD') p['skia'] = ('src/third_party/skia', 'HEAD') p['flac'] = ('src/third_party/flac', 'HEAD') - # TODO(kjellander): Change to the path below to src/third_party/webrtc mapping - # to 'HEAD' after http://crbug.com/611808 is fixed. - p['webrtc'] = ('src/third_party', None) + # TODO(kjellander): Change to the path below to src/third_party/webrtc after + # http://crbug.com/611808 is fixed. + p['webrtc'] = ('src/third_party', 'HEAD') @config_ctx(includes=['chromium_bare']) def chromium_empty(c): diff --git a/recipe_modules/gclient/example.expected/tryserver_webrtc_patch.json b/recipe_modules/gclient/example.expected/tryserver_webrtc_patch.json new file mode 100644 index 0000000000..8b17594c03 --- /dev/null +++ b/recipe_modules/gclient/example.expected/tryserver_webrtc_patch.json @@ -0,0 +1,186 @@ +[ + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "config", + "--spec", + "cache_dir = '[ROOT]/git_cache'\nsolutions = [{'deps_file': '.DEPS.git', 'managed': True, 'name': 'src', 'url': 'https://chromium.googlesource.com/chromium/src.git'}]" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient setup" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "sync", + "--verbose", + "--with_branch_heads", + "--nohooks", + "-j8", + "--reset", + "--force", + "--upstream", + "--no-nag-max", + "--delete_unversioned_trees", + "--revision", + "src@HEAD", + "--output-json", + "/path/to/tmp/json" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient sync", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"solutions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"src/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": \"f27fede2220bcd326aee3e86ddfd4ebd0fe58cb9\"@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.name", + "local_bot" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient recurse (git config user.name)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "recurse", + "git", + "config", + "user.email", + "local_bot@example.com" + ], + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient recurse (git config user.email)" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "config", + "--spec", + "cache_dir = '[GIT_CACHE]'\nsolutions = [{'deps_file': 'DEPS', 'managed': True, 'name': 'WebKit', 'safesync_url': 'https://blink-status.appspot.com/lkgr', 'url': 'svn://svn.chromium.org/blink/trunk'}]" + ], + "cwd": "[SLAVE_BUILD]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: WebKit] gclient setup" + }, + { + "cmd": [ + "python", + "-u", + "[BUILD]/scripts/slave/gclient_safe_revert.py", + ".", + "[DEPOT_TOOLS]/gclient" + ], + "cwd": "[SLAVE_BUILD]/src/third_party", + "name": "[spec: WebKit] gclient revert" + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "sync", + "--nohooks", + "--force", + "--verbose", + "--delete_unversioned_trees", + "--with_branch_heads", + "--revision", + "third_party/WebKit@123", + "--output-json", + "/path/to/tmp/json" + ], + "cwd": "[SLAVE_BUILD]/src/third_party", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "[spec: WebKit] gclient sync", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@json.output@{@@@", + "@@@STEP_LOG_LINE@json.output@ \"solutions\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"WebKit/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": 241198@@@", + "@@@STEP_LOG_LINE@json.output@ }, @@@", + "@@@STEP_LOG_LINE@json.output@ \"src/blatley/\": {@@@", + "@@@STEP_LOG_LINE@json.output@ \"revision\": 248087@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@ }@@@", + "@@@STEP_LOG_LINE@json.output@}@@@", + "@@@STEP_LOG_END@json.output@@@", + "@@@SET_BUILD_PROPERTY@got_blatley_revision@248087@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "\nimport os, sys\n\nbuild_path = sys.argv[1]\nif os.path.exists(build_path):\n for (path, dir, files) in os.walk(build_path):\n for cur_file in files:\n if cur_file.endswith('index.lock'):\n path_to_file = os.path.join(path, cur_file)\n print 'deleting %s' % path_to_file\n os.remove(path_to_file)\n", + "[SLAVE_BUILD]" + ], + "name": "cleanup index.lock", + "~followup_annotations": [ + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@import os, sys@@@", + "@@@STEP_LOG_LINE@python.inline@@@@", + "@@@STEP_LOG_LINE@python.inline@build_path = sys.argv[1]@@@", + "@@@STEP_LOG_LINE@python.inline@if os.path.exists(build_path):@@@", + "@@@STEP_LOG_LINE@python.inline@ for (path, dir, files) in os.walk(build_path):@@@", + "@@@STEP_LOG_LINE@python.inline@ for cur_file in files:@@@", + "@@@STEP_LOG_LINE@python.inline@ if cur_file.endswith('index.lock'):@@@", + "@@@STEP_LOG_LINE@python.inline@ path_to_file = os.path.join(path, cur_file)@@@", + "@@@STEP_LOG_LINE@python.inline@ print 'deleting %s' % path_to_file@@@", + "@@@STEP_LOG_LINE@python.inline@ os.remove(path_to_file)@@@", + "@@@STEP_LOG_END@python.inline@@@" + ] + }, + { + "cmd": [ + "python", + "-u", + "RECIPE_PACKAGE_REPO[depot_tools]/gclient.py", + "runhooks" + ], + "cwd": "[SLAVE_BUILD]/src", + "env": { + "PATH": "%(PATH)s:RECIPE_PACKAGE_REPO[depot_tools]" + }, + "name": "gclient runhooks" + }, + { + "name": "$result", + "recipe_result": null, + "status_code": 0 + } +] \ No newline at end of file diff --git a/recipe_modules/gclient/example.py b/recipe_modules/gclient/example.py index 3f6db89664..6d326aabe0 100644 --- a/recipe_modules/gclient/example.py +++ b/recipe_modules/gclient/example.py @@ -93,6 +93,11 @@ def RunSteps(api): assert not api.gclient.is_blink_mode + if api.properties.get('patch_project'): + api.gclient.set_patch_project_revision( + patch_project=api.properties.get('patch_project'), + gclient_config=api.gclient.make_config('chromium_bare')) + def GenTests(api): yield api.test('basic') @@ -100,3 +105,8 @@ def GenTests(api): yield api.test('revision') + api.properties(revision='abc') yield api.test('tryserver') + api.properties.tryserver() + + yield ( + api.test('tryserver_webrtc_patch') + + api.properties.tryserver(patch_project='webrtc') + )