mirror of
https://github.com/mbirth/tcl_ota_check.git
synced 2024-11-10 06:16:46 +00:00
Started converting tclcheck.py to new classes.
This commit is contained in:
parent
18205963e9
commit
a38f216607
30
tclcheck.py
30
tclcheck.py
@ -12,11 +12,10 @@ import sys
|
|||||||
import tcllib
|
import tcllib
|
||||||
import tcllib.argparser
|
import tcllib.argparser
|
||||||
from tcllib.devices import Device
|
from tcllib.devices import Device
|
||||||
|
from tcllib.requests import RequestRunner, CheckRequest, DownloadRequest, ServerSelector, write_info_if_dumps_found
|
||||||
from tcllib.xmltools import pretty_xml
|
from tcllib.xmltools import pretty_xml
|
||||||
|
|
||||||
|
|
||||||
fc = tcllib.FotaCheck()
|
|
||||||
|
|
||||||
dpdesc = """
|
dpdesc = """
|
||||||
Checks for the latest FULL updates for the specified PRD number or for an OTA from the
|
Checks for the latest FULL updates for the specified PRD number or for an OTA from the
|
||||||
version specified as fvver.
|
version specified as fvver.
|
||||||
@ -68,16 +67,27 @@ else:
|
|||||||
print("Mode: {}".format(dev.mode))
|
print("Mode: {}".format(dev.mode))
|
||||||
print("CLTP: {}".format(dev.cltp))
|
print("CLTP: {}".format(dev.cltp))
|
||||||
|
|
||||||
fc.reset_session(dev)
|
runner = RequestRunner(ServerSelector())
|
||||||
check_xml = fc.do_check(dev)
|
|
||||||
print(pretty_xml(check_xml))
|
|
||||||
curef, fv, tv, fw_id, fileid, fn, fsize, fhash = fc.parse_check(check_xml)
|
|
||||||
|
|
||||||
req_xml = fc.do_request(curef, fv, tv, fw_id)
|
# Check for update
|
||||||
print(pretty_xml(req_xml))
|
chk = CheckRequest(dev)
|
||||||
fileid, fileurl, slaves, encslaves, s3_fileurl, s3_slaves = fc.parse_request(req_xml)
|
runner.run(chk)
|
||||||
|
if not chk.success:
|
||||||
|
print("{}".format(chk.error))
|
||||||
|
sys.exit(2)
|
||||||
|
chkres = chk.get_result()
|
||||||
|
print(chkres.pretty_xml())
|
||||||
|
|
||||||
if encslaves:
|
# Request download
|
||||||
|
dlr = DownloadRequest(dev, chkres.tvver, chkres.fw_id)
|
||||||
|
runner.run(dlr)
|
||||||
|
if not dlr.success:
|
||||||
|
print("{}".format(dlr.error))
|
||||||
|
sys.exit(3)
|
||||||
|
dlrres = dlr.get_result()
|
||||||
|
print(dlrres.pretty_xml())
|
||||||
|
|
||||||
|
if dlrres.encslaves:
|
||||||
chksum_xml = fc.do_checksum(random.choice(encslaves), fileurl, fileurl)
|
chksum_xml = fc.do_checksum(random.choice(encslaves), fileurl, fileurl)
|
||||||
print(pretty_xml(chksum_xml))
|
print(pretty_xml(chksum_xml))
|
||||||
file_addr, sha1_body, sha1_enc_footer, sha1_footer = fc.parse_checksum(chksum_xml)
|
file_addr, sha1_body, sha1_enc_footer, sha1_footer = fc.parse_checksum(chksum_xml)
|
||||||
|
Loading…
Reference in New Issue
Block a user