Currently cargo.eclass does not check if rust_pkg_setup was called in cargo_live_src_unpack, leading to situations where vague build errors can show up. This behavior can be seen in bug 953515. Quoting Sam: """ We need to call rust_pkg_setup in bcachefs-tools, but we should maybe add a sanity check like other cargo phases too: if [[ -z "${CARGO}" ]]; then die "CARGO is not set; was rust_pkg_setup run?" fi """
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ba3dffd3228188acf098b06d73059f1b02e69cfc commit ba3dffd3228188acf098b06d73059f1b02e69cfc Author: Christopher Fore <csfore@posteo.net> AuthorDate: 2025-04-13 00:53:50 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-04-19 01:30:37 +0000 cargo.eclass: Add _cargo_check_initialized to cargo_live_src_unpack Currently cargo.eclass does not check if rust_pkg_setup was called in cargo_live_src_unpack, leading to situations where vague build errors can show up. Closes: https://bugs.gentoo.org/953532 Bug: https://bugs.gentoo.org/953515 Signed-off-by: Christopher Fore <csfore@posteo.net> Signed-off-by: Sam James <sam@gentoo.org> eclass/cargo.eclass | 2 ++ 1 file changed, 2 insertions(+) Additionally, it has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e7aa0ac74a17f3b404103a42cfd24525c1e9cc2f commit e7aa0ac74a17f3b404103a42cfd24525c1e9cc2f Author: Christopher Fore <csfore@posteo.net> AuthorDate: 2025-04-13 00:53:49 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2025-04-19 01:30:31 +0000 cargo.eclass: Pull check for rust_pkg_setup into its own function This reduces repetitiveness and allows for easier maintainability in the future. Bug: https://bugs.gentoo.org/953515 Bug: https://bugs.gentoo.org/953532 Signed-off-by: Christopher Fore <csfore@posteo.net> Signed-off-by: Sam James <sam@gentoo.org> eclass/cargo.eclass | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)