Manually roll recipes (trivial)
Also converts recipes.cfg to new JSONPB format. build: https://crrev.com/cf2a231cfaea22f03affe7d3ccdf8634d35a855d flutter: rename libsky_shell.so to libflutter.so https://crrev.com/47f1d3af26e30e7120f18450f28dd9ad095f69ba Roll recipe dependencies (trivial). https://crrev.com/67b26be7760cdce0e165e39e3d7cc88101725429 Allow passing arg to `repo sync` in chromite module https://crrev.com/6b2f23904dfb05b0b382cea4a9db373ec1041696 chromium: Adding tansell@chromium.org as OWNER for Chromium recipes. https://crrev.com/3966f1d05c265be673d4a4e52983370680bd2741 Dart: Add gclient runhooks to SDK builder recipe. https://crrev.com/3f370ccee1f85de227a40a27f384b1fd47811148 Install goma for cbuildbots. https://crrev.com/c9ea42272c232c77bffb476a64243ca6663fff44 Roll recipe dependencies (trivial). https://crrev.com/2458a11e565207234a11f0745b6c04c042e7d636 Roll recipe dependencies (trivial). https://crrev.com/c255c84a5881e193dcc7c6037cc37badb35c26c9 flutter: rename sky_shell to flutter_tester https://crrev.com/49099195df9831c746bc6437aea4b50bce14965d chromite: Change cbuildbot/api to to cbuildbot_launch. https://crrev.com/0ce9a9f88802d6be5e016b8a4efc190a21441e29 Roll recipe dependencies (trivial). https://crrev.com/e2406a2458aa7697979d6df86e92892077f16822 Roll recipe dependencies (trivial). depot_tools: https://crrev.com/2e401be12ef1ec44f4a81c6bc8acaf793c71e4de Roll recipe dependencies (trivial). https://crrev.com/8b5b594115480a6b4c4bbe384cc7afaecd814a4b add "generic" infra path config https://crrev.com/284e34ae2878ddd2cda671554b444db8512fa2ab Revert "add "generic" infra path config" https://crrev.com/f7023e7cf0a6606080d9f53c5a9e6e8271443914 Roll recipe dependencies (trivial). https://crrev.com/757f20796948ff4a9264dad5293bdff2f94d9c43 Reland: add "generic" infra path config https://crrev.com/e663133f6f2695efba0705e82ee581f6eb424e6c Roll recipe dependencies (trivial). recipe_engine: https://crrev.com/51395b1ba1ea684f5e99d2bb03c934f2ac441984 [recipes.cfg] ONLY support jsonpb. https://crrev.com/230fcdf5d57a084071e3617885b3286353ab1350 [package.proto] add options for autoroller recipe to recipes.cfg. https://crrev.com/8ec7b6d3ca59e7c178ad1b03e4408da556fddafa [recipes.cfg] set canonical_url and autoroller options Bug: Change-Id: I8308cf3633258703a3bd24ab49bf6e0db6c87cc9 Reviewed-on: https://skia-review.googlesource.com/10242 Reviewed-by: Eric Boren <borenet@google.com> Commit-Queue: Eric Boren <borenet@google.com>
This commit is contained in:
parent
6105e4bf2d
commit
654dfeeace
@ -32,15 +32,12 @@ RECIPES_CFG = os.path.join('infra', 'config', 'recipes.cfg')
|
||||
BOOTSTRAP_VERSION = 1
|
||||
|
||||
import argparse
|
||||
import ast
|
||||
import json
|
||||
import logging
|
||||
import random
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
import traceback
|
||||
import urlparse
|
||||
|
||||
from cStringIO import StringIO
|
||||
@ -68,97 +65,22 @@ def parse(repo_root, recipes_cfg_path):
|
||||
`recipe_modules`)
|
||||
"""
|
||||
with open(recipes_cfg_path, 'rU') as fh:
|
||||
data = fh.read()
|
||||
pb = json.load(fh)
|
||||
|
||||
if data.lstrip().startswith('{'):
|
||||
pb = json.loads(data)
|
||||
engine = next(
|
||||
(d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None)
|
||||
if engine is None:
|
||||
raise ValueError('could not find recipe_engine dep in %r'
|
||||
% recipes_cfg_path)
|
||||
engine_url = engine['url']
|
||||
engine_revision = engine.get('revision', '')
|
||||
engine_subpath = engine.get('path_override', '')
|
||||
recipes_path = pb.get('recipes_path', '')
|
||||
else:
|
||||
def get_unique(things):
|
||||
if len(things) == 1:
|
||||
return things[0]
|
||||
elif len(things) == 0:
|
||||
raise ValueError("Expected to get one thing, but dinna get none.")
|
||||
else:
|
||||
logging.warn('Expected to get one thing, but got a bunch: %s\n%s' %
|
||||
(things, traceback.format_stack()))
|
||||
return things[0]
|
||||
|
||||
protobuf = parse_textpb(StringIO(data))
|
||||
|
||||
engine_buf = get_unique([
|
||||
b for b in protobuf.get('deps', [])
|
||||
if b.get('project_id') == ['recipe_engine'] ])
|
||||
engine_url = get_unique(engine_buf['url'])
|
||||
engine_revision = get_unique(engine_buf.get('revision', ['']))
|
||||
engine_subpath = (get_unique(engine_buf.get('path_override', ['']))
|
||||
.replace('/', os.path.sep))
|
||||
recipes_path = get_unique(protobuf.get('recipes_path', ['']))
|
||||
engine = next(
|
||||
(d for d in pb['deps'] if d['project_id'] == 'recipe_engine'), None)
|
||||
if engine is None:
|
||||
raise ValueError('could not find recipe_engine dep in %r'
|
||||
% recipes_cfg_path)
|
||||
engine_url = engine['url']
|
||||
engine_revision = engine.get('revision', '')
|
||||
engine_subpath = engine.get('path_override', '')
|
||||
recipes_path = pb.get('recipes_path', '')
|
||||
|
||||
recipes_path = os.path.join(repo_root, recipes_path.replace('/', os.path.sep))
|
||||
return engine_url, engine_revision, engine_subpath, recipes_path
|
||||
|
||||
|
||||
def parse_textpb(fh):
|
||||
"""Parse the protobuf text format just well enough to understand recipes.cfg.
|
||||
|
||||
We don't use the protobuf library because we want to be as self-contained
|
||||
as possible in this bootstrap, so it can be simply vendored into a client
|
||||
repo.
|
||||
|
||||
We assume all fields are repeated since we don't have a proto spec to work
|
||||
with.
|
||||
|
||||
Args:
|
||||
fh: a filehandle containing the text format protobuf.
|
||||
Returns:
|
||||
A recursive dictionary of lists.
|
||||
"""
|
||||
def parse_atom(field, text):
|
||||
if text == 'true':
|
||||
return True
|
||||
if text == 'false':
|
||||
return False
|
||||
|
||||
# repo_type is an enum. Since it does not have quotes,
|
||||
# invoking literal_eval would fail.
|
||||
if field == 'repo_type':
|
||||
return text
|
||||
|
||||
return ast.literal_eval(text)
|
||||
|
||||
ret = {}
|
||||
for line in fh:
|
||||
line = line.strip()
|
||||
m = re.match(r'(\w+)\s*:\s*(.*)', line)
|
||||
if m:
|
||||
ret.setdefault(m.group(1), []).append(parse_atom(m.group(1), m.group(2)))
|
||||
continue
|
||||
|
||||
m = re.match(r'(\w+)\s*{', line)
|
||||
if m:
|
||||
subparse = parse_textpb(fh)
|
||||
ret.setdefault(m.group(1), []).append(subparse)
|
||||
continue
|
||||
|
||||
if line == '}':
|
||||
return ret
|
||||
if line == '':
|
||||
continue
|
||||
|
||||
raise ValueError('Could not understand line: <%s>' % line)
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def _subprocess_call(argv, **kwargs):
|
||||
logging.info('Running %r', argv)
|
||||
return subprocess.call(argv, **kwargs)
|
||||
|
@ -1,21 +1,25 @@
|
||||
api_version: 1
|
||||
project_id: "skia"
|
||||
recipes_path: "infra/bots"
|
||||
deps {
|
||||
project_id: "build"
|
||||
url: "https://chromium.googlesource.com/chromium/tools/build.git"
|
||||
branch: "master"
|
||||
revision: "4dbb302e82655768d714dff8b58601a321bef8a7"
|
||||
}
|
||||
deps {
|
||||
project_id: "depot_tools"
|
||||
url: "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
|
||||
branch: "master"
|
||||
revision: "5be3bdd70e1d95b88c93ca38c0c870e2399dede7"
|
||||
}
|
||||
deps {
|
||||
project_id: "recipe_engine"
|
||||
url: "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git"
|
||||
branch: "master"
|
||||
revision: "84b34416f3e1b1582cf81ab7ffea34f1e84b1c95"
|
||||
}
|
||||
{
|
||||
"api_version": 1,
|
||||
"deps": [
|
||||
{
|
||||
"branch": "master",
|
||||
"project_id": "build",
|
||||
"revision": "e2406a2458aa7697979d6df86e92892077f16822",
|
||||
"url": "https://chromium.googlesource.com/chromium/tools/build.git"
|
||||
},
|
||||
{
|
||||
"branch": "master",
|
||||
"project_id": "depot_tools",
|
||||
"revision": "e663133f6f2695efba0705e82ee581f6eb424e6c",
|
||||
"url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
|
||||
},
|
||||
{
|
||||
"branch": "master",
|
||||
"project_id": "recipe_engine",
|
||||
"revision": "8ec7b6d3ca59e7c178ad1b03e4408da556fddafa",
|
||||
"url": "https://chromium.googlesource.com/external/github.com/luci/recipes-py.git"
|
||||
}
|
||||
],
|
||||
"project_id": "skia",
|
||||
"recipes_path": "infra/bots"
|
||||
}
|
Loading…
Reference in New Issue
Block a user