Verify cargo vet
cleaniness in third_party/rust/PRESUBMIT.py
.
Example presubmit failure (after manually, temporarily deleting parts of `//third_party/rust/chromium_crates_io/supply-chain/audits.toml`): ``` $ git cl presubmit --force Running Python 3 presubmit commit checks ... checking owners took a long time: 0.6s checking for commit objects in tree took a long time: 0.6s ** Presubmit Warnings: 1 ** //tools/crates/run_cargo_vet.py check vpython3 /usr/local/google/home/lukasza/src/chromium2/src/third_party/rust/../../tools/crates/run_cargo_vet.py check --locked --frozen --no-minimize-exemptions (0.30s) failed Vetting Failed! 2 unvetted dependencies: unicode-width:0.1.11 missing ["safe-to-run", "does-not-implement-crypto"] wycheproof:0.4.0 missing ["safe-to-run", "does-not-implement-crypto"] Running cargo -Zunstable-options -C /usr/local/google/home/lukasza/src/chromium2/src/tools/crates/../../third_party/rust/chromium_crates_io vet check --locked --frozen --no-minimize-exemptions --cargo-arg=-Zbindeps --no-registry-suggestions Failed. Presubmit checks took 5.3s to calculate. There were Python 3 presubmit warnings. ``` Bug: 326234536 Change-Id: I09040d6dce8900b43a7002cad11439572432feae Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5388131 Reviewed-by: danakj <danakj@chromium.org> Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org> Cr-Commit-Position: refs/heads/main@{#1277673}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4bc19beae9
commit
786b43924b
@ -54,9 +54,4 @@ Additional notes:
|
||||
(e.g. Android, Fuchsia, etc.). This means that adding a new crate does not
|
||||
necessarily require a new audit if the crate has already been audited by
|
||||
other projects.
|
||||
* For now we kindly ask you that audit updates in `audits.toml`
|
||||
should be part of the submitted CL so that `run_cargo_vet.py check` will
|
||||
continue to pass after the CL lands.
|
||||
- TODO(https://crbug.com/326234536): Enforce `cargo vet` cleaniness via
|
||||
`PRESUBMIT.py`.
|
||||
|
||||
|
31
third_party/rust/PRESUBMIT.py
vendored
Normal file
31
third_party/rust/PRESUBMIT.py
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
# Copyright 2024 The Chromium Authors
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
"""Top-level presubmit for //third_party/rust
|
||||
|
||||
See https://www.chromium.org/developers/how-tos/depottools/presubmit-scripts
|
||||
for more details about the presubmit API built into depot_tools.
|
||||
"""
|
||||
|
||||
PRESUBMIT_VERSION = '2.0.0'
|
||||
|
||||
def CheckCargoVet(input_api, output_api):
|
||||
vet_args = ['check']
|
||||
|
||||
# Hermetic and idempotent.
|
||||
vet_args += ['--locked', '--frozen', '--no-minimize-exemptions']
|
||||
|
||||
run_cargo_vet_path = input_api.os_path.join(
|
||||
input_api.PresubmitLocalPath(),
|
||||
'..', '..', 'tools', 'crates', 'run_cargo_vet.py')
|
||||
cmd_name = '//tools/crates/run_cargo_vet.py check'
|
||||
test_cmd = input_api.Command(
|
||||
name=cmd_name,
|
||||
cmd=[input_api.python3_executable, run_cargo_vet_path] + vet_args,
|
||||
kwargs={},
|
||||
message=output_api.PresubmitPromptWarning)
|
||||
if input_api.verbose:
|
||||
print('Running ' + cmd_name)
|
||||
return input_api.RunTests([test_cmd])
|
||||
|
Reference in New Issue
Block a user