Page MenuHomeFreeBSD

cargo.mk: account for DIST_SUBDIR in cargo-checksum
Needs ReviewPublic

Authored by vishwin on Mar 22 2023, 1:34 PM.
Tags
None
Referenced Files
F84441795: D39205.diff
Thu, May 23, 10:21 PM
Unknown Object (File)
Sat, May 18, 10:09 PM
Unknown Object (File)
Sat, May 18, 7:20 AM
Unknown Object (File)
Thu, Apr 25, 10:16 PM
Unknown Object (File)
Apr 19 2024, 8:25 AM
Unknown Object (File)
Apr 15 2024, 3:54 AM
Unknown Object (File)
Feb 18 2024, 12:03 AM
Unknown Object (File)
Feb 17 2024, 10:10 PM
Subscribers

Details

Reviewers
None
Group Reviewers
rust
portmgr
Summary

When ${DIST_SUBDIR} is defined, cargo-checksum does not execute properly as the distribution directory holding the downloaded crates is not found.

Ideally, crates should download to rust/crates regardless of ${DIST_SUBDIR} but bsd.port.mk logic prevents it I think.

Test Plan

Should be a no-op in most to all current cases.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 50519
Build 47410: arc lint + arc unit

Event Timeline

% git grep -B 5 DIST_SUBDIR= -- `git grep --max-depth=2 -l cargo`
graphics/librsvg2-rust/Makefile-PORTVERSION=    2.54.5
graphics/librsvg2-rust/Makefile-PORTREVISION=   6
graphics/librsvg2-rust/Makefile-CATEGORIES=     graphics gnome
graphics/librsvg2-rust/Makefile-MASTER_SITES=   GNOME
graphics/librsvg2-rust/Makefile-PKGNAMESUFFIX=  2-rust
graphics/librsvg2-rust/Makefile:DIST_SUBDIR=    gnome2
--
lang/rust-bootstrap/Makefile-CATEGORIES=        lang
lang/rust-bootstrap/Makefile-MASTER_SITES=      https://static.rust-lang.org/dist/
lang/rust-bootstrap/Makefile-PKGNAMEPREFIX=     ${FLAVOR:S/_/-/g}-
lang/rust-bootstrap/Makefile-PKGNAMESUFFIX=     -bootstrap
lang/rust-bootstrap/Makefile-DISTNAME=  ${PORTNAME}c-${PORTVERSION}-src
lang/rust-bootstrap/Makefile:DIST_SUBDIR=       rust

Neither of these currently use USES=cargo.

Ideally, crates should download to rust/crates regardless of ${DIST_SUBDIR} but bsd.port.mk logic prevents it I think.

Maybe something like this as a workaround, i.e., replace DIST_SUBDIR components with ../ to make it always use ${DISTDIR}/rust/crates.

diff --git a/Mk/Uses/cargo.mk b/Mk/Uses/cargo.mk
index b9c5e967755e..b8c4bcd99d86 100644
--- a/Mk/Uses/cargo.mk
+++ b/Mk/Uses/cargo.mk
@@ -33,7 +33,7 @@ CARGO_CARGOTOML?=     ${WRKSRC}/Cargo.toml
 CARGO_CARGOLOCK?=      ${WRKSRC}/Cargo.lock

 # Save crates inside ${DISTDIR}/rust/crates by default.
-CARGO_DIST_SUBDIR?=    rust/crates
+CARGO_DIST_SUBDIR?=    ${DIST_SUBDIR:S,/, ,g:@x@..@:ts/:_}${empty(_):?:/}rust/crates

 # Generate list of DISTFILES.
 # Prefer canonical file extension .crate going forward
Mk/Uses/cargo.mk
285

Use ${_DISTDIR} instead.