Bug 244977 - USES=cargo fails to fetch crates with multiple versions in name
Summary: USES=cargo fails to fetch crates with multiple versions in name
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: FreeBSD Rust Team
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-03-22 14:19 UTC by Jan Beich
Modified: 2020-03-23 04:10 UTC (History)
1 user (show)

See Also:


Attachments
cargo.diff (611 bytes, patch)
2020-03-22 15:23 UTC, Tobias Kortkamp
tobik: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Beich freebsd_committer freebsd_triage 2020-03-22 14:19:56 UTC
$ cd /usr/ports/devel/cargo-c
$ fetch -qo- https://github.com/freebsd/freebsd-ports/commit/6519fce9b9a1.patch | patch -Efsp3
$ export NO_IGNORE=1 # disables unrelated safety belt
$ make clean patch
$ make cargo-crates  | portedit merge -i .
$ make makesum
===>   cargo-c-0.6.1 depends on file: /usr/local/sbin/pkg - found
=> rust/crates/curl-sys-0.4.30+curl-7.69.1.tar.gz doesn't seem to exist in /usr/ports/distfiles/.
=> Attempting to fetch https://crates.io/api/v1/crates/curl-sys-0.4.30+curl/7.69.1/download?dummy=/rust/crates/curl-sys-0.4.30+curl-7.69.1.tar.gz
fetch: https://crates.io/api/v1/crates/curl-sys-0.4.30+curl/7.69.1/download?dummy=/rust/crates/curl-sys-0.4.30+curl-7.69.1.tar.gz: Not Found
=> Attempting to fetch http://distcache.FreeBSD.org/ports-distfiles/rust/crates/curl-sys-0.4.30+curl-7.69.1.tar.gz
fetch: http://distcache.FreeBSD.org/ports-distfiles/rust/crates/curl-sys-0.4.30+curl-7.69.1.tar.gz: Not Found
=> Couldn't fetch it - please try to retrieve this
=> port manually into /usr/ports/distfiles/ and try again.
*** Error code 1
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2020-03-22 15:23:09 UTC
Created attachment 212613 [details]
cargo.diff

Crate names have a restricted format [1], so let's restrict the regular
expressions too and make them less greedy.

[1] https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field
Comment 2 Jan Beich freebsd_committer freebsd_triage 2020-03-22 15:36:35 UTC
Comment on attachment 212613 [details]
cargo.diff

Works for me: builds fine and other crates fetch fine. Tested only devel/cargo-c after removing %2D (percent quoting) workaround.
Comment 3 Jan Beich freebsd_committer freebsd_triage 2020-03-22 22:47:40 UTC
*** Bug 244989 has been marked as a duplicate of this bug. ***
Comment 4 commit-hook freebsd_committer freebsd_triage 2020-03-23 03:58:12 UTC
A commit references this bug:

Author: tobik
Date: Mon Mar 23 03:57:26 UTC 2020
New revision: 528945
URL: https://svnweb.freebsd.org/changeset/ports/528945

Log:
  Mk/Uses/cargo.mk: Better deal with versions with build identifier suffixes

  A crate spec like curl-sys-0.4.30+curl-7.69.1 was incorrectly
  interpreted as having a name of 'curl-sys-0.4.30+curl' instead of
  'curl-sys' and failed to fetch as a consequence.

  Crate names can only be composed of a limited character set [1].
  Limit the regular expressions to that set and make them less greedy.

  [1] https://doc.rust-lang.org/cargo/reference/manifest.html#the-name-field

  PR:		244977
  Reported by:	jbeich

Changes:
  head/Mk/Uses/cargo.mk