From d8d130e44c719c62400b56ee9c9e2130838e18d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=BF=94=E5=AE=87-wxy?= Date: Thu, 5 Jan 2023 01:46:29 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9json=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=86=99=E5=85=A5=E7=AD=96=E7=95=A5=201=E3=80=81=E5=9C=A8?= =?UTF-8?q?=E4=BB=93=E5=BA=93=E6=B2=A1=E6=9C=89=E6=BA=90=E7=A0=81=E5=8C=85?= =?UTF-8?q?=E7=9A=84=E6=83=85=E5=86=B5=E4=B8=8B=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E5=BA=93=E5=8C=85=E6=9C=AC=E5=9C=B0=E7=89=88=E6=9C=AC=E5=8F=8A?= =?UTF-8?q?=E5=85=B1=E4=BA=AB=E5=BA=93=E4=BF=A1=E6=81=AF=E6=9F=A5=E6=89=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 王翔宇-wxy --- LibChecker/lib_checker.py | 40 ++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/LibChecker/lib_checker.py b/LibChecker/lib_checker.py index 2ef88e3..540b0ea 100755 --- a/LibChecker/lib_checker.py +++ b/LibChecker/lib_checker.py @@ -309,6 +309,19 @@ def libchecker_checking_loop(): for last_key in g_storejsondict: l_pkgresult_to_json.clear() + #向json文件写入库包级别 + with open("Outputs/libchecker-output.json", 'r') as fr: + json_level = json.load(fr) + json_level[last_key]['Level'] = g_storejsondict[last_key]['necessity'][g_inputostype]['level'] + with open("Outputs/libchecker-output.json", 'w+') as fw: + json.dump(json_level,fw,ensure_ascii=False,indent=4) + #向json文件写入库包需求版本 + with open("Outputs/libchecker-output.json", 'r') as fr: + json_required_ver = json.load(fr) + json_required_ver[last_key]['Required version'] = g_storejsondict[last_key]['version'][g_inputostype] + with open("Outputs/libchecker-output.json", 'w+') as fw: + json.dump(json_required_ver,fw,ensure_ascii=False,indent=4) + if (g_storejsondict[last_key]['necessity'][g_ostype]['level'] == "L1"): g_counter_flags['pkg_counter']['total']['l1'] += 1 if (g_storejsondict[last_key]['necessity'][g_ostype]['level'] == "L2"): @@ -340,6 +353,20 @@ def libchecker_checking_loop(): print("\t\t\t\t\t检测结果 -> 未检测到存在") g_subresults_to_json[list1_item] = {'status': 'not found', 'path':'-'} g_counter_flags['lib_counter']['failed'] += 1 + + with open("Outputs/libchecker-output.json", 'r') as fr: + json_so = json.load(fr) + json_so[last_key]['Shared library'] = "-" + with open("Outputs/libchecker-output.json", 'w+') as fw: + json.dump(json_so,fw,ensure_ascii=False,indent=4) + + with open("Outputs/libchecker-output.json", 'r') as fr: + json_local_ver = json.load(fr) + json_local_ver[last_key]['Binary package'] = "-" + with open("Outputs/libchecker-output.json", 'w+') as fw: + json.dump(json_local_ver,fw,ensure_ascii=False,indent=4) + + continue else: print("\t\t\t\t\t检测结果 -> ", compare_library_version(temp_libsoname, str(list1_item))) if (compare_library_version(temp_libsoname, str(list1_item)) == "equal" ): @@ -380,18 +407,6 @@ def libchecker_checking_loop(): else: continue - #向json文件写入库包级别 - with open("Outputs/libchecker-output.json", 'r') as fr: - json_level = json.load(fr) - json_level[last_key]['Level'] = g_storejsondict[last_key]['necessity'][g_inputostype]['level'] - with open("Outputs/libchecker-output.json", 'w+') as fw: - json.dump(json_level,fw,ensure_ascii=False,indent=4) - #向json文件写入库包需求版本 - with open("Outputs/libchecker-output.json", 'r') as fr: - json_required_ver = json.load(fr) - json_required_ver[last_key]['Required version'] = g_storejsondict[last_key]['version'][g_inputostype] - with open("Outputs/libchecker-output.json", 'w+') as fw: - json.dump(json_required_ver,fw,ensure_ascii=False,indent=4) #向json文件写入共享库兼容信息 with open("Outputs/libchecker-output.json", 'r') as fr: json_so = json.load(fr) @@ -405,7 +420,6 @@ def libchecker_checking_loop(): with open("Outputs/libchecker-output.json", 'w+') as fw: json.dump(json_local_ver,fw,ensure_ascii=False,indent=4) - print("=============================================================================================================") print("结束检查 ",time.strftime("%Y-%m-%d %H:%M:%S",time.localtime())) print("") -- Gitee