Created attachment 244277 [details] Makefile The build fails with the attached Makefile that has CARGO_CRATES generated with 'make cargo-crates': > ===> Updating Cargo.lock > error: failed to load manifest for workspace member `/usr/ports/security/solana/work/solana-1.16.9/account-decoder` > > Caused by: > failed to parse manifest at `/usr/ports/security/solana/work/solana-1.16.9/account-decoder/Cargo.toml` > > Caused by: > could not load Cargo configuration > > Caused by: > could not parse TOML configuration in `/usr/ports/security/solana/work/.cargo/config.toml` > > Caused by: > could not parse input as TOML > > Caused by: > TOML parse error at line 8, column 1 > | > 8 | ntapi = { path = '/usr/ports/security/solana/work/ntapi-97ede981a1777883ff86d142b75024b023f04fad' } > | ^ > duplicate key `ntapi` in table `patch.crates-io` > *** Error code 101 Additionally, after the duplicate is removed, the build fails again due to missing dependencies: > ===> Updating Cargo.lock > error: no matching package found > searched package name: `ntapi` > perhaps you meant: caps, clap, hidapi, ... > location searched: registry `crates-io` > required by package `mio v0.7.14` > ... which satisfies dependency `mio = "^0.7.6"` of package `tokio v1.14.1` > ... which satisfies dependency `tokio = "^1.13.0"` of package `quinn v0.9.4` > ... which satisfies dependency `quinn = "^0.9.4"` of package `solana-client v1.16.9 (/usr/ports/security/solana/work/solana-1.16.9/client)` > ... which satisfies path dependency `solana-client` of package `solana-accounts-cluster-bench v1.16.9 (/usr/ports/security/solana/work/solana-1.16.9/accounts-cluster-bench)` > *** Error code 101 rust-1.71.0 FreeBSD 13.2
(In reply to Yuri Victorovich from comment #0) This problem arise if there are multiple Cargo.toml containing the same crates in the [patch.crates-io] section, example with libsignal 0.31.0: cat work/libsignal-0.31.0/rust/protocol/fuzz/Cargo.toml [patch.crates-io] # Use our fork of curve25519-dalek for zkgroup support. curve25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.0.0' } x25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.0.0' } cat work/libsignal-0.31.0/Cargo.toml [patch.crates-io] # Use our fork of curve25519-dalek for zkgroup support. curve25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.0.0' } x25519-dalek = { git = 'https://github.com/signalapp/curve25519-dalek', tag = 'signal-curve25519-4.0.0' } boring = { git = 'https://github.com/signalapp/boring', branch = 'libsignal' } # This revision of snow is where curve25519-dalek v4.0.0 changes were merged in snow = { git = 'https://github.com/mcginty/snow.git', rev = '586292364a30ecc74c785228b41e60b3ef03e773' } So x25519-dalek and curve25519-dalek appears twice in work/.cargo/config.toml Removing the duplicate in work/.cargo/config.toml won't work as the various awk scripts remove the [patch.crates-io] section in cargo.toml, cf https://cgit.freebsd.org/ports/tree/Mk/Scripts/cargo-crates-git-configure.awk?h=2023Q3#n65 So the second run won't put the needed dependency in work/.cargo/config.toml
Created attachment 245254 [details] v0 The attached patch is an attempt at fixing the issue. It generates the dependency after parsing all the cargo.toml.
Comment on attachment 245254 [details] v0 It's probably ok if all ports that have @git+ in CARGO_CRATES (or non-empty _CARGO_GIT_SOURCES) still pass 'make configure' ('make patch cargo-configure' is probably enough as a shortcut). The "local" variables list (the one after "function add_crates_io_patches(\t") needs to be updated with local_crates and print_header. References to the unused header_printed can be removed.
Created attachment 245445 [details] v1
Comment on attachment 245445 [details] v1 lgtm
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=8fae936cf5a65db050d6b0950a912a4f028e34d8 commit 8fae936cf5a65db050d6b0950a912a4f028e34d8 Author: Mikael Urankar <mikael@FreeBSD.org> AuthorDate: 2023-10-08 16:36:11 +0000 Commit: Mikael Urankar <mikael@FreeBSD.org> CommitDate: 2023-10-08 16:41:17 +0000 Mk/Scripts/cargo-crates-git-configure.awk: Generate the patch.crates-io section after parsing all the Cargo.toml files If we have multiple Cargo.toml files with the same crates in the [patch.crates-io] section we will end up with crates defined mutiple times and cargo will refuse to proceed. Write this section after parsing all the Cargo.toml files. PR: 273280 Reviewed by: tobik Mk/Scripts/cargo-crates-git-configure.awk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
(In reply to Tobias Kortkamp from comment #5) Thanks for the review.
A commit in branch 2023Q4 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=1e49125934332178017a2508fa182865b47d890f commit 1e49125934332178017a2508fa182865b47d890f Author: Mikael Urankar <mikael@FreeBSD.org> AuthorDate: 2023-10-08 16:36:11 +0000 Commit: Mikael Urankar <mikael@FreeBSD.org> CommitDate: 2023-10-09 14:38:00 +0000 Mk/Scripts/cargo-crates-git-configure.awk: Generate the patch.crates-io section after parsing all the Cargo.toml files If we have multiple Cargo.toml files with the same crates in the [patch.crates-io] section we will end up with crates defined mutiple times and cargo will refuse to proceed. Write this section after parsing all the Cargo.toml files. PR: 273280 Reviewed by: tobik (cherry picked from commit 8fae936cf5a65db050d6b0950a912a4f028e34d8) Mk/Scripts/cargo-crates-git-configure.awk | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)