26 """Load the DEPS file and verify that all entries are valid."""
27
28
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'
33
34
35 output = subprocess.check_output(
36 [python, gclient_py,
'revinfo'], cwd=SKIA_DIR).
decode(
'utf-8')
37
38
39 errs = []
40 for e in output.rstrip().splitlines():
41 split = e.split(': ')
43 errs.append(
44 'Failed to parse `gclient revinfo` output; invalid format: %s' % e)
45 continue
46 if split[0] == 'skia':
47 continue
48 split = split[1].split('@')
50 errs.append(
51 'Failed to parse `gclient revinfo` output; invalid format: %s' % e)
52 continue
53 repo = split[0]
54 rev = split[1]
55 if 'chrome-infra-packages' in repo:
56 continue
57 if not 'googlesource.com' in repo:
58 errs.append(
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))
63 if errs:
64 print(
'Found problems in DEPS:', file=sys.stderr)
65 for err in errs:
66 print(err, file=sys.stderr)
67 sys.exit(1)
68
69
def print(*args, **kwargs)
static DecodeResult decode(std::string path)