Roll recipe dependencies (trivial).

This is an automated CL created by the recipe roller. This CL rolls recipe
changes from upstream projects (e.g. depot_tools) into downstream projects
(e.g. tools/build).


More info is at https://goo.gl/zkKdpD. Use https://goo.gl/noib3a to file a bug.
recipe_engine:
  https://crrev.com/e90c11af854574dd68edd0e7c7a5e04ceb49ffd0 [recipes.cfg] remove support for api_version 1. (iannucci@chromium.org)


TBR=iannucci@chromium.org

Recipe-Tryjob-Bypass-Reason: Autoroller
Bugdroid-Send-Email: False
Change-Id: I4037656dd987d0f8aca762761e0ff8ae9034f19f
Reviewed-on: https://chromium-review.googlesource.com/499987
Reviewed-by: <recipe-roller@chromium.org>
Commit-Queue: <recipe-roller@chromium.org>
changes/87/499987/2
recipe-roller 8 years ago committed by Commit Bot
parent 80b30caf53
commit 1ae7d33b5d

@ -15,7 +15,7 @@
"deps": { "deps": {
"recipe_engine": { "recipe_engine": {
"branch": "master", "branch": "master",
"revision": "cfeeb53051e02856a35395a69b09f822ad35e2e5", "revision": "e90c11af854574dd68edd0e7c7a5e04ceb49ffd0",
"url": "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git" "url": "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git"
} }
}, },

@ -51,9 +51,15 @@ from cStringIO import StringIO
EngineDep = namedtuple('EngineDep', EngineDep = namedtuple('EngineDep',
'url revision path_override branch repo_type') 'url revision path_override branch repo_type')
class MalformedRecipesCfg(Exception):
def __init__(self, msg, path):
super(MalformedRecipesCfg, self).__init__('malformed recipes.cfg: %s: %r'
% (msg, path))
def parse(repo_root, recipes_cfg_path): def parse(repo_root, recipes_cfg_path):
"""Parse is transitional code which parses a recipes.cfg file as either jsonpb """Parse is a lightweight a recipes.cfg file parser.
or as textpb.
Args: Args:
repo_root (str) - native path to the root of the repo we're trying to run repo_root (str) - native path to the root of the repo we're trying to run
@ -69,21 +75,17 @@ def parse(repo_root, recipes_cfg_path):
with open(recipes_cfg_path, 'rU') as fh: with open(recipes_cfg_path, 'rU') as fh:
pb = json.load(fh) pb = json.load(fh)
if pb['api_version'] == 1: try:
# TODO(iannucci): remove when we only support version 2 if pb['api_version'] != 2:
engine = next( raise MalformedRecipesCfg('unknown version %d' % pb['api_version'],
(d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None) recipes_cfg_path)
if engine is None:
raise ValueError('could not find recipe_engine dep in %r'
% recipes_cfg_path)
else:
engine = pb['deps']['recipe_engine'] engine = pb['deps']['recipe_engine']
if 'url' not in engine: if 'url' not in engine:
raise ValueError( raise MalformedRecipesCfg(
'Required field "url" in dependency "recipe_engine" not found: %r' % 'Required field "url" in dependency "recipe_engine" not found',
(recipes_cfg_path,) recipes_cfg_path)
)
engine.setdefault('revision', '') engine.setdefault('revision', '')
engine.setdefault('path_override', '') engine.setdefault('path_override', '')
@ -96,13 +98,15 @@ def parse(repo_root, recipes_cfg_path):
engine.setdefault('repo_type', 'GIT') engine.setdefault('repo_type', 'GIT')
if engine['repo_type'] not in ('GIT', 'GITILES'): if engine['repo_type'] not in ('GIT', 'GITILES'):
raise ValueError( raise MalformedRecipesCfg(
'Unsupported "repo_type" value in dependency "recipe_engine": %r' % 'Unsupported "repo_type" value in dependency "recipe_engine"',
(recipes_cfg_path,) recipes_cfg_path)
)
recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep)) recipes_path = os.path.join(
repo_root, recipes_path.replace('/', os.path.sep))
return EngineDep(**engine), recipes_path return EngineDep(**engine), recipes_path
except KeyError as ex:
raise MalformedRecipesCfg(ex.message, recipes_cfg_path)
GIT = 'git.bat' if sys.platform.startswith(('win', 'cygwin')) else 'git' GIT = 'git.bat' if sys.platform.startswith(('win', 'cygwin')) else 'git'

Loading…
Cancel
Save