73 def main(new_mcs_file_name, new_bit_file_name, pr_verify_rpt_file_name):
75 me_abs_dir = os.path.dirname(os.path.realpath(__file__))
76 me_abs_file = os.path.abspath(os.path.realpath(__file__))
77 cfp_json_file = me_abs_dir + __cfp_json_path__
78 debugging_flow = os.environ.get(
'CFP_DEBUGGING')
79 if debugging_flow
is not None:
80 cfp_json_file = me_abs_dir + debugging_flow +
'/cFp.json'
81 with open(cfp_json_file,
'r')
as json_file:
82 cFp_data = json.load(json_file)
85 root_abs = os.path.realpath(me_abs_dir+
"/../")
86 if debugging_flow
is not None:
87 root_abs = os.path.realpath(me_abs_dir + debugging_flow +
"/env/" +
"/../")
88 cFp_data[
'abs_path'] = root_abs
89 dcps_folder = root_abs + __dcps_folder_name__
91 dcp_file_name =
"3_top{}_STATIC.dcp".format(cFp_data[__mod_type_key__])
92 target_file_name = os.path.abspath(dcps_folder +
"/" + dcp_file_name)
96 new_mcs_file_path = os.path.abspath(dcps_folder +
'/' + new_mcs_file_name)
97 if not os.path.isfile(new_mcs_file_path):
98 print(
"[cFBuild] ERROR: {} is not a file. STOP.".format(new_mcs_file_path))
101 new_bit_file_path = os.path.abspath(dcps_folder +
'/' + new_bit_file_name)
102 if not os.path.isfile(new_bit_file_path):
103 print(
"[cFBuild] ERROR: {} is not a file. STOP.".format(new_bit_file_path))
106 pr_verify_rpt_file_path = os.path.abspath(dcps_folder +
'/' + pr_verify_rpt_file_name)
107 if not os.path.isfile(pr_verify_rpt_file_path):
108 print(
"[cFBuild] ERROR: {} is not a file. STOP.".format(pr_verify_rpt_file_path))
111 with open(pr_verify_rpt_file_path)
as rpt_in:
113 rpt_file_lines.append(line.rstrip())
114 pr_verify_str =
''.join(rpt_file_lines)
116 sig_file_path = os.path.abspath(dcps_folder +
'/' + __admin_sig_file_name__ +
'.' + __sig_file_ending__)
118 new_sig = {
'build_id': __admin_sig_file_name__,
'algorithm': __admin_sig_file_name__,
119 'file': __admin_sig_file_name__,
'pl_id':
'new_pl',
'hash':
'ignore'}
138 if debugging_flow
is not None:
139 print(
"\tdcp hash: {}".format(dcp_hash))
140 print(
"\trpt hash: {}".format(rpt_hash))
141 print(
"\tbit hash: {}".format(bit_hash))
142 print(
"\tmcs hash: {}".format(mcs_hash))
145 new_sig[
'sig'] =
get_admin_sig_string(dcp_hash, mcs_hash, bit_hash, rpt_hash, debugging_flow=debugging_flow)
146 new_sig[
'dcp_hash'] = dcp_hash
147 new_sig[
'mcs_hash'] = mcs_hash
148 new_sig[
'bit_hash'] = bit_hash
149 new_sig[
'rpt_hash'] = rpt_hash
151 rpt_sum_line = rpt_file_lines[-1]
152 new_sig[
'verify_rpt'] = rpt_sum_line
153 if dcp_file_name
in rpt_sum_line:
154 new_sig[
'verify'] =
'OK'
156 new_sig[
'verify'] =
'NOK'
158 with open(sig_file_path,
'w')
as outfile:
159 json.dump(new_sig, outfile)
def main(new_mcs_file_name, new_bit_file_name, pr_verify_rpt_file_name)