Add latest_valid_build to the plist output

This commit is contained in:
Graham Pugh 2022-10-03 00:23:10 +02:00
parent b1b7a8d02e
commit 881c394399

View File

@ -1063,48 +1063,44 @@ def main():
# determine the latest valid build ID and select this # determine the latest valid build ID and select this
# when using auto, os and version options # when using auto, os and version options
if args.auto or args.version or args.os: if args.beta or "Beta" not in product_info[product_id]["title"]:
if args.beta or "Beta" not in product_info[product_id]["title"]: try:
try: latest_valid_build
latest_valid_build except NameError:
except NameError: latest_valid_build = product_info[product_id]["BUILD"]
latest_valid_build = product_info[product_id]["BUILD"] # if using newer-than option, skip if not newer than the version
# we are checking against
if args.newer_than_version:
latest_valid_build = get_latest_version(
product_info[product_id]["version"], args.newer_than_version
)
if latest_valid_build == args.newer_than_version:
continue
# if using renew option, skip if the same as the current version
if args.renew and build_info[0] == product_info[product_id]["version"]:
continue
answer = index + 1
else:
latest_valid_build = get_latest_version(
product_info[product_id]["BUILD"], latest_valid_build
)
if latest_valid_build == product_info[product_id]["BUILD"]:
# if using newer-than option, skip if not newer than the version # if using newer-than option, skip if not newer than the version
# we are checking against # we are checking against
if args.newer_than_version: if args.newer_than_version:
latest_valid_build = get_latest_version( latest_valid_build = get_latest_version(
product_info[product_id]["version"], args.newer_than_version product_info[product_id]["version"],
args.newer_than_version,
) )
if latest_valid_build == args.newer_than_version: if latest_valid_build == args.newer_than_version:
continue continue
# if using renew option, skip if the same as the current version # if using renew option, skip if the same as the current version
if ( if (
args.renew args.renew
and build_info[0] == product_info[product_id]["version"] and build_info[1] == product_info[product_id]["BUILD"]
): ):
continue continue
answer = index + 1 answer = index + 1
else:
latest_valid_build = get_latest_version(
product_info[product_id]["BUILD"], latest_valid_build
)
if latest_valid_build == product_info[product_id]["BUILD"]:
# if using newer-than option, skip if not newer than the version
# we are checking against
if args.newer_than_version:
latest_valid_build = get_latest_version(
product_info[product_id]["version"],
args.newer_than_version,
)
if latest_valid_build == args.newer_than_version:
continue
# if using renew option, skip if the same as the current version
if (
args.renew
and build_info[1] == product_info[product_id]["BUILD"]
):
continue
answer = index + 1
# Write this build info to plist # Write this build info to plist
pl_index = { pl_index = {
@ -1148,6 +1144,12 @@ def main():
# Output a plist of available updates and quit if list option chosen # Output a plist of available updates and quit if list option chosen
if args.list: if args.list:
try:
print("\nLatest valid build: %s (# %s)" % (latest_valid_build, answer))
pl["latest_valid_build"] = latest_valid_build
except NameError:
pl["latest_valid_build"] = ""
print("\nNo valid build found")
write_plist(pl, output_plist) write_plist(pl, output_plist)
print("\nValid seeding programs are: %s\n" % ", ".join(get_seeding_programs())) print("\nValid seeding programs are: %s\n" % ", ".join(get_seeding_programs()))
exit(0) exit(0)