Update diff_deps receipe to py3

This is a reland on 988c0af5be

R=aravindvasudev@google.com

Bug: 1357152
Recipe-Nontrivial-Roll: build
Change-Id: I93f8056908b50a7f41df488cfae200408d91e11b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3858159
Reviewed-by: Aravind Vasudevan <aravindvasudev@google.com>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
changes/59/3858159/4
Josip Sokcevic 3 years ago committed by LUCI CQ
parent b0fb8d570d
commit 228fedfaad

@ -166,7 +166,7 @@ PYTHON_VERSION_COMPATIBILITY: PY2+3
#### **class [GclientApi](/recipes/recipe_modules/gclient/api.py#77)([RecipeApi][recipe_engine/wkt/RecipeApi]):** #### **class [GclientApi](/recipes/recipe_modules/gclient/api.py#77)([RecipeApi][recipe_engine/wkt/RecipeApi]):**
&emsp; **@property**<br>&mdash; **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#440)(self):** &emsp; **@property**<br>&mdash; **def [DepsDiffException](/recipes/recipe_modules/gclient/api.py#424)(self):**
&mdash; **def [\_\_call\_\_](/recipes/recipe_modules/gclient/api.py#87)(self, name, cmd, infra_step=True, \*\*kwargs):** &mdash; **def [\_\_call\_\_](/recipes/recipe_modules/gclient/api.py#87)(self, name, cmd, infra_step=True, \*\*kwargs):**
@ -183,11 +183,11 @@ Return a step generator function for gclient checkouts.
&emsp; **@staticmethod**<br>&mdash; **def [config\_to\_pythonish](/recipes/recipe_modules/gclient/api.py#139)(cfg):** &emsp; **@staticmethod**<br>&mdash; **def [config\_to\_pythonish](/recipes/recipe_modules/gclient/api.py#139)(cfg):**
&mdash; **def [diff\_deps](/recipes/recipe_modules/gclient/api.py#383)(self, cwd):** &mdash; **def [diff\_deps](/recipes/recipe_modules/gclient/api.py#367)(self, cwd):**
&mdash; **def [get\_config\_defaults](/recipes/recipe_modules/gclient/api.py#133)(self):** &mdash; **def [get\_config\_defaults](/recipes/recipe_modules/gclient/api.py#133)(self):**
&mdash; **def [get\_gerrit\_patch\_root](/recipes/recipe_modules/gclient/api.py#314)(self, gclient_config=None):** &mdash; **def [get\_gerrit\_patch\_root](/recipes/recipe_modules/gclient/api.py#298)(self, gclient_config=None):**
Returns local path to the repo where gerrit patch will be applied. Returns local path to the repo where gerrit patch will be applied.
@ -200,7 +200,7 @@ Instead, properly map a repository to a local path using repo_path_map.
TODO(nodir): remove this. Update all recipe tests to specify a git_repo TODO(nodir): remove this. Update all recipe tests to specify a git_repo
matching the recipe. matching the recipe.
&mdash; **def [get\_repo\_path](/recipes/recipe_modules/gclient/api.py#341)(self, repo_url, gclient_config=None):** &mdash; **def [get\_repo\_path](/recipes/recipe_modules/gclient/api.py#325)(self, repo_url, gclient_config=None):**
Returns local path to the repo checkout given its url. Returns local path to the repo checkout given its url.
@ -230,7 +230,7 @@ Args:
&mdash; **def [runhooks](/recipes/recipe_modules/gclient/api.py#285)(self, args=None, name='runhooks', \*\*kwargs):** &mdash; **def [runhooks](/recipes/recipe_modules/gclient/api.py#285)(self, args=None, name='runhooks', \*\*kwargs):**
&mdash; **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#371)(self, gclient_config=None):** &mdash; **def [set\_patch\_repo\_revision](/recipes/recipe_modules/gclient/api.py#355)(self, gclient_config=None):**
Updates config revision corresponding to patched project. Updates config revision corresponding to patched project.

@ -292,24 +292,8 @@ class GclientApi(recipe_api.RecipeApi):
"""Remove all index.lock files. If a previous run of git crashed, bot was """Remove all index.lock files. If a previous run of git crashed, bot was
reset, etc... we might end up with leftover index.lock files. reset, etc... we might end up with leftover index.lock files.
""" """
self.m.python.inline( cmd = ['python3', '-u', self.resource('cleanup.py'), self.m.path['start_dir']]
'cleanup index.lock', return self.m.step('cleanup index.lock', cmd)
"""
from __future__ import print_function
import os, sys
build_path = sys.argv[1]
if os.path.exists(build_path):
for (path, dir, files) in os.walk(build_path):
for cur_file in files:
if cur_file.endswith('index.lock'):
path_to_file = os.path.join(path, cur_file)
print('deleting %s' % path_to_file)
os.remove(path_to_file)
""",
args=[self.m.path['start_dir']],
infra_step=True,
)
def get_gerrit_patch_root(self, gclient_config=None): def get_gerrit_patch_root(self, gclient_config=None):
"""Returns local path to the repo where gerrit patch will be applied. """Returns local path to the repo where gerrit patch will be applied.
@ -398,7 +382,7 @@ class GclientApi(recipe_api.RecipeApi):
step_result = self( step_result = self(
'recursively git diff all DEPS', 'recursively git diff all DEPS',
['recurse', 'python', self.resource('diff_deps.py')], ['recurse', 'python3', self.resource('diff_deps.py')],
stdout=self.m.raw_io.output_text(add_output_log=True), stdout=self.m.raw_io.output_text(add_output_log=True),
) )

@ -195,27 +195,12 @@
}, },
{ {
"cmd": [ "cmd": [
"python", "python3",
"\nfrom __future__ import print_function\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", "-u",
"RECIPE_MODULE[depot_tools::gclient]/resources/cleanup.py",
"[START_DIR]" "[START_DIR]"
], ],
"infra_step": true, "name": "cleanup index.lock"
"name": "cleanup index.lock",
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@from __future__ import print_function@@@",
"@@@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": [ "cmd": [

@ -317,11 +317,11 @@
}, },
{ {
"cmd": [ "cmd": [
"python", "python3",
"\nfrom __future__ import print_function\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", "-u",
"RECIPE_MODULE[depot_tools::gclient]/resources/cleanup.py",
"[START_DIR]" "[START_DIR]"
], ],
"infra_step": true,
"luci_context": { "luci_context": {
"realm": { "realm": {
"name": "project:ci" "name": "project:ci"
@ -334,22 +334,7 @@
"hostname": "rdbhost" "hostname": "rdbhost"
} }
}, },
"name": "cleanup index.lock", "name": "cleanup index.lock"
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@from __future__ import print_function@@@",
"@@@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": [ "cmd": [

@ -315,11 +315,11 @@
}, },
{ {
"cmd": [ "cmd": [
"python", "python3",
"\nfrom __future__ import print_function\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", "-u",
"RECIPE_MODULE[depot_tools::gclient]/resources/cleanup.py",
"[START_DIR]" "[START_DIR]"
], ],
"infra_step": true,
"luci_context": { "luci_context": {
"realm": { "realm": {
"name": "project:try" "name": "project:try"
@ -332,22 +332,7 @@
"hostname": "rdbhost" "hostname": "rdbhost"
} }
}, },
"name": "cleanup index.lock", "name": "cleanup index.lock"
"~followup_annotations": [
"@@@STEP_LOG_LINE@python.inline@@@@",
"@@@STEP_LOG_LINE@python.inline@from __future__ import print_function@@@",
"@@@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": [ "cmd": [

@ -0,0 +1,14 @@
#!/usr/bin/env python3
from __future__ import print_function
import os, sys
build_path = sys.argv[1]
if os.path.exists(build_path):
for (path, dir, files) in os.walk(build_path):
for cur_file in files:
if cur_file.endswith('index.lock'):
path_to_file = os.path.join(path, cur_file)
print('deleting %s' % path_to_file)
os.remove(path_to_file)

@ -1,4 +1,5 @@
#!/usr/bin/env python #!/usr/bin/env python3
from __future__ import print_function from __future__ import print_function
import os import os

@ -31,7 +31,7 @@
"-u", "-u",
"RECIPE_REPO[depot_tools]/gclient.py", "RECIPE_REPO[depot_tools]/gclient.py",
"recurse", "recurse",
"python", "python3",
"RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py" "RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py"
], ],
"cwd": "[CACHE]", "cwd": "[CACHE]",

@ -31,7 +31,7 @@
"-u", "-u",
"RECIPE_REPO[depot_tools]/gclient.py", "RECIPE_REPO[depot_tools]/gclient.py",
"recurse", "recurse",
"python", "python3",
"RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py" "RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py"
], ],
"cwd": "[CACHE]", "cwd": "[CACHE]",
@ -100,7 +100,7 @@
"Traceback (most recent call last):", "Traceback (most recent call last):",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps",
" affected_files = api.gclient.diff_deps(api.path['cache'])", " affected_files = api.gclient.diff_deps(api.path['cache'])",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 412, in diff_deps", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 396, in diff_deps",
" raise self.DepsDiffException(msg)", " raise self.DepsDiffException(msg)",
"DepsDiffException('Couldn't checkout previous ref: fatal: bad object abcdef1234567890')" "DepsDiffException('Couldn't checkout previous ref: fatal: bad object abcdef1234567890')"
] ]

@ -31,7 +31,7 @@
"-u", "-u",
"RECIPE_REPO[depot_tools]/gclient.py", "RECIPE_REPO[depot_tools]/gclient.py",
"recurse", "recurse",
"python", "python3",
"RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py" "RECIPE_MODULE[depot_tools::gclient]/resources/diff_deps.py"
], ],
"cwd": "[CACHE]", "cwd": "[CACHE]",
@ -99,7 +99,7 @@
"Traceback (most recent call last):", "Traceback (most recent call last):",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/tests/diff_deps.py\", line 35, in RunSteps",
" affected_files = api.gclient.diff_deps(api.path['cache'])", " affected_files = api.gclient.diff_deps(api.path['cache'])",
" File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 428, in diff_deps", " File \"RECIPE_REPO[depot_tools]/recipes/recipe_modules/gclient/api.py\", line 412, in diff_deps",
" raise self.DepsDiffException(msg)", " raise self.DepsDiffException(msg)",
"DepsDiffException('Unexpected result: autoroll diff found 0 files changed')" "DepsDiffException('Unexpected result: autoroll diff found 0 files changed')"
] ]

@ -31,7 +31,7 @@
"-u", "-u",
"RECIPE_REPO[depot_tools]\\gclient.py", "RECIPE_REPO[depot_tools]\\gclient.py",
"recurse", "recurse",
"python", "python3",
"RECIPE_MODULE[depot_tools::gclient]\\resources\\diff_deps.py" "RECIPE_MODULE[depot_tools::gclient]\\resources\\diff_deps.py"
], ],
"cwd": "[CACHE]", "cwd": "[CACHE]",

Loading…
Cancel
Save