mirror of
https://git.FreeBSD.org/ports.git
synced 2025-01-19 08:13:21 +00:00
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
This commit is contained in:
parent
18608884ba
commit
8fae936cf5
@ -90,8 +90,8 @@ function find_replaced_crates(input, output, in_patch_crates_io, line, cols) {
|
||||
close(output)
|
||||
}
|
||||
|
||||
function add_crates_io_patches( header_printed, cmd, cargotoml, source, crates) {
|
||||
header_printed = 0
|
||||
function add_crates_io_patches( print_header, local_crates, cmd, cargotoml, source, crates) {
|
||||
print_header = 0
|
||||
# --exclude-dir not supported on FreeBSD < 13
|
||||
# cmd = GREP " --include='*/Cargo.toml' --exclude-dir='" CARGO_VENDOR_DIR "' -Flr 'patch.crates-io' " WRKSRC
|
||||
cmd = FIND " " WRKSRC " -name Cargo.toml -not -path '" CARGO_VENDOR_DIR "/*' -exec " GREP " -Flr 'patch.crates-io' {} \\\+"
|
||||
@ -106,16 +106,20 @@ function add_crates_io_patches( header_printed, cmd, cargotoml, source, crates)
|
||||
split(source_crates[source], crates)
|
||||
for (j in crates) {
|
||||
if (replaced_crates[crates[j]]) {
|
||||
if (!header_printed) {
|
||||
printf("[patch.crates-io]\n")
|
||||
header_printed = 1
|
||||
}
|
||||
printf("%s = { path = '%s' }\n", crates[j], get_source_dir(source, crates[j]))
|
||||
print_header = 1
|
||||
local_crates[crates[j]] = get_source_dir(source, crates[j])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (print_header == 1) {
|
||||
printf("[patch.crates-io]\n")
|
||||
|
||||
for (i in local_crates) {
|
||||
printf("%s = { path = '%s' }\n", i, local_crates[i])
|
||||
}
|
||||
}
|
||||
close(cmd)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user