Analyze a file or directory for ELF binaries and their dependencies. Args: path (str): Path to the file or directory to analyze. grand_summary (dict): Dictionary to store all package information. grand_special_cases (list): List to store all special cases. grand_missing_lib
(path, grand_summary, grand_special_cases, grand_missing_libraries)
| 251 | print("No special cases found.") |
| 252 | |
| 253 | def analyze_path(path, grand_summary, grand_special_cases, grand_missing_libraries): |
| 254 | """ |
| 255 | Analyze a file or directory for ELF binaries and their dependencies. |
| 256 | |
| 257 | Args: |
| 258 | path (str): Path to the file or directory to analyze. |
| 259 | grand_summary (dict): Dictionary to store all package information. |
| 260 | grand_special_cases (list): List to store all special cases. |
| 261 | grand_missing_libraries (dict): Dictionary to store all missing libraries. |
| 262 | """ |
| 263 | if os.path.isfile(path): |
| 264 | if is_elf_binary(path): |
| 265 | packages, special_cases, missing_libraries = process_binary(path) |
| 266 | for package_name, full_package_name in packages: |
| 267 | grand_summary[package_name].add(full_package_name) |
| 268 | grand_special_cases.extend((case, path) for case in special_cases) |
| 269 | for lib in missing_libraries: |
| 270 | grand_missing_libraries[lib].add(path) |
| 271 | elif os.path.isdir(path): |
| 272 | for root, dirs, files in os.walk(path): |
| 273 | for file in files: |
| 274 | file_path = os.path.join(root, file) |
| 275 | if is_elf_binary(file_path): |
| 276 | packages, special_cases, missing_libraries = process_binary(file_path) |
| 277 | for package_name, full_package_name in packages: |
| 278 | grand_summary[package_name].add(full_package_name) |
| 279 | grand_special_cases.extend((case, file_path) for case in special_cases) |
| 280 | for lib in missing_libraries: |
| 281 | grand_missing_libraries[lib].add(file_path) |
| 282 | else: |
| 283 | print(f"Error: {path} is neither a valid file nor a directory.") |
| 284 | |
| 285 | def main(): |
| 286 | """ |
no test coverage detected