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)
Thu, Jun 6, 6:52 PM
Unknown Object (File)
Thu, Jun 6, 6:52 PM
Unknown Object (File)
Thu, Jun 6, 6:52 PM
Unknown Object (File)
Thu, Jun 6, 6:39 PM
Unknown Object (File)
May 6 2024, 5:06 AM
Unknown Object (File)
Feb 25 2024, 6:12 PM
Unknown Object (File)
Feb 12 2024, 1:55 AM
Unknown Object (File)
Feb 12 2024, 1:55 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