mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-29 01:13:08 +00:00
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
This commit is contained in:
parent
8b867c996a
commit
bb415dbba6
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=519063
@ -6,6 +6,9 @@ BEGIN {
|
||||
gl_tuple_len = 0
|
||||
crates_len = 0
|
||||
package_name = "<unknown>"
|
||||
crate_name = "<unknown>"
|
||||
crate_version = "<unknown>"
|
||||
crate_source = "<unknown>"
|
||||
|
||||
gitlab_sites["https://gitlab.com"] = 1
|
||||
gitlab_sites["https://gitlab.freedesktop.org"] = 1
|
||||
@ -13,19 +16,37 @@ BEGIN {
|
||||
gitlab_sites["https://gitlab.redox-os.org"] = 1
|
||||
}
|
||||
|
||||
/^"checksum .* .* \(registry\+.*\)" = ".*"/ {
|
||||
# $2: crate
|
||||
# $3: version
|
||||
# $4: url
|
||||
# $6: checksum
|
||||
crates[crates_len++] = sprintf("%s-%s", $2, $3)
|
||||
}
|
||||
|
||||
/^name = ".*"/ {
|
||||
crate_name = $3
|
||||
gsub(/"/, "", crate_name)
|
||||
|
||||
package_name = $3
|
||||
gsub("[^a-zA-Z_]", "", package_name)
|
||||
}
|
||||
|
||||
/^version = ".*"/ {
|
||||
crate_version = $3
|
||||
gsub(/"/, "", crate_version)
|
||||
}
|
||||
|
||||
/^source = ".*"/ {
|
||||
crate_source = $3
|
||||
gsub(/"/, "", crate_source)
|
||||
}
|
||||
|
||||
/^\[\[package\]\]$/ {
|
||||
add_crate()
|
||||
}
|
||||
|
||||
function add_crate() {
|
||||
if (crate_source == "registry+https://github.com/rust-lang/crates.io-index") {
|
||||
crates[crates_len++] = sprintf("%s-%s", crate_name, crate_version)
|
||||
}
|
||||
crate_name = "<unknown>"
|
||||
crate_version = "<unknown>"
|
||||
crate_source = "<unknown>"
|
||||
}
|
||||
|
||||
function split_url(s) {
|
||||
# scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
|
||||
split(s, url_scheme, "://")
|
||||
@ -112,6 +133,8 @@ function print_array(start, arr, arrlen) {
|
||||
}
|
||||
|
||||
END {
|
||||
add_crate()
|
||||
|
||||
if (gh_tuple_len > 0 && ENVIRON["USE_GITHUB"] == "") {
|
||||
printf "USE_GITHUB=\tnodefault\n"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user