cargo wrapper: fix LTO position in argument lists

this caused loupe to FTBFS after it disabled LTO for certain architectures:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1086025

because the `cargo test` invocation sets arguments for the test runner (via
`--`), which means the LTO options can't go last in the argument list.

Signed-off-by: Fabian Grünbichler <git@fabian.gruenbichler.email>
This commit is contained in:
Fabian Grünbichler 2024-10-25 16:20:04 +02:00
parent a856ac4c86
commit 4d49fcdcbe

6
debian/bin/cargo vendored
View File

@ -217,6 +217,9 @@ def main(*args):
subcmd = a
newargs.extend(["-Zavoid-dev-deps", a, "--verbose", "--verbose"] +
parallel + ["--target", host_rust_type])
if lto:
newargs.append("--config")
newargs.append(f"profile.release.lto={lto}")
elif (subcmd is None) and (a == "clean"):
subcmd = a
newargs.extend([a, "--verbose", "--verbose"])
@ -231,9 +234,6 @@ def main(*args):
if nocheck and subcmd in ("test", "bench"):
return 0
if lto:
newargs.append("--config")
newargs.append(f"profile.release.lto={lto}")
if subcmd == "clean":
logrun(["env", "RUST_BACKTRACE=1", "/usr/bin/cargo"] + list(newargs), check=True)