Page MenuHomeFreeBSD

Mk/Scripts/cargo-crates.awk: Fix output with some Git dependencies
ClosedPublic

Authored by tobik on Jul 12 2017, 6:53 PM.
Tags
None
Referenced Files
F163234960: D11571.id30697.diff
Tue, Jul 21, 7:23 AM
Unknown Object (File)
Thu, Jul 16, 8:07 AM
Unknown Object (File)
Wed, Jul 15, 2:32 PM
Unknown Object (File)
Sat, Jul 4, 2:55 AM
Unknown Object (File)
Sun, Jun 21, 11:09 PM
Unknown Object (File)
Jun 20 2026, 3:49 PM
Unknown Object (File)
Jun 9 2026, 4:13 AM
Unknown Object (File)
Jun 8 2026, 2:43 AM
Subscribers
None

Details

Summary
When specifying Git dependencies in Cargo.toml developers can set 3
additional keys: rev, branch, tag [1].  These are reflected in a
projects' Cargo.lock file as e.g.

git+https://github.com/servo/angle?branch=servo#a1371e8a160128677af863d1d73f150862ba42b2
git+https://github.com/rust-lang/libc?tag=0.2.26#288942e6858a4b2f8ee56338da5386263b9c4b82

Currently cargo-crates.awk generates the wrong output in these cases:

GH_TUPLE=	servo:angle?branch=servo:a1371e8a160128677af863d1d73f150862ba42b2:angle \
		rust-lang:libc?tag=0.2.26:288942e6858a4b2f8ee56338da5386263b9c4b82:libc

Fix cargo-crates.awk to ignore the query string (except in the tag
case) and generate

GH_TUPLE=	servo:angle:a1371e8a160128677af863d1d73f150862ba42b2:angle \
		rust-lang:libc:0.2.26:libc

instead.

[1] https://github.com/rust-lang/cargo/blob/master/src/doc/specifying-dependencies.md#specifying-dependencies-from-git-repositories

PR:		220548
Reported by:	jbeich
Approved by:	??? (mentor)
Differential Revision:	https://reviews.freebsd.org/D?????
Test Plan

Tested against the collection of Cargo.lock files at https://github.com/t6/cargo-lock-examples

Diff Detail

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

Event Timeline

This revision is now accepted and ready to land.Jul 12 2017, 10:06 PM
Mk/Scripts/cargo-crates.awk
1 ↗(On Diff #30697)

Why the maintainer is different from Mk/Uses/cargo.mk?

This revision was automatically updated to reflect the committed changes.