| # Copyright 2023 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| def cipd_ensure_file_verify(ctx): |
| """Verifies ensure files.""" |
| procs = [] |
| for f in ctx.scm.affected_files(): |
| if not f.endswith(".ensure"): |
| continue |
| |
| cmd = [ |
| "cipd", |
| "ensure-file-verify", |
| "-ensure-file", |
| f, |
| ] |
| procs.append((f, ctx.os.exec(cmd, allow_network = True, ok_retcodes = [0, 1]))) |
| |
| for f, proc in procs: |
| res = proc.wait() |
| if res.retcode == 1: |
| ctx.emit.finding( |
| filepath = f, |
| message = res.stderr, |
| level = "error", |
| ) |
| |
| shac.register_check(cipd_ensure_file_verify) |