Bug 242416

Summary: Mk/Uses/cargo.mk: "make cargo-crates" fails to generate CARGO_CRATES with new Cargo.lock format
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Ports FrameworkAssignee: FreeBSD Rust Team <rust>
Status: Closed FIXED    
Severity: Affects Only Me CC: ports-bugs
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
cargo-crates.diff tobik: maintainer-approval+

Description Jan Beich freebsd_committer freebsd_triage 2019-12-04 10:56:30 UTC
Example: https://github.com/servo/servo/commit/0ce8cf9e2eb1

$ make cargo-crates # with today's (6e3c131139c4) snapshot 
GH_TUPLE=       servo:rust-azure:1dbd223157997b5b5301e7da73bff37f928a7418:azure \
                servo:devices:cb28c4725ffbfece99dab842d17d3e8c50774778:blurmac \
                energymon:energymon-rust:89daf8f37858eab96ad8eec7cc81accb17b2411e:energymon \
                energymon:energymon-sys:f8d77ea2906b25f9c0fd358aa9d300a46dc3e97c:energymonbuilder \
                servo:fontsan:29e879c870348c4b3fd51086e42dbb6365171479:fontsan \
                servo:mio:846242c05bacacda9a67033551eb33027f2648fc:mio \
                servo:rust-mozjs:9b0d063ba062f4cc60c3bab9250218d6935d647b:mozjs \
                servo:mozjs:59065889ec7726b767d70b8702b43b4e4776cbfe:mozjs_sys \
                servo:osmesa-src:1a9519c3675ebc1117cbb18ed6db420b5941cb8b:osmesasrc \
                servo:webrender:edac864107cf43732ec66a9d3288e869a70ce1de:peekpoke \
                jrmuizel:raqote:2a801bca7253e053767ef5ea11b0ee77c52617c9:raqote \
                servo:media:220ed1388f2ba008b05f5e94aca21dd14aa37290:servomedia \
                servo:media:5380170bb42286ce9009d83e1034904bea8f00ee:servomediadummy \
                pcwalton:signpost:7ed712507f343c38646b9d1fefd049166f9c9a18:signpost \
                kvark:spirv_cross:636677bad724797789239c16e6d332e9b4d97b86:spirv_cross \
                servo:webxr:e44552df536a6f424d58ccd068aa0301fee5fa1e:webxr \
                zakorgy:wgpu:128a16b9887a60a087a9d41ff68b20ce07cf6265:wgpunative \
                servo:winapi-rs:f85c3541bbb331fea8918ac070accfb4ab613e7b:winapi
CARGO_USE_GITHUB=       yes
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2019-12-04 11:37:53 UTC
Created attachment 209681 [details]
cargo-crates.diff

That should be trivial to fix.  Can you try with this patch?  I
checked against the collection of Cargo.lock at [1] and there were
no significant differences (some crates were ordered differently),
so hopefully there are no real regressions.

[1] https://github.com/t6/cargo-lock-examples
Comment 2 Jan Beich freebsd_committer freebsd_triage 2019-12-04 14:18:28 UTC
Comment on attachment 209681 [details]
cargo-crates.diff

Appears to help: with the patch CARGO_CRATES is populated and do-build doesn't use network. The actual build hit the same error as in a snapshot before the new Cargo.lock format.
Comment 3 commit-hook freebsd_committer freebsd_triage 2019-12-05 06:42:44 UTC
A commit references this bug:

Author: tobik
Date: Thu Dec  5 06:42:23 UTC 2019
New revision: 519063
URL: https://svnweb.freebsd.org/changeset/ports/519063

Log:
  Mk/Uses/cargo.mk: Support new Cargo.lock format

  The new format [1,2] dropped the [metadata] table.  As a consequence
  our cargo-crates.awk script no longer outputs CARGO_CRATES.  We can
  get the crate list from the various [[package]] tables instead.
  This should work with the new as well as the old format.

  [1] https://github.com/rust-lang/cargo/pull/7070
  [2] https://github.com/rust-lang/cargo/pull/7579

  PR:		242416
  Reported by:	jbeich

Changes:
  head/Mk/Scripts/cargo-crates.awk