Page MenuHomeFreeBSD

Mk/Uses/cargo.mk: Fix over-eager crate name/version split when setting up MASTER_SITES
ClosedPublic

Authored by tobik on Oct 9 2017, 2:05 PM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Feb 17, 12:12 AM
Unknown Object (File)
Sun, Feb 8, 2:15 AM
Unknown Object (File)
Sat, Feb 7, 9:35 PM
Unknown Object (File)
Sat, Jan 31, 7:31 AM
Unknown Object (File)
Jan 18 2026, 10:14 PM
Unknown Object (File)
Jan 15 2026, 11:58 PM
Unknown Object (File)
Jan 14 2026, 4:30 PM
Unknown Object (File)
Dec 28 2025, 6:38 AM
Subscribers
None

Details

Summary

I'd like to create a port of xsv [1], however there is a small problem
with cargo.mk at the moment. xsv depends on the csv 1.0.0-beta4 crate
i.e.

CARGO_CRATES= csv-1.0.0-beta4

When setting up MASTER_SITES, cargo.mk is a little too eager in
splitting the crate name and version in two at the moment. This means
that the wrong URL is being used e.g.

.../csv-1.0.0/beta4/download/...

instead of the correct one

../csv/1.0.0-beta4/download/...

Currently we use the following modifiers in generating the download
URL which appears to be too simplistic

${_crate:C/-?[^-]*$}/${_crate:C/^.*-}

After reading [2] I'm assuming that Cargo guarantees that the version
starts with a number. Crate names need to be a valid Rust identifier
(for extern crate declarations to work, so names can't start with a
-), so I hope changing that to

${_crate:C/-[0-9].*$//}/${_crate:C/^.*-([0-9].*)/\1/}

will solve this.

[1] https://github.com/BurntSushi/xsv
[2] http://doc.crates.io/manifest.html#the-version-field

Test Plan

Delete ${DISTDIR}/rust/crates and rebuild all cargo ports

devel/bingrep                                                                  
devel/pijul
devel/racer
editors/xi-core
sysutils/exa
sysutils/flowgger
textproc/ripgrep
www/geckodriver
x11/alacritty

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable