Bug 270604

Summary: Mk/Scripts/cargo-crates.awk: [[patch]] in Cargo.lock causes lossy output
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Ports FrameworkAssignee: FreeBSD Rust Team <rust>
Status: New ---    
Severity: Affects Only Me CC: ports-bugs
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
0001-cargo-crates.awk-any-new-section-terminates-the-curr.patch tobik: maintainer-approval-

Description Jan Beich freebsd_committer freebsd_triage 2023-04-02 18:11:11 UTC
After ports d09e89181b41 or https://github.com/fishfolk/jumpy/commit/f3ddaf31fbab one crate goes missing despite still being listed in Cargo.lock.

$ cd games/jumpy
$ make cargo-crates BATCH= | portedit merge -i Makefile.crates
$ make makesum
$ make
[...]
===>   Updating Cargo.lock
error: no matching package found
searched package name: `zstd-sys`
perhaps you meant:      js-sys or zstd-safe
location searched: registry `crates-io`
required by package `zstd-safe v5.0.2+zstd.1.5.2`
    ... which satisfies dependency `zstd-safe = "^5.0.1"` of package `zstd v0.11.2+zstd.1.5.2`
    ... which satisfies dependency `zstd = "^0.11.1"` of package `puffin v0.14.3`
    ... which satisfies dependency `puffin = "^0.14.3"` of package `jumpy v0.5.1 (/wrkdirs/usr/ports/games/jumpy/work/jumpy-0.6.1)`
*** Error code 101

Removing the following appears to help:

[[patch.unused]]
name = "bevy_simple_tilemap"
version = "0.11.0"
source = "git+https://github.com/forbjok/bevy_simple_tilemap.git#9a1d4332e961327443adb16aca306f837b6f4da5"
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2023-05-27 12:09:29 UTC
Created attachment 242442 [details]
0001-cargo-crates.awk-any-new-section-terminates-the-curr.patch

Can you test if this breaks anything?
Comment 2 Tobias Kortkamp freebsd_committer freebsd_triage 2024-01-05 12:38:37 UTC
Comment on attachment 242442 [details]
0001-cargo-crates.awk-any-new-section-terminates-the-curr.patch

Coming back to this I don't think it's reasonable to support invalid Cargo.lock files. I don't think this is a regular occurrence anyway.

A proper solution would need a rewrite of cargo-crates.awk with a TOML parser anyway and not what I proposed here.