2017-09-19 16:12:01 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2017-10-05 22:51:07 +01:00
|
|
|
# pylint: disable=C0111,C0326,C0103
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2018-02-03 21:25:26 +00:00
|
|
|
"""Check all/given PRDs for FULL updates."""
|
|
|
|
|
2017-11-03 05:25:25 +00:00
|
|
|
import sys
|
2018-02-03 20:24:36 +00:00
|
|
|
|
2018-02-10 01:37:10 +00:00
|
|
|
from tcllib import ansi, argparser, devlist
|
2018-02-05 23:22:24 +00:00
|
|
|
from tcllib.devices import DesktopDevice
|
2018-02-11 00:48:47 +00:00
|
|
|
from tcllib.dumpmgr import write_info_if_dumps_found
|
|
|
|
from tcllib.requests import RequestRunner, CheckRequest, ServerVoteSelector
|
2018-02-03 20:24:36 +00:00
|
|
|
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2018-02-05 23:22:24 +00:00
|
|
|
dev = DesktopDevice()
|
2017-09-19 16:12:01 +01:00
|
|
|
|
2018-01-30 17:31:05 +00:00
|
|
|
dpdesc = """
|
|
|
|
Checks for the latest FULL updates for all PRD numbers or only for
|
|
|
|
the PRD specified as prd.
|
|
|
|
"""
|
2018-02-10 01:37:10 +00:00
|
|
|
dp = argparser.DefaultParser(__file__, dpdesc)
|
2018-01-30 17:31:05 +00:00
|
|
|
dp.add_argument("-p", "--prd", help="CU Reference # to filter scan results", dest="tocheck", nargs="?", default=None, metavar="PRD")
|
2018-02-09 20:41:12 +00:00
|
|
|
dp.add_argument("-l", "--local", help="Force using local database", dest="local", action="store_true", default=False)
|
2017-11-03 05:25:25 +00:00
|
|
|
args = dp.parse_args(sys.argv[1:])
|
|
|
|
|
|
|
|
prdcheck = "" if args.tocheck is None else args.tocheck
|
|
|
|
|
2017-12-19 23:01:55 +00:00
|
|
|
print("Loading list of devices.")
|
2018-02-09 20:41:12 +00:00
|
|
|
prds = devlist.get_devicelist(local=args.local)
|
2017-12-17 02:12:09 +00:00
|
|
|
|
2017-09-19 16:12:01 +01:00
|
|
|
print("List of latest FULL firmware by PRD:")
|
|
|
|
|
2018-02-08 23:17:43 +00:00
|
|
|
runner = RequestRunner(ServerVoteSelector())
|
|
|
|
runner.max_tries = 20
|
|
|
|
|
2017-12-17 02:18:55 +00:00
|
|
|
for prd, variant in prds.items():
|
|
|
|
model = variant["variant"]
|
|
|
|
lastver = variant["last_full"]
|
2018-02-08 23:17:43 +00:00
|
|
|
if not prdcheck in prd:
|
|
|
|
continue
|
|
|
|
dev.curef = prd
|
|
|
|
chk = CheckRequest(dev)
|
|
|
|
runner.run(chk)
|
|
|
|
if chk.success:
|
|
|
|
result = chk.get_result()
|
|
|
|
txt_tv = result.tvver
|
|
|
|
if result.tvver != lastver:
|
|
|
|
txt_tv = "{} (old: {} / OTA: {})".format(
|
|
|
|
ansi.CYAN + txt_tv + ansi.RESET,
|
|
|
|
ansi.CYAN_DARK + variant["last_full"] + ansi.RESET,
|
|
|
|
variant["last_ota"]
|
|
|
|
)
|
|
|
|
else:
|
|
|
|
result.delete_dump()
|
|
|
|
print("{}: {} {} ({})".format(prd, txt_tv, result.filehash, model))
|
|
|
|
else:
|
|
|
|
print("{}: {}".format(prd, str(chk.error)))
|
2017-11-12 21:19:04 +00:00
|
|
|
|
2018-02-08 23:17:08 +00:00
|
|
|
write_info_if_dumps_found()
|