Add new dependencies to updatecheck.py, add a flag we can use to have our CI test it.

This commit is contained in:
Taylor Hornby 2020-08-03 15:01:01 -06:00
parent 88082c4a56
commit 902bf838af
1 changed files with 64 additions and 44 deletions

View File

@ -25,6 +25,12 @@
# .mk files in depends/packages, this script will exit with # .mk files in depends/packages, this script will exit with
# a nonzero status. The latter case would suggest someone added a new dependency # a nonzero status. The latter case would suggest someone added a new dependency
# without adding a corresponding entry to get_dependency_list() below. # without adding a corresponding entry to get_dependency_list() below.
#
# To test the script itself, run it with --functionality-test as the only
# argument. This will exercise the full functionality of the script, but will
# only return a non-zero exit status when there's something wrong with the
# script itself, for example if a new file was added to depends/packages/ but
# wasn't added to this script.
import requests import requests
import os import os
@ -89,32 +95,45 @@ def get_dependency_list():
DependsVersionGetter("utfcpp")) DependsVersionGetter("utfcpp"))
] ]
# Rust crates. # Rust crates (filename portion: depends/packages/crate_<NAME>.mk).
crates = [ crates = [
"aes", "aesni", "aes_soft", "arrayvec", "bellman", "aes", "aesni", "aes_soft", "arrayvec", "bellman", "arrayref",
"arrayref", "autocfg", "bigint", "blake2b_simd", "blake2s_simd", "autocfg", "bigint", "blake2b_simd", "blake2s_simd", "bit_vec",
"bit_vec", "block_cipher_trait", "byteorder", "block_cipher_trait", "byteorder", "byte_tools", "block_buffer",
"block_buffer", "block_padding", "c2_chacha", "cfg_if", "crunchy", "block_padding", "c2_chacha", "cfg_if", "crunchy",
"byte_tools", "constant_time_eq", "crossbeam", "digest", "fpe", "curve25519_dalek", "constant_time_eq", "crossbeam", "digest", "fpe",
"crossbeam_channel", "crossbeam_deque", "crossbeam_epoch", "crossbeam_channel", "crossbeam_deque", "crossbeam_epoch",
"crossbeam_utils", "crossbeam_queue", "crypto_api", "crypto_api_chachapoly", "crossbeam_utils", "crossbeam_queue", "crypto_api",
"directories", "fake_simd", "ff", "ff_derive", "getrandom", "hex", "log", "crypto_api_chachapoly", "directories", "ed25519_zebra", "fake_simd",
"ff", "ff_derive", "getrandom", "hex", "hex2", "log",
"futures_cpupool", "futures", "generic_array", "group", "futures_cpupool", "futures", "generic_array", "group",
"lazy_static", "libc", "nodrop", "num_bigint", "lazy_static", "libc", "nodrop", "num_bigint", "memoffset",
"memoffset", "ppv_lite86", "proc_macro2", "quote", "ppv_lite86", "proc_macro2", "quote", "num_cpus", "num_integer",
"num_cpus", "num_integer", "num_traits", "opaque_debug", "pairing", "num_traits", "opaque_debug", "pairing", "rand", "typenum",
"rand", "typenum",
"rand_chacha", "rand_core", "rand_hc", "rand_xorshift", "rand_chacha", "rand_core", "rand_hc", "rand_xorshift",
"rustc_version", "scopeguard", "semver", "semver_parser", "sha2", "syn", "rustc_version", "scopeguard", "semver", "semver_parser", "serde",
"unicode_xid", "wasi", "serde_derive", "sha2", "subtle", "syn", "thiserror",
"winapi_i686_pc_windows_gnu", "winapi", "winapi_x86_64_pc_windows_gnu", "thiserror_impl", "unicode_xid", "wasi",
"zcash_history", "zcash_primitives", "zcash_proofs" "winapi_i686_pc_windows_gnu", "winapi",
"winapi_x86_64_pc_windows_gnu", "zcash_history", "zcash_primitives",
"zcash_proofs", "zeroize"
] ]
# Sometimes we need multiple versions of a crate, in which case there can't
# be a direct mapping between the filename portion and the crate name.
crate_name_exceptions = {
"hex2": "hex"
}
for crate in crates: for crate in crates:
if crate in crate_name_exceptions.keys():
crate_name = crate_name_exceptions[crate]
else:
crate_name = crate
dependencies.append( dependencies.append(
Dependency("crate_" + crate, Dependency("crate_" + crate,
RustCrateReleaseLister(crate), RustCrateReleaseLister(crate_name),
DependsVersionGetter("crate_" + crate) DependsVersionGetter("crate_" + crate)
) )
) )
@ -384,42 +403,43 @@ def main():
for dependency in deps: for dependency in deps:
if dependency.name in unchecked_dependencies: if dependency.name in unchecked_dependencies:
unchecked_dependencies.remove(dependency.name) unchecked_dependencies.remove(dependency.name)
if len(sys.argv) == 2 and sys.argv[1] == "skipcheck": if dependency.is_up_to_date():
print("Skipping the actual dependency update checks.") print_row(
dependency.name,
"up to date",
str(dependency.current_version()),
"")
else: else:
if dependency.is_up_to_date(): # The status can either be POSTPONED or OUT OF DATE depending
print_row( # on whether or not all the new versions are whitelisted.
dependency.name, status_text = "POSTPONED"
"up to date", newver_list = "["
str(dependency.current_version()), for newver in dependency.released_versions_after_current_version():
"") if postponed.is_postponed(dependency.name, newver):
else: newver_list += str(newver) + " (postponed),"
# The status can either be POSTPONED or OUT OF DATE depending else:
# on whether or not all the new versions are whitelisted. newver_list += str(newver) + ","
status_text = "POSTPONED" status_text = "OUT OF DATE"
newver_list = "[" status = 1
for newver in dependency.released_versions_after_current_version():
if postponed.is_postponed(dependency.name, newver):
newver_list += str(newver) + " (postponed),"
else:
newver_list += str(newver) + ","
status_text = "OUT OF DATE"
status = 1
newver_list = newver_list[:-1] + "]" newver_list = newver_list[:-1] + "]"
print_row( print_row(
dependency.name, dependency.name,
status_text, status_text,
str(dependency.current_version()), str(dependency.current_version()),
newver_list newver_list
) )
if len(unchecked_dependencies) > 0: if len(unchecked_dependencies) > 0:
unchecked_dependencies.sort() unchecked_dependencies.sort()
print("WARNING: The following dependencies are not being checked for updates by this script: " + ', '.join(unchecked_dependencies)) print("WARNING: The following dependencies are not being checked for updates by this script: " + ', '.join(unchecked_dependencies))
sys.exit(2) sys.exit(2)
if len(sys.argv) == 2 and sys.argv[1] == "--functionality-test":
print("We're only testing this script's functionality. The exit status will only be nonzero if there's a problem with the script itself.")
sys.exit(0)
if status == 0: if status == 0:
print("Ready to release. All dependencies are up-to-date or postponed.") print("Ready to release. All dependencies are up-to-date or postponed.")
elif status == 1: elif status == 1: