Bug 230413 - CARGO_CRATES broken with crate names ending with -<number>
Summary: CARGO_CRATES broken with crate names ending with -<number>
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias Kortkamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-08-06 17:21 UTC by Thomas Hurst
Modified: 2018-08-07 19:59 UTC (History)
1 user (show)

See Also:


Attachments
cargo.mk.diff (632 bytes, patch)
2018-08-06 18:21 UTC, Tobias Kortkamp
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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!