Backed out changeset 2075af244745 (bug 1888243) for causing vendor failures. CLOSED TREE

This commit is contained in:
Natalia Csoregi 2024-04-03 00:26:47 +03:00
parent e7556589a6
commit d9d2fe464f

View file

@ -388,32 +388,26 @@ def cargo_vet(command_context, arguments, stdout=None, env=os.environ):
),
)
topsrcdir = Path(command_context.topsrcdir)
config_toml_in = topsrcdir / ".cargo/config.toml.in"
cargo_vet_dir = topsrcdir
if override_config_toml_in := command_context.substs.get(
"MOZ_OVERRIDE_CARGO_CONFIG"
):
config_toml_in = Path(override_config_toml_in).absolute()
cargo_vet_dir = config_toml_in.parent.parent
config_toml = config_toml_in.parent / config_toml_in.stem
locked = "--locked" in arguments
if locked:
# The use of --locked requires .cargo/config.toml to exist, but other things,
# like cargo update, don't want it there, so remove it once we're done.
shutil.copyfile(config_toml_in, config_toml)
topsrcdir = Path(command_context.topsrcdir)
shutil.copyfile(
topsrcdir / ".cargo" / "config.toml.in",
topsrcdir / ".cargo" / "config.toml",
)
try:
res = subprocess.run(
[cargo, "vet"] + arguments,
cwd=cargo_vet_dir,
cwd=command_context.topsrcdir,
stdout=stdout,
env=env,
)
finally:
if locked:
config_toml.unlink()
(topsrcdir / ".cargo" / "config.toml").unlink()
# When the function is invoked without stdout set (the default when running
# as a mach subcommand), exit with the returncode from cargo vet.