From b4ddcc27acc1c0abb994671806443fd11d64d053 Mon Sep 17 00:00:00 2001 From: liangxinyan Date: Wed, 27 Aug 2025 11:20:54 +0800 Subject: [PATCH 1/2] IssueNo: https://gitee.com/openharmony/developtools_integration_verification/issues/ICIF1H Signed-off-by: liangxinyan --- tools/deps_guard/elf_file_mgr/elf_file.py | 2 +- .../rules/BaseInnerApi/base_info.json | 14 +++ .../rules/ChipsetSDK/chipsetsdk_info.json | 92 ++++++++++++++- .../chipsetsdk_sp_indirect_info.json | 55 +++++++++ .../ChipsetsdkSP/chipsetsdk_sp_info.json | 106 ++++++++++++++++++ .../passthrough_indirect_info.json | 100 +++++++++++++++++ .../rules/Passthrough/passthrough_info.json | 48 +++++++- .../rules_checker/base_innerapi_rule.py | 35 +++++- tools/deps_guard/rules_checker/base_rule.py | 14 +-- tools/deps_guard/rules_checker/chipsetsdk.py | 14 +-- .../deps_guard/rules_checker/chipsetsdk_sp.py | 27 +++-- tools/deps_guard/rules_checker/llndk.py | 2 +- tools/deps_guard/rules_checker/passthrough.py | 16 +-- 13 files changed, 484 insertions(+), 41 deletions(-) create mode 100644 tools/deps_guard/rules/BaseInnerApi/base_info.json diff --git a/tools/deps_guard/elf_file_mgr/elf_file.py b/tools/deps_guard/elf_file_mgr/elf_file.py index f119ed1..0585244 100755 --- a/tools/deps_guard/elf_file_mgr/elf_file.py +++ b/tools/deps_guard/elf_file_mgr/elf_file.py @@ -54,7 +54,7 @@ class ElfFile(dict): if not os.access(self._f, os.F_OK): raise Exception("Cannot find lib: " + self._f) file_name = self._f_safe.split("/")[-1].strip("'") - dynamics = command_without_error("strings", self._f_safe, f"|grep -E lib_.so|grep -v {file_name}") + dynamics = command_without_error("strings", self._f_safe, f"|grep -E '^lib.*\.so$'|grep -v {file_name}") res = [] if dynamics: for line in dynamics: diff --git a/tools/deps_guard/rules/BaseInnerApi/base_info.json b/tools/deps_guard/rules/BaseInnerApi/base_info.json new file mode 100644 index 0000000..d445801 --- /dev/null +++ b/tools/deps_guard/rules/BaseInnerApi/base_info.json @@ -0,0 +1,14 @@ +{ + "system_only": [ + { + "name": "build_framework:musl-libc.so", + "so_file_name": "libc.so" + } + ], + "vendor_only": [ + { + "name": "build_framework:musl-libc.so", + "so_file_name": "libc.so" + } + ] +} \ No newline at end of file diff --git a/tools/deps_guard/rules/ChipsetSDK/chipsetsdk_info.json b/tools/deps_guard/rules/ChipsetSDK/chipsetsdk_info.json index d1e5310..9163796 100644 --- a/tools/deps_guard/rules/ChipsetSDK/chipsetsdk_info.json +++ b/tools/deps_guard/rules/ChipsetSDK/chipsetsdk_info.json @@ -674,6 +674,60 @@ "path": "", "headers": [] }, + { + "name": "hdf:libdisplay_buffer_proxy_1.2", + "so_file_name": "libpower_proxy_1.2.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libdisplay_buffer_hdi_impl_v1_1", + "so_file_name": "libdisplay_buffer_hdi_impl_v1_1.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libsensor_proxy_3.0", + "so_file_name": "libsensor_proxy_3.0.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libdisplay_buffer_proxy_1.1", + "so_file_name": "libdisplay_buffer_proxy_1.1.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libdisplay_buffer_proxy_1.3", + "so_file_name": "libpower_proxy_1.3.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libsensor_proxy_2.0", + "so_file_name": "libsensor_proxy_2.0.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libdisplay_buffer_hdi_impl", + "so_file_name": "libdisplay_buffer_hdi_impl.z.so", + "path": "", + "headers": [] + }, + { + "name": "hdf:libdisplay_buffer_hdi_impl_v1_2", + "so_file_name": "libdisplay_buffer_hdi_impl_v1_2.z.so", + "path": "", + "headers": [] + }, + { + "name": "thirdparty:turbojpeg", + "so_file_name": "libturbojpeg.z.so", + "path": "", + "headers": [] + }, { "name": "drivers_interface_perfgenius:perfgenius_client", "so_file_name": "libperfgenius_client.z.so", @@ -683,13 +737,49 @@ { "name": "drivers_interface_perfgenius:perfgenius", "so_file_name": "libperfgenius_proxy_1.0.z.so", - "path": "", + "path": "//vendor/huawei/drivers/interface/perfgenius/perfgenius/v1_0:perfgenius", + "headers": [ + "//vendor/huawei/drivers/interface/perfgenius/perfgenius" + ] + }, + { + "name": "thirdparty:mbedtls_shared", + "so_file_name": "libmbedtls.z.so", + "path": "//third_party/mbedtls:mbedtls_shared", "headers": [] }, { + "name": "drivers_interface_audio:libaudio_proxy_5.0", + "so_file_name": "libaudio_proxy_5.0.z.so", + "path": "//drivers/interface/audio/v5_0:libaudio_proxy_5.0", + "headers": [] + }, + { + "name": "drivers_interface_display:libdisplay_buffer_hdi_impl_v1_3", + "so_file_name": "libdisplay_buffer_hdi_impl_v1_3.z.so", + "path": "//drivers/interface/display/buffer/v1_3:libdisplay_buffer_hdi_impl_v1_3", + "headers": [] + }, + { "name": "commonlibrary:ylong_runtime", "so_file_name": "libylong_runtime.dylib.so", "path": "//commonlibrary/rust/ylong_runtime/ylong_runtime:ylong_runtime", "headers": [] + }, + { + "name": "hiview:xperfservice_client", + "so_file_name": "libxperfservice_client.z.so", + "path": "//base/hiviewdfx/hiview/plugins/performance/xperf_service/interfaces/inner_api/xperfservice_client:xperfservice_client", + "headers": [] + }, + { + "name": "hiview:xperfservice_client", + "so_file_name": "libhuks_hdi_service_1.1.z.so", + "path": "//base/hiviewdfx/hiview/plugins/performance/xperf_service/interfaces/inner_api/xperfservice_client:xperfservice_client", + "headers": [] + }, + { + "so_file_name": "libhuks_engine_core_standard.z.so", + "dep_whitelist": ["libhuks_hdi_service_1.1.z.so"] } ] diff --git a/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_indirect_info.json b/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_indirect_info.json index c1a920e..17b0fba 100755 --- a/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_indirect_info.json +++ b/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_indirect_info.json @@ -58,5 +58,60 @@ "so_file_name": "lzma_shared.z.so", "path": "//third_party/lzma:lzma_shared", "headers": [] + }, + { + "name": "hiviewdfx:libasync_stack", + "so_file_name": "libasync_stack.z.so", + "path": "//base/hiviewdfx/faultloggerd/interfaces/innerkits/async_stack:libasync_stack", + "headers": [] + }, + { + "name": "drivers_interface_display:libdisplay_buffer_proxy_1.2", + "so_file_name": "libdisplay_buffer_hdi_impl_v1_2.z.so", + "path": "//drivers/interface/display/buffer/v1_2:libdisplay_buffer_proxy_1.2", + "headers": [] + }, + { + "name": "communication:ipc_common", + "so_file_name": "libipc_common.z.so", + "path": "//foundation/communication/ipc/ipc/native/src/core:ipc_common", + "headers": [] + }, + { + "name": "drivers_interface_display:libdisplay_buffer_proxy_1.0", + "so_file_name": "libdisplay_buffer_proxy_1.0.z.so", + "path": "//drivers/interface/display/buffer/v1_0:libdisplay_buffer_proxy_1.0", + "headers": [] + }, + { + "name": "drivers_interface_display:libdisplay_buffer_proxy_1.1", + "so_file_name": "libdisplay_buffer_proxy_1.1.z.so", + "path": "//drivers/interface/display/buffer/v1_1:libdisplay_buffer_proxy_1.1", + "headers": [] + }, + { + "name": "hiviewdfx:libthread_sampler", + "so_file_name": "libthread_sampler.z.so", + "path": "//base/hiviewdfx/hicollie/frameworks/native/thread_sampler:libthread_sampler", + "headers": [] + }, + { + "so_file_name": "libhilog.so", + "dep_whitelist": ["libressched_client.z.so", "libstorage_manager_acl.z.so", "libdfx_dumpcatcher.z.so", "libucollection_client.z.so", + "libdisplay_buffer_proxy_1.0.z.so", "libdisplay_buffer_proxy_1.1.z.so", "libfaultloggerd.z.so", "libthread_sampler.z.so", + "libeventhandler.z.so", "libdisplay_buffer_proxy_1.2.z.so", "libipc_common.z.so", "libdisplay_buffer_hdi_impl_v1_2.z.so", + "libasync_stack.z.so", "libunwinder.z.so"] + }, + { + "so_file_name": "libclang_rt.ubsan_minimal.so", + "dep_whitelist": ["libstorage_manager_acl.z.so", "libeventhandler.z.so", "libipc_common.z.so"] + }, + { + "so_file_name": "libdfx_signalhandler.z.so", + "dep_whitelist": ["libdfx_dumpcatcher.z.so"] + }, + { + "so_file_name": "libdrm.so", + "dep_whitelist": ["librga.z.so"] } ] \ No newline at end of file diff --git a/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_info.json b/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_info.json index 4cbf06e..d2a3346 100755 --- a/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_info.json +++ b/tools/deps_guard/rules/ChipsetsdkSP/chipsetsdk_sp_info.json @@ -130,5 +130,111 @@ "so_file_name": "libc++.so", "path": "//build/common/musl:musl-libcxx.so", "headers": [] + }, + { + "name": "build_framework:libc++_shared.so", + "so_file_name": "libc++_shared.so", + "path": "//build/common/libcpp:libc++_shared.so", + "headers": [] + }, + { + "name": "hiviewdfx:libhitracechain", + "so_file_name": "libhitracechain.so", + "path": "//base/hiviewdfx/hitrace/interfaces/native/innerkits:libhitracechain", + "headers": [] + }, + { + "name": "systemabilitymgr:samgr_proxy", + "so_file_name": "libsamgr_proxy.z.so", + "path": "//foundation/systemabilitymgr/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "headers": [] + }, + { + "name": "customization:configpolicy_util", + "so_file_name": "libconfigpolicy_util.z.so", + "path": "//base/customization/config_policy/frameworks/config_policy:configpolicy_util", + "headers": [] + }, + { + "name": "hiviewdfx:libhisysevent", + "so_file_name": "libhisysevent.z.so", + "path": "//base/hiviewdfx/hisysevent/interfaces/native/innerkits/hisysevent:libhisysevent", + "headers": [] + }, + { + "name": "startup:libbeget_proxy", + "so_file_name": "libbeget_proxy.z.so", + "path": "//base/startup/init/interfaces/innerkits:libbeget_proxy", + "headers": [] + }, + { + "name": "hdf_core:libhdf_ipc_adapter", + "so_file_name": "libhdf_ipc_adapter.z.so", + "path": "//drivers/hdf_core/adapter/uhdf2/ipc:libhdf_ipc_adapter", + "headers": [] + }, + { + "name": "thirdparty:jsoncpp", + "so_file_name": "libjsoncpp.z.so", + "path": "//third_party/jsoncpp:jsoncpp", + "headers": [] + }, + { + "name": "commonlibrary:libdmabufheap", + "so_file_name": "libdmabufheap.z.so", + "path": "//commonlibrary/memory_utils/libdmabufheap:libdmabufheap", + "headers": [] + }, + { + "name": "thirdparty:shared_libz", + "so_file_name": "libshared_libz.z.so", + "path": "//third_party/zlib:shared_libz", + "headers": [] + }, + { + "name": "thirdparty:libunwind", + "so_file_name": "libunwind.z.so", + "path": "//third_party/libunwind:libunwind", + "headers": [] + }, + { + "name": "thirdparty:protobuf_lite", + "so_file_name": "libprotobuf_lite.z.so", + "path": "//third_party/protobuf:protobuf_lite", + "headers": [] + }, + { + "name": "tee_client:libteec_vendor", + "so_file_name": "libteec_vendor.so", + "path": "//base/tee/tee_client/frameworks/build/standard:libteec_vendor", + "headers": [] + }, + { + "name": "thirdparty:libcrypto_shared", + "so_file_name": "libcrypto_openssl.z.so", + "path": "//third_party/openssl:libcrypto_shared", + "headers": [] + }, + { + "name": "ipc:ipc_core", + "so_file_name": "libipc_single.z.so", + "path": "//foundation/communication/ipc/interfaces/innerkits/ipc_core:ipc_core", + "headers": [] + }, + { + "so_file_name": "libdisplay_buffer_proxy_1.0.z.so", + "dep_whitelist": ["libcodec_component_manager_service_4.0.z.so"] + }, + { + "so_file_name": "libdisplay_buffer_proxy_1.1.z.so", + "dep_whitelist": ["libcodec_component_manager_service_4.0.z.so"] + }, + { + "so_file_name": "libdisplay_buffer_hdi_impl_v1_3.z.so", + "dep_whitelist": ["libsurface.z.so"] + }, + { + "so_file_name": "libclang_rt.ubsan_minimal.so", + "dep_whitelist": ["libsurface.z.so", "libipc_single.z.so", "libutils.z.so"] } ] \ No newline at end of file diff --git a/tools/deps_guard/rules/Passthrough/passthrough_indirect_info.json b/tools/deps_guard/rules/Passthrough/passthrough_indirect_info.json index d7aea2e..2558188 100755 --- a/tools/deps_guard/rules/Passthrough/passthrough_indirect_info.json +++ b/tools/deps_guard/rules/Passthrough/passthrough_indirect_info.json @@ -4,5 +4,105 @@ "so_file_name": "libhdi_input.z.so", "path": "//drivers/peripheral/input/hal:hdi_input", "headers": [] + }, + { + "name": "device_rk3568:libmpp", + "so_file_name": "librockchip_mpp.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/mpp:libmpp", + "headers": [] + }, + { + "name": "hdf:librockchip_vpu", + "so_file_name": "librockchip_vpu.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/mpp/mpp/legacy:librockchip_vpu", + "headers": [] + }, + { + "name": "hdf:libomxvpu_dec", + "so_file_name": "libomxvpu_dec.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/omx_il/component/video/dec:libomxvpu_dec", + "headers": [] + }, + { + "name": "hdf:libOMX_Core", + "so_file_name": "libOMX_Core.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/omx_il/core:libOMX_Core", + "headers": [] + }, + { + "name": "rockchip_products:librga", + "so_file_name": "librga.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/rga:librga", + "headers": [] + }, + { + "name": "hdf:libusb_adapter", + "so_file_name": "libusb_adapter.z.so", + "path": "//drivers/peripheral/usb/libusb_adapter:libusb_adapter", + "headers": [] + }, + { + "name": "hdf:libomxvpu_enc", + "so_file_name": "libomxvpu_enc.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/omx_il/component/video/enc:libomxvpu_enc", + "headers": [] + }, + { + "name": "hdf:libOMX_Pluginhw", + "so_file_name": "libOMX_Pluginhw.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/omx_il/libOMXPlugin:libOMX_Pluginhw", + "headers": [] + }, + { + "name": "hdf:libserial_interface_service_1.0", + "so_file_name": "libserial_interface_service_1.0.z.so", + "path": "//drivers/peripheral/usb/serial:libserial_interface_service_1.0", + "headers": [] + }, + { + "name": "hdf:libusb_host_interface_service_2.0", + "so_file_name": "libusb_host_interface_service_2.0.z.so", + "path": "//drivers/peripheral/usb/hdi_service:libusb_host_interface_service_2.0", + "headers": [] + }, + { + "name": "hdf:hdi_input", + "so_file_name": "libhdi_input.z.so", + "path": "//drivers/peripheral/input/hal:hdi_input", + "headers": [] + }, + { + "name": "hdf:libhuks_hdi_service_1.1", + "so_file_name": "libhuks_hdi_service_1.1.z.so", + "path": "//drivers/peripheral/huks/hdi_service:libhuks_hdi_service_1.1", + "headers": [] + }, + { + "name": "hdf:libRkOMX_Resourcemanager", + "so_file_name": "libRkOMX_Resourcemanager.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/omx_il/component/common:libRkOMX_Resourcemanager", + "headers": [] + }, + { + "so_file_name": "libhilog.so", + "dep_whitelist": ["librockchip_mpp.z.so", "librockchip_vpu.z.so", "libomxvpu_dec.z.so", "libOMX_Core.z.so", "libusb_adapter.z.so", + "libomxvpu_enc.z.so", "libOMX_Pluginhw.z.so", "libserial_interface_service_1.0.z.so", "libusb_host_interface_service_2.0.z.so", + "libhdi_input.z.so", "libhuks_hdi_service_1.1.z.so", "libRkOMX_Resourcemanager.z.so"] + }, + { + "so_file_name": "libdrm.so", + "dep_whitelist": ["librga.z.so"] + }, + { + "so_file_name": "libaccesstoken_sdk.z.so", + "dep_whitelist": ["libusb_adapter.z.so"] + }, + { + "so_file_name": "libclang_rt.ubsan_minimal.so", + "dep_whitelist": ["libusb_adapter.z.so", "libserial_interface_service_1.0.z.so", "libusb_host_interface_service_2.0.z.so"] + }, + { + "so_file_name": "libusb_shared.z.so", + "dep_whitelist": ["libusb_adapter.z.so"] } ] \ No newline at end of file diff --git a/tools/deps_guard/rules/Passthrough/passthrough_info.json b/tools/deps_guard/rules/Passthrough/passthrough_info.json index e6cd709..301d053 100755 --- a/tools/deps_guard/rules/Passthrough/passthrough_info.json +++ b/tools/deps_guard/rules/Passthrough/passthrough_info.json @@ -3,7 +3,8 @@ "name": "drivers_peripheral_bluetooth:audio_bluetooth_hdi_proxy_server", "so_file_name": "libaudio_bluetooth_hdi_proxy_server.z.so", "path": "//drivers/peripheral/bluetooth/audio/hal/hdi_binder/proxy:audio_bluetooth_hdi_proxy_server", - "headers": [] + "headers": [], + "dep_whitelist": ["libhilog.so"] }, { "name": "drivers_peripheral_bluetooth:audio_bluetooth_hdi_proxy_server", @@ -105,7 +106,8 @@ "name": "drivers_peripheral_display:libmapper_service_1.0", "so_file_name": "libmapper_service_1.0.z.so", "path": "//drivers/peripheral/display/buffer/hdi_service:libmapper_service_1.0", - "headers": [] + "headers": [], + "dep_whitelist": ["libhilog.so"] }, { "name": "drivers_peripheral_display:libmapper_service_1.2", @@ -117,6 +119,48 @@ "name": "drivers_peripheral_display:libmetadata_service_1.1", "so_file_name": "libmetadata_service_1.1.z.so", "path": "//drivers/peripheral/display/buffer/hdi_service:libmetadata_service_1.1", + "headers": [], + "dep_whitelist": ["libhilog.so"] + }, + { + "name": "hdf:libinput_interfaces_service_1.0", + "so_file_name": "libinput_interfaces_service_1.0.z.so", + "path": "//drivers/peripheral/input/hdi_service:libinput_interfaces_service_1.0", + "headers": [], + "dep_whitelist": ["libhilog.so"] + }, + { + "name": "hdf:libdisplay_buffer_vendor", + "so_file_name": "libdisplay_buffer_vendor.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/display:libdisplay_buffer_vendor", + "headers": [], + "dep_whitelist": ["libhilog.so", "libdrm.so"] + }, + { + "name": "hdf:libcodec_component_manager_service_4.0", + "so_file_name": "libcodec_component_manager_service_4.0.z.so", + "path": "//drivers/peripheral/codec/hal/idl_service:libcodec_component_manager_service_4.0", + "headers": [], + "dep_whitelist": ["libhilog.so", "libdisplay_buffer_proxy_1.0.z.so", "libdisplay_buffer_proxy_1.1.z.so"] + }, + { + "name": "hdf:libdisplay_buffer_vdi_impl", + "so_file_name": "libdisplay_buffer_vdi_impl.z.so", + "path": "//device/soc/rockchip/rk3568/hardware/display:libdisplay_buffer_vdi_impl", + "headers": [], + "dep_whitelist": ["libhilog.so"] + }, + { + "name": "drivers_peripheral_memorytracker:libmemory_tracker_interface_service_1.0", + "so_file_name": "libmemory_tracker_interface_service_1.0.z.so", + "path": "//drivers/peripheral/memorytracker/hdi_service:libmemory_tracker_interface_service_1.0", + "headers": [], + "dep_whitelist": ["libhilog.so"] + }, + { + "name": "drivers_peripheral_display:libmapper_service_1.3", + "so_file_name": "libmapper_service_1.3.z.so", + "path": "//drivers/peripheral/display/buffer/hdi_service:libmapper_service_1.3", "headers": [] } ] \ No newline at end of file diff --git a/tools/deps_guard/rules_checker/base_innerapi_rule.py b/tools/deps_guard/rules_checker/base_innerapi_rule.py index a23bd70..7058bc2 100644 --- a/tools/deps_guard/rules_checker/base_innerapi_rule.py +++ b/tools/deps_guard/rules_checker/base_innerapi_rule.py @@ -38,10 +38,31 @@ class BaseInnerapiRule(BaseRule): if mod["path"].startswith("system"): return "system" else: - return "vendor" + return "vendor" + + def get_white_lists(self): + whitelist_file = os.path.join(os.path.dirname(os.path.realpath(__file__)), f"../rules/{self.RULE_NAME}/base_info.json") + if os.path.exists(whitelist_file): + self.log("****system/vendor only whitelist.json is {}****".format(whitelist_file)) + res = [] + with open(whitelist_file, "r") as f: + contents = f.read() + if not contents: + self.log("****system/vendor only whitelist.json {} is null****".format(whitelist_file)) + return res + json_data = json.loads(contents) + for so in json_data: + so_file_name = so.get("so_file_name") + if so_file_name and so_file_name not in res: + res.append(so_file_name) + return res + else: + self.warn("****system/vendor only whitelist.json not exist: {}****".format(whitelist_file)) + def check(self): passed = True + white_lists = self.get_white_lists() for mod in self.get_mgr().get_all(): innerapi_tags = mod["innerapi_tags"] @@ -52,12 +73,13 @@ class BaseInnerapiRule(BaseRule): callee = dep["callee"] callee_innerapi_tags = callee["innerapi_tags"] if self.is_only(self.__ignored_tags, callee) == "system" or \ - all(item in self.__valid_system_tags for item in callee_innerapi_tags): + all(item in self.__valid_system_tags for item in callee_innerapi_tags) or \ + callee["name"] in white_lists: continue else: - self.warn("NEED MODIFY: system only module %s depends on wrong module as %s in %s, dep module path is %s" + self.error("NEED MODIFY: system only module %s depends on wrong module as %s in %s, dep module path is %s" %(mod["name"], callee["name"], mod["labelPath"], callee["path"])) - passed = True + passed = False # mod is vendor only scene elif self.is_only(self.__ignored_tags, mod) == "vendor" and \ all(item in self.__valid_vendor_tags for item in innerapi_tags): @@ -65,10 +87,11 @@ class BaseInnerapiRule(BaseRule): callee = dep["callee"] callee_innerapi_tags = callee["innerapi_tags"] if self.is_only(self.__ignored_tags, callee) == "vendor" or \ - all(item in self.__valid_vendor_tags for item in callee_innerapi_tags): + all(item in self.__valid_vendor_tags for item in callee_innerapi_tags) or \ + callee["name"] in white_lists: continue else: self.error("NEED MODIFY: system only module %s depends on wrong module as %s in %s, dep module path is %s" %(mod["name"], callee["name"], mod["labelPath"], callee["path"])) - passed = True + passed = False return passed \ No newline at end of file diff --git a/tools/deps_guard/rules_checker/base_rule.py b/tools/deps_guard/rules_checker/base_rule.py index e4ae0c6..0877cfd 100755 --- a/tools/deps_guard/rules_checker/base_rule.py +++ b/tools/deps_guard/rules_checker/base_rule.py @@ -70,7 +70,7 @@ class BaseRule(object): return True def check_if_deps_correctly(self, check_modules, valid_mod_tags, valid_dep_tags, white_lists): - # check if mod and callee have wrong innerapi tags + # check if mod and callee have wrong innerapi tags passed = True for mod in check_modules: innerapi_tags = mod["innerapi_tags"] @@ -87,14 +87,14 @@ class BaseRule(object): if callee["name"] in white_lists: continue - passed = True + passed = False wrong_tags = [item for item in dep_innerapi_tags if item not in valid_dep_tags] - self.warn("NEED MODIFY: %s's dep file %s with %s contains wrong dep innerapi_tags [%s] in innerapi_tags [%s]" - %(mod["name"], callee["name"], callee["labelPath"], ",".join(wrong_tags), ",".join(dep_innerapi_tags))) + self.error("NEED MODIFY: %s with innerapi_tags [%s] has dep file %s with %s contains wrong dep innerapi_tags [%s] in innerapi_tags [%s]" + % (mod["name"], ",".join(innerapi_tags), callee["name"], callee["labelPath"], ",".join(wrong_tags), ",".join(dep_innerapi_tags))) else: wrong_tags = [item for item in innerapi_tags if item not in valid_mod_tags] - self.warn("NEED MODIFY: module %s with %s contains wrong mod innerapi_tags [%s] in innerapi_tags [%s]" - %(mod["name"], mod["labelPath"], ",".join(wrong_tags), ",".join(innerapi_tags))) - return True + self.error("NEED MODIFY: module %s with %s contains wrong mod innerapi_tags [%s] in innerapi_tags [%s]" + % (mod["name"], mod["labelPath"], ",".join(wrong_tags), ",".join(innerapi_tags))) + return False return passed \ No newline at end of file diff --git a/tools/deps_guard/rules_checker/chipsetsdk.py b/tools/deps_guard/rules_checker/chipsetsdk.py index aac7edf..c0b1e7d 100755 --- a/tools/deps_guard/rules_checker/chipsetsdk.py +++ b/tools/deps_guard/rules_checker/chipsetsdk.py @@ -31,7 +31,7 @@ class ChipsetSDKRule(BaseRule): self.__white_lists = self.load_chipsetsdk_json("chipsetsdk_info.json") self.__ignored_tags = ["platformsdk", "sasdk", "platformsdk_indirect", "ndk"] self.__valid_mod_tags = ["llndk", "chipsetsdk", "chipsetsdk_indirect", "chipsetsdk_sp", - "chipsetsdk_sp_indirect"] + self.__ignored_tags + "chipsetsdk_sp_indirect", "passthrough"] + self.__ignored_tags def get_white_lists(self): return self.__white_lists @@ -85,7 +85,7 @@ class ChipsetSDKRule(BaseRule): return passed passed = self.check_if_deps_correctly( - self.__modules_with_chipsetsdk_tag, self.__valid_mod_tags, self.__valid_mod_tags, self.__indirects) + self.__modules_with_chipsetsdk_indirect_tag, self.__valid_mod_tags, self.__valid_mod_tags, self.__indirects) self.log(f"****check_if_deps_correctly indirect result:{passed}****") if not passed: return passed @@ -210,9 +210,9 @@ class ChipsetSDKRule(BaseRule): continue # Not allowed - passed = True - self.warn("NEED MODIFY: chipset module %s in %s depends on non Chipset SDK module %s in %s" - % (mod["name"], mod["labelPath"], callee["name"], mod["labelPath"])) + passed = False + self.error("NEED MODIFY: chipset module %s in %s depends on non Chipset SDK module %s in %s" + % (mod["name"], mod["labelPath"], callee["name"], callee["labelPath"])) return passed @@ -225,8 +225,8 @@ class ChipsetSDKRule(BaseRule): for mod in self.__modules_with_chipsetsdk_tag: if mod["name"] not in self.get_white_lists(): - passed = True - self.warn('NEED MODIFY: non chipsetsdk module %s with innerapi_tags="chipsetsdk", %s' + passed = False + self.error('NEED MODIFY: non chipsetsdk module %s with innerapi_tags="chipsetsdk", %s' % (mod["name"], mod["labelPath"])) for mod in self.__modules_with_chipsetsdk_indirect_tag: diff --git a/tools/deps_guard/rules_checker/chipsetsdk_sp.py b/tools/deps_guard/rules_checker/chipsetsdk_sp.py index aacff5c..fa3d7d0 100644 --- a/tools/deps_guard/rules_checker/chipsetsdk_sp.py +++ b/tools/deps_guard/rules_checker/chipsetsdk_sp.py @@ -30,7 +30,9 @@ class ChipsetsdkSPRule(BaseRule): self.__out_path = mgr.get_product_out_path() self.__white_lists = self.load_chipsetsdk_json("chipsetsdk_sp_info.json") self.__ignored_tags = ["platformsdk", "sasdk", "platformsdk_indirect", "ndk"] - self.__valid_mod_tags = ["llndk", "chipsetsdk_sp", "chipsetsdk_sp_indirect"] + self.__ignored_tags + self.__valid_mod_tags = ["llndk", "chipsetsdk_sp", "chipsetsdk_sp_indirect", "passthrough"] + self.__ignored_tags + self.__valid_vendor_tags = ["chipsetsdk", "chipsetsdk_sp", "llndk", "passthrough", + "passthrougth_indirect"] + self.__ignored_tags def get_white_lists(self): return self.__white_lists @@ -174,6 +176,9 @@ class ChipsetsdkSPRule(BaseRule): if mod["path"].startswith("system"): continue + if not mod["name"].endswith(".so"): + continue + # Check chipset modules depends for dep in mod["deps"]: callee = dep["callee"] @@ -191,6 +196,12 @@ class ChipsetsdkSPRule(BaseRule): if callee["name"] in lists: continue + dep_innerapi_tags = callee["innerapi_tags"] + if dep_innerapi_tags and all(item in self.__valid_vendor_tags for item in dep_innerapi_tags): + continue + elif not dep_innerapi_tags: + continue + # If callee is asan library, it is OK if callee["name"].endswith(".asan.so"): continue @@ -200,9 +211,9 @@ class ChipsetsdkSPRule(BaseRule): continue # Not allowed - passed = True - self.warn("NEED MODIFY: chipset_sp module %s in %s depends on non ChipsetSDKSP module %s in %s" - % (mod["name"], mod["labelPath"], callee["name"], mod["labelPath"])) + passed = False + self.error("NEED MODIFY: chipset_sp module %s in %s depends on non ChipsetSDKSP module %s in %s" + % (mod["name"], mod["labelPath"], callee["name"], callee["labelPath"])) return passed @@ -210,13 +221,13 @@ class ChipsetsdkSPRule(BaseRule): passed = True for mod in self.__chipsetsdk_sps: if not self.__is_chipsetsdk_sp_tagged(mod): - self.warn('ChipsetSDK module %s has no innerapi_tags with "chipsetsdk_sp", add it in %s' + self.warn('ChipsetSDKSP module %s has no innerapi_tags with "chipsetsdk_sp", add it in %s' % (mod["name"], mod["labelPath"])) for mod in self.__modules_with_chipsetsdk_sp_tag: if mod["name"] not in self.get_white_lists(): - passed = True - self.warn('NEED MODIFY: non chipsetsdk_sp module %s with innerapi_tags="chipsetsdk_sp", %s' + passed = False + self.error('NEED MODIFY: non chipsetsdk_sp module %s with innerapi_tags="chipsetsdk_sp", %s' % (mod["name"], mod["labelPath"])) for mod in self.__modules_with_chipsetsdk_sp_indirect_tag: @@ -227,4 +238,4 @@ class ChipsetsdkSPRule(BaseRule): return passed def __load_chipsetsdk_indirects(self): - self.__indirects = self.load_chipsetsdk_json("chipsetsdk_sp_indirect.json") + self.__indirects = self.load_chipsetsdk_json("chipsetsdk_sp_indirect_info.json") diff --git a/tools/deps_guard/rules_checker/llndk.py b/tools/deps_guard/rules_checker/llndk.py index acf15cd..357ba5b 100644 --- a/tools/deps_guard/rules_checker/llndk.py +++ b/tools/deps_guard/rules_checker/llndk.py @@ -30,7 +30,7 @@ class LLndkRule(BaseRule): self.__out_path = mgr.get_product_out_path() self.__white_lists = self.load_llndk_json("llndk_info.json") self.__ignored_tags = ["platformsdk", "sasdk", "platformsdk_indirect", "ndk"] - self.__valid_mod_tags = ["llndk"] + self.__ignored_tags + self.__valid_mod_tags = ["llndk", "passthrough"] + self.__ignored_tags def get_white_lists(self): return self.__white_lists diff --git a/tools/deps_guard/rules_checker/passthrough.py b/tools/deps_guard/rules_checker/passthrough.py index 3d9115c..4e86ee4 100644 --- a/tools/deps_guard/rules_checker/passthrough.py +++ b/tools/deps_guard/rules_checker/passthrough.py @@ -42,15 +42,15 @@ class PassthroughRule(BaseRule): rules_dir = [] rules_dir.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), "../rules")) if self._args and self._args.rules: - self.log("****add more ChipsetSDK info in:{}****".format(self._args.rules)) + self.log("****add more passthrough info in:{}****".format(self._args.rules)) rules_dir = rules_dir + self._args.rules chipsetsdk_rules_path = self.get_out_path().replace("out", "out/products_ext") if os.path.exists(chipsetsdk_rules_path): - self.log("****add more ChipsetSDK info in dir:{}****".format(chipsetsdk_rules_path)) + self.log("****add more passthrough info in dir:{}****".format(chipsetsdk_rules_path)) rules_dir.append(chipsetsdk_rules_path) else: - self.warn("****add chipsetsdk_rules_path path not exist: {}****".format(chipsetsdk_rules_path)) + self.warn("****add passthrough_rules_path path not exist: {}****".format(chipsetsdk_rules_path)) res = [] for d in rules_dir: rules_file = os.path.join(d, self.__class__.RULE_NAME, name) @@ -84,7 +84,7 @@ class PassthroughRule(BaseRule): return passed passed = self.check_if_deps_correctly( - self.__modules_with_passthrough_tag, self.__valid_mod_tags, self.__valid_mod_tags, self.__indirects) + self.__modules_with_passthrough_indirect_tag, self.__valid_mod_tags, self.__valid_mod_tags, self.__indirects) self.log(f"****check_if_deps_correctly indirect result:{passed}****") if not passed: return passed @@ -205,9 +205,9 @@ class PassthroughRule(BaseRule): continue # Not allowed - passed = True + passed = False self.error("NEED MODIFY: passthrough module %s in %s depends on non passthrough module %s in %s" - % (mod["name"], mod["labelPath"], callee["name"], mod["labelPath"])) + % (mod["name"], mod["labelPath"], callee["name"], callee["labelPath"])) return passed @@ -220,7 +220,7 @@ class PassthroughRule(BaseRule): for mod in self.__modules_with_passthrough_tag: if mod["name"] not in self.get_white_lists(): - passed = True + passed = False self.error('NEED MODIFY: non passthrough %s with innerapi_tags="passthrough", %s' % (mod["name"], mod["labelPath"])) @@ -232,4 +232,4 @@ class PassthroughRule(BaseRule): return passed def __load_passthrough_indirects(self): - self.__indirects = self.load_passthrough_json("passthrough_indirect.json") + self.__indirects = self.load_passthrough_json("passthrough_indirect_info.json") -- Gitee From de4fed3f851d44cbfe40788e9bc8db7bddacedd7 Mon Sep 17 00:00:00 2001 From: liangxinyan123 Date: Wed, 27 Aug 2025 04:12:02 +0000 Subject: [PATCH 2/2] update tools/deps_guard/rules/BaseInnerApi/base_info.json. Signed-off-by: liangxinyan123 --- .../rules/BaseInnerApi/base_info.json | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tools/deps_guard/rules/BaseInnerApi/base_info.json b/tools/deps_guard/rules/BaseInnerApi/base_info.json index d445801..f121d38 100644 --- a/tools/deps_guard/rules/BaseInnerApi/base_info.json +++ b/tools/deps_guard/rules/BaseInnerApi/base_info.json @@ -1,14 +1,14 @@ -{ - "system_only": [ - { - "name": "build_framework:musl-libc.so", - "so_file_name": "libc.so" - } - ], - "vendor_only": [ - { - "name": "build_framework:musl-libc.so", - "so_file_name": "libc.so" - } - ] -} \ No newline at end of file +[ + { + "so_file_name": "libaudio_bluetooth_hdi_proxy_server.z.so", + "dep_whitelist": ["libhdiadapter_new.z.so"] + }, + { + "so_file_name": "libdisplay_buffer_proxy_1.0.z.so", + "dep_whitelist": ["libcodec_component_manager_service_4.0.z.so"] + }, + { + "so_file_name": "libdisplay_buffer_proxy_1.1.z.so", + "dep_whitelist": ["libcodec_component_manager_service_4.0.z.so"] + } +] \ No newline at end of file -- Gitee