Get package information for a given library path. Args: lib_path (str): The path to the library. Returns: tuple: A tuple containing the package name and full package information.
(lib_path)
| 65 | return None |
| 66 | |
| 67 | def get_package_info(lib_path): |
| 68 | """ |
| 69 | Get package information for a given library path. |
| 70 | |
| 71 | Args: |
| 72 | lib_path (str): The path to the library. |
| 73 | |
| 74 | Returns: |
| 75 | tuple: A tuple containing the package name and full package information. |
| 76 | """ |
| 77 | if lib_path.startswith('/usr/local/cloudberry-db'): |
| 78 | return "cloudberry-custom", f"Cloudberry custom library: {lib_path}" |
| 79 | |
| 80 | dpkg_output = run_command(['dpkg', '-S', lib_path]) |
| 81 | if dpkg_output: |
| 82 | package_name = dpkg_output.split(':')[0] |
| 83 | return package_name, dpkg_output.strip() |
| 84 | |
| 85 | # List of core system libraries that might not be individually tracked by dpkg |
| 86 | core_libs = { |
| 87 | 'libc.so': 'libc6', |
| 88 | 'libm.so': 'libc6', |
| 89 | 'libdl.so': 'libc6', |
| 90 | 'libpthread.so': 'libc6', |
| 91 | 'libresolv.so': 'libc6', |
| 92 | 'librt.so': 'libc6', |
| 93 | 'libgcc_s.so': 'libgcc-s1', |
| 94 | 'libstdc++.so': 'libstdc++6', |
| 95 | 'libz.so': 'zlib1g', |
| 96 | 'libbz2.so': 'libbz2-1.0', |
| 97 | 'libpam.so': 'libpam0g', |
| 98 | 'libaudit.so': 'libaudit1', |
| 99 | 'libcap-ng.so': 'libcap-ng0', |
| 100 | 'libkeyutils.so': 'libkeyutils1', |
| 101 | 'liblzma.so': 'liblzma5', |
| 102 | 'libcom_err.so': 'libcomerr2' |
| 103 | } |
| 104 | |
| 105 | lib_name = os.path.basename(lib_path) |
| 106 | for core_lib, package in core_libs.items(): |
| 107 | if lib_name.startswith(core_lib): |
| 108 | return package, f"Core system library: {lib_path}" |
| 109 | |
| 110 | # If not a recognized core library, return as system library |
| 111 | file_output = run_command(['file', lib_path]) |
| 112 | if file_output: |
| 113 | return "system-library", f"System library: {lib_path} - {file_output.strip()}" |
| 114 | |
| 115 | return None |
| 116 | |
| 117 | def print_summary(packages, special_cases, missing_libraries, binary_path): |
| 118 | """ |
no test coverage detected