Bug 230413

Summary: CARGO_CRATES broken with crate names ending with -<number>
Product: Ports & Packages Reporter: Thomas Hurst <tom>
Component: Ports FrameworkAssignee: Tobias Kortkamp <tobik>
Status: Closed FIXED    
Severity: Affects Only Me CC: ports-bugs
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
cargo.mk.diff none

Description Thomas Hurst 2018-08-06 17:21:21 UTC
USES=cargo breaks with crates like "utf-8-0.7.4", thinking the package name is "utf" instead of "utf-8".
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2018-08-06 18:21:10 UTC
Created attachment 195948 [details]
cargo.mk.diff

Try with this patch applied.
Comment 2 Thomas Hurst 2018-08-06 22:00:36 UTC
Looks good.

For reference, here's the port I'm making, complete with ugly workaround: https://github.com/Freaky/ports/tree/master/www/gutenberg

With your patch I can revert the workaround, and still fetch and build.  Also tested fine with textproc/ripgrep and sysutils/fd.
Comment 3 commit-hook freebsd_committer freebsd_triage 2018-08-07 19:55:56 UTC
A commit references this bug:

Author: tobik
Date: Tue Aug  7 19:55:32 UTC 2018
New revision: 476623
URL: https://svnweb.freebsd.org/changeset/ports/476623

Log:
  Mk/Uses/cargo.mk: Fix crate name and version split (take 2)

  cargo.mk is still too eager in splitting a crate's name and version
  in two when the name contains a dash followed by a number.  For
  example with utf-8-0.7.4 the wrong URL ends up being used in
  MASTER_SITES

    .../utf/8-0.7.4/download/...

  instead of

    .../utf-8/0.7.4/download/...

  PR:		230413
  Reported by:	Thomas Hurst <tom@hur.st>

Changes:
  head/Mk/Uses/cargo.mk
Comment 4 Tobias Kortkamp freebsd_committer freebsd_triage 2018-08-07 19:59:20 UTC
(In reply to Thomas Hurst from comment #2)
The patch doesn't seem to break existing ports, so committed the fix.
Thanks for the report!