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

Issue 2669033007: [recipe_engine] Fix a couple path-related bugs. (Closed)

Created:
3 years, 10 months ago by iannucci
Modified:
3 years, 10 months ago
CC:
chromium-reviews, infra-reviews+recipes-py_chromium.org
Target Ref:
refs/heads/master
Visibility:
Public.

Description

[recipe_engine] Fix a couple path-related bugs. Previously if a recipe never ended up importing the 'recipe_engine/path' module, attempts to use any Path object would crash. The resason for this is that the path module and the engine are convolutedly interconnected by the to_string_fn in config_types. The to_string_fn essentially must have a reference to the PathApi object, and so the set_tostring_fn is called from PathApi's __init__ method. If the recipe never ends up loading this module transitively, but then acquires a Path object (e.g. via api.resource()), attempting to stringify the Path will crash the recipe. This poor api boundary needs to be fixed, but the refactor looked pretty severe when I attempted it, so we paper over the crash for now by essentially always loading the path module when creating the api for the recipe. If the path module is already in the recipe's DEPS, the additional load is a no-op. This extra module does not get attached to the recipe's api object, so for the recipe to actually utilize the PathApi module, it still has to import it via DEPS. Also fix the appearance of simulated resource paths to be more in line with the existing RECIPE_MODULE notation: RECIPE[repo_name/recipe_name].resources/ becomes RECIPE[repo_name::recipe_name].resources/ And RECIPE[repo_name/../recipe_modules/module_name/example].resource/ becomes RECIPE[repo_name::module_name:example].resources/ Lastly, add a small optimization to Path.join when the arguments are empty. R=martiniss@chromium.org, phajdan.jr@chromium.org BUG= Review-Url: https://codereview.chromium.org/2669033007 Committed: https://github.com/luci/recipes-py/commit/37a1da981d744246d14a2c2e6fac554703ea4b1b

Patch Set 1 #

Patch Set 2 : Improve comment #

Total comments: 4

Patch Set 3 : Make unittests take dependency on recipe_engine #

Total comments: 2

Patch Set 4 : Fix remainder of presubmit tests #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -25 lines) Patch
M recipe_engine/config_types.py View 1 chunk +2 lines, -0 lines 0 comments Download
M recipe_engine/doc.py View 1 2 3 1 chunk +2 lines, -1 line 1 comment Download
M recipe_engine/loader.py View 1 2 chunks +19 lines, -5 lines 0 comments Download
M recipe_engine/package.py View 1 2 3 7 chunks +24 lines, -7 lines 1 comment Download
M recipes/engine_tests/recipe_paths.py View 1 chunk +1 line, -1 line 0 comments Download
M recipes/engine_tests/recipe_paths.expected/basic.json View 2 chunks +3 lines, -2 lines 0 comments Download
M unittests/repo_test_util.py View 1 2 1 chunk +14 lines, -9 lines 0 comments Download

Messages

Total messages: 17 (5 generated)
iannucci
3 years, 10 months ago (2017-02-02 21:03:48 UTC) #1
martiniss
lgtm https://codereview.chromium.org/2669033007/diff/20001/recipe_engine/loader.py File recipe_engine/loader.py (right): https://codereview.chromium.org/2669033007/diff/20001/recipe_engine/loader.py#newcode586 recipe_engine/loader.py:586: # Provide a fake module to the ScriptApi ...
3 years, 10 months ago (2017-02-02 21:12:18 UTC) #2
iannucci
https://codereview.chromium.org/2669033007/diff/20001/recipe_engine/loader.py File recipe_engine/loader.py (right): https://codereview.chromium.org/2669033007/diff/20001/recipe_engine/loader.py#newcode586 recipe_engine/loader.py:586: # Provide a fake module to the ScriptApi so ...
3 years, 10 months ago (2017-02-02 22:29:13 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2669033007/20001
3 years, 10 months ago (2017-02-02 22:29:33 UTC) #5
commit-bot: I haz the power
Try jobs failed on following builders: Recipes-py Presubmit on luci.infra.try (JOB_FAILED, https://luci-milo.appspot.com/swarming/task/3419c41972443810)
3 years, 10 months ago (2017-02-02 22:33:40 UTC) #7
martiniss
This doesn't break any tests, right? It's a bit weird that changing something from a ...
3 years, 10 months ago (2017-02-02 23:44:56 UTC) #8
iannucci
On 2017/02/02 23:44:56, martiniss wrote: > This doesn't break any tests, right? It's a bit ...
3 years, 10 months ago (2017-02-02 23:48:37 UTC) #9
iannucci
bleah, one more look pls (I thought all the tests were passing but my shell ...
3 years, 10 months ago (2017-02-02 23:58:08 UTC) #10
iannucci
https://codereview.chromium.org/2669033007/diff/60001/recipe_engine/doc.py File recipe_engine/doc.py (right): https://codereview.chromium.org/2669033007/diff/60001/recipe_engine/doc.py#newcode105 recipe_engine/doc.py:105: None, {}, universe_view)) So... this has always been wrong ...
3 years, 10 months ago (2017-02-03 00:00:05 UTC) #11
martiniss
lgtm
3 years, 10 months ago (2017-02-03 00:01:46 UTC) #12
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2669033007/60001
3 years, 10 months ago (2017-02-03 00:09:04 UTC) #14
commit-bot: I haz the power
3 years, 10 months ago (2017-02-03 00:12:00 UTC) #17
Message was sent while issue was closed.
Committed patchset #4 (id:60001) as
https://github.com/luci/recipes-py/commit/37a1da981d744246d14a2c2e6fac554703e...

Powered by Google App Engine
This is Rietveld 408576698