9"""Check the DEPS file for correctness."""
12from __future__
import print_function
21INFRA_BOTS_DIR = os.path.dirname(os.path.realpath(__file__))
22SKIA_DIR = os.path.abspath(os.path.join(INFRA_BOTS_DIR, os.pardir, os.pardir))
26 """Load the DEPS file and verify that all entries are valid."""
29 gclient = subprocess.check_output([
30 utils.WHICH, utils.GCLIENT]).
decode(
'utf-8')
31 gclient_py = os.path.join(os.path.dirname(gclient),
'gclient.py')
32 python = sys.executable
or 'python'
35 output = subprocess.check_output(
36 [python, gclient_py,
'revinfo'], cwd=SKIA_DIR).
decode(
'utf-8')
40 for e
in output.rstrip().splitlines():
44 'Failed to parse `gclient revinfo` output; invalid format: %s' % e)
46 if split[0] ==
'skia':
48 split = split[1].split(
'@')
51 'Failed to parse `gclient revinfo` output; invalid format: %s' % e)
55 if 'chrome-infra-packages' in repo:
57 if not 'googlesource.com' in repo:
59 'DEPS must be hosted on googlesource.com; %s is not allowed. '
60 'See http://go/new-skia-git-mirror' % repo)
61 if not re.match(
r'^[a-z0-9]{40}$', rev):
62 errs.append(
'%s: "%s" does not look like a commit hash.' % (repo, rev))
64 print(
'Found problems in DEPS:', file=sys.stderr)
66 print(err, file=sys.stderr)
70if __name__ ==
'__main__':
def print(*args, **kwargs)
static DecodeResult decode(std::string path)