Method and server for determining redundant dependence of software package
Automatically obtain the running data of the software package through detectors and system monitoring tools, and combine it with the dependency analysis server to identify and report redundant dependencies, solving the problems of low efficiency and low accuracy in the existing technology, and realizing efficient and accurate software Package redundant dependency management.
Patent Information
- Application Number
- CN202410694197.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-30
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2044-05-30
AI Technical Summary
The existing technology is inefficient and inaccurate when determining redundant dependencies of software packages. Especially in large projects or complex dependency networks, manual inspection of source code and dependency management files is required, which is easily affected by personal subjective judgments.
By introducing detectors and system monitoring tools, such as eBPF and kprobe, the actual access file data and system call data of software packages are automatically obtained from multiple running environments, combined with the dependency analysis server, to accurately identify redundant dependencies and generate reports.
It improves the accuracy and efficiency of redundant dependencies, avoids errors in manual judgment, reduces the time and workload of dependency analysis, and enhances the reliability and accuracy of software package management.
Smart Images

Figure CN118689485A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of servers, and in particular to a method and a server for determining redundant dependencies of software packages. Background Art
[0002] The current mainstream Linux operating system mainly uses two formats: Red Hat Package Manager (RPM) and Debian (DEB). Due to the open source nature of the system, many people in the Linux community participate in the development and maintenance of software, which leads to the continuous increase in the size and number of software packages, and then generates a large number of redundant dependencies, affecting the operation of applications. Therefore, it is necessary to manage the dependencies of software packages and remove redundant dependencies in a timely and accurate manner.
[0003] The existing dependency management method is to manually specify or analyze the source code of the software package to determine the dependencies of the software package, and add them to the description file of the software package (such as .spec format file) for management. The existing method of determining redundant dependencies is usually for developers to manually check the source code and dependency management file (description file) of the software package to see if there are obvious redundant dependencies, and then remove them, thereby achieving the purpose of eliminating redundant dependencies of the software package. However, due to the different sizes of software packages, it takes a long time to manually eliminate redundant dependencies for large projects or complex dependency networks, and it is easily affected by personal subjective judgment, resulting in low efficiency and low accuracy in determining redundant dependencies.
[0004] Therefore, how to improve the efficiency of determining redundant dependencies while ensuring accuracy is a problem that technical personnel in this field urgently need to solve. Summary of the invention
[0005] Based on the above problems, the embodiments of the present application provide a method and a server for determining redundant dependencies of a software package, which can accurately identify the runtime dependencies that are truly needed without manual intervention, thereby improving the efficiency of determining redundant dependencies.
[0006] In the first aspect, the embodiment of the present application provides a method for determining redundant dependencies of a software package, including: determining a target software package; the target software package is a software package for which redundant dependencies are to be determined; based on a detector, obtaining file data actually accessed when the target software package is running from one or more operating environments; the file data includes a file path and a file name; the operating environment is an operating system and a hardware environment that satisfies the normal operation of the target software package; and determining the redundant dependencies of the target software package based on the file data actually accessed. In this way, the embodiment of the present application directly obtains the files accessed by the target software package in each operating environment during the entire operation process based on the detector, and then identifies the runtime dependencies that are truly needed, avoiding the phenomenon of incorrect redundant dependency judgment caused by the software implementation development language, and improving the accuracy of determining redundant dependencies.
[0007] In a possible implementation, based on the detector, before obtaining the file data actually accessed by the target software package during operation from one or more operating environments, the method further includes: sending a detection configuration to the detector; the detection configuration is used to indicate that the target software package is used as a detection object of the detector. In this way, the embodiment of the present application introduces the detection configuration, and based on the detection configuration, it is ensured that the target software package determined by the detector and the dependency analysis server is the same, thereby improving the accuracy of determining redundant dependencies.
[0008] In a possible implementation, obtaining the file data actually accessed during the operation of the target software package from one or more operating environments includes: triggering the detector to obtain the system call data of the target software package when it is running in one or more operating environments based on the detection configuration; obtaining the system call data from the detector; and generating the file data actually accessed by the target software package based on the system call data. In this way, the embodiment of the present application introduces multiple operating environments to avoid errors in individual environments, thereby more accurately identifying software dependencies and thus improving the accuracy of determining redundant dependencies.
[0009] In a possible implementation, the triggering detector obtains the system call data of the target software package when it is running under one or more operating environments based on the detection configuration, including: obtaining the system call of the target software package when it is running based on the system monitoring tool, and obtaining the corresponding system call data. In this way, the embodiment of the present application introduces the system monitoring tool provided by the Linux system to monitor the system call, without introducing new tools from the outside, thereby saving detection time, avoiding the uncertainty factors of external software, and thus improving the efficiency and accuracy of determining redundant dependencies.
[0010] In a possible implementation, the system monitoring tool includes: an efficient virtual machine (extended Berkeley Packet Filter, eBPF) monitoring tool and / or a tracing mechanism (kprobe) monitoring tool. In this way, the embodiment of the present application introduces system-provided tools such as the eBPF monitoring tool and the tracing mechanism monitoring tool, without the need to introduce new tools from the outside, thereby improving the efficiency and accuracy of determining redundant dependencies.
[0011] In a possible implementation, the system call includes: an open system call and an execve system call. Thus, the embodiment of the present application introduces the open system call and the execve system call, and determines the file data actually accessed by the target software package through the system call, thereby eliminating the need to rely on the actual development language of the software, thereby improving the applicability and accuracy of determining redundant dependencies.
[0012] In a possible implementation, the redundant dependencies of the target software package are determined based on the file data actually accessed, including: summarizing the file data actually accessed obtained from each operating environment; comparing the file data actually accessed with the description file corresponding to the target software package to determine the redundant dependencies of the target software package; the description file is used to record all the dependencies of the target software package. In this way, the embodiment of the present application summarizes and analyzes the results of multi-environment detection to avoid errors in individual environments, thereby more accurately identifying software dependencies and improving the accuracy of determining redundant dependencies.
[0013] In a possible implementation, the method further includes: generating a redundant dependency report based on the file data actually accessed; the redundant dependency report is used to record all redundant dependencies of the target software package. In this way, the embodiment of the present application introduces a redundant dependency report, which stores or presents the redundant dependencies of the target software package to the user in the form of a report, thereby improving the readability of the data.
[0014] In one possible implementation, the file data actually accessed by the target software package when it is running is obtained from one or more operating environments, including: triggering the detector to obtain the system call data of the target software package when it is running in one or more operating environments based on the detection configuration, and generating the file data actually accessed by the target software package through parsing; directly obtaining the file data from the detector. The embodiment of the present application introduces multiple operating environments to avoid errors in individual environments, thereby more accurately identifying software dependencies and thus improving the accuracy of determining redundant dependencies. In a second aspect, the embodiment of the present application provides a device for determining redundant dependencies of software packages, including:
[0015] A determination module is used to determine a target software package; the target software package is a software package whose redundant dependency is to be determined;
[0016] An acquisition module is used to acquire file data actually accessed by the target software package when it is running from one or more operating environments based on a detector; the file data includes a file path and a file name; and the operating environment is an operating system and a hardware environment that satisfies the normal operation of the target software package;
[0017] A determination module is used to determine redundant dependencies of a target software package based on actually accessed file data.
[0018] In a third aspect, an embodiment of the present application provides a server, characterized in that it includes:
[0019] Memory and processor coupling;
[0020] Memory for storing computer programs;
[0021] The processor is used to implement the steps of the method for determining redundant dependencies of software packages as described above when executing a computer program.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program / instruction stored thereon. When the computer program / instruction is executed on a computer, the server executes the steps of the above-mentioned method for determining redundant dependencies of software packages.
[0023] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program; when the computer program runs on a server, the steps of the above-mentioned method for determining redundant dependencies of software packages are executed. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 A flowchart of a method for determining redundant dependencies of a software package provided in an embodiment of the present application;
[0025] Figure 2 A redundant dependency analysis architecture diagram provided for an embodiment of the present application;
[0026] Figure 3 A schematic diagram of a detector logic unit provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of a detector execution process provided in an embodiment of the present application;
[0028] Figure 5 A schematic diagram of a dependency analysis server analyzing redundant dependencies provided in an embodiment of the present application;
[0029] Figure 6 A schematic diagram of an execution process of a dependency analysis server provided in an embodiment of the present application;
[0030] Figure 7A schematic diagram of the structure of a device for determining redundant dependencies of a software package provided in an embodiment of the present application;
[0031] Figure 8 A schematic diagram of a server structure provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] In order to make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0033] In the description of the embodiments of the present application, words such as "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a concrete way.
[0034] In the description of the embodiments of the present application, the term "and / or" is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent: A exists alone, B exists alone, and A and B exist at the same time. In addition, unless otherwise specified, the term "multiple" means two or more. For example, multiple systems refers to two or more systems, and multiple terminals refers to two or more terminals.
[0035] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. The terms "include", "comprises", "has" and their variations all mean "including but not limited to", unless otherwise specifically emphasized.
[0036] Hereinafter, some terms used in this embodiment are explained. It should be noted that these explanations are for the convenience of understanding by those skilled in the art and do not constitute a limitation on the scope of protection claimed by the present invention.
[0037] eBPF is a technology in the Linux kernel that allows developers to execute custom code in the kernel to implement applications such as efficient network traffic analysis, performance monitoring, and security auditing. The goal of eBPF is to provide a lightweight, low-overhead way to extend the functionality of the Linux kernel so that more applications can take advantage of the foundation of the Linux ecosystem.
[0038] Kprobe is a programmable tracing tool provided by the Linux operating system kernel for dynamic tracing, debugging, and performance analysis during kernel function execution. It allows developers to insert trace points (probes) anywhere in the kernel code so that custom code can be executed at those locations. These trace points can be used to collect performance data, record time, modify system behavior, etc.
[0039] RPM was originally developed by Red Hat and is now used by many Linux distributions. It uses .rpm files as the extension of the software package.
[0040] DEB is a package management system used by Debian distribution and its derivatives (such as Ubuntu). It uses .deb file as the extension of the software package.
[0041] As mentioned above, the existing methods for determining redundant dependencies of software packages have the problems of low efficiency and insufficient accuracy. Specifically, due to the open source nature of the system, more people are involved in the development and maintenance of software, which has led to the continuous increase in the scale and number of software packages, resulting in a large number of redundant dependencies. The existing methods for removing redundant dependencies are, first, relying on developers to manually check the source code of the software package and the dependency management file to check whether there are duplicate dependencies, whether there are multiple dependencies that provide the same function, and whether there are old versions of dependencies that are no longer used. It is conceivable that this method has a huge workload and there are human differences, resulting in inaccurate determination of redundant dependencies and low efficiency. Another method is to rely on static code analysis tools to determine redundant dependencies, but the tool often cannot understand the context of the code, and there are differences in the degree of support for programming languages and detection rules, which also leads to inaccurate determination of redundant dependencies.
[0042] To solve the above problems, an embodiment of the present application provides a method for determining redundant dependencies of a software package, including: first determining a target software package. The target software package is a software package for which redundant dependencies are to be determined. Then, based on a detector, obtaining file data actually accessed when the target software package is running from one or more operating environments. The file data includes a file path and a file name, and the operating environment is an operating system and a hardware environment that satisfies the normal operation of the target software package. Finally, the redundant dependencies of the target software package are determined based on the file data actually accessed.
[0043] In this way, the files accessed by the target software package in each operating environment during the entire running process are directly obtained based on the detector, and then the runtime dependencies that are really needed are identified, avoiding the phenomenon of incorrect redundant dependency judgment caused by the software implementation development language, and improving the accuracy of determining redundant dependencies.
[0044] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0045] Figure 1 A flowchart of a method for determining redundant dependencies of a software package provided in an embodiment of the present application. Figure 1 As shown, a method for determining redundant dependencies of a software package provided by an embodiment of the present application may include:
[0046] S101: Determine a target software package; the target software package is a software package whose redundant dependency is to be determined.
[0047] In practical applications, modern software is usually composed of multiple modules or components that need to work together to achieve specific functions or basic functions. For some software, it needs to rely on other software packages or libraries to compile and link programs to generate executable files or libraries when building, so these dependencies are usually called build-time dependencies. In addition, for some software, it is also necessary to rely on specific hardware resources or system services, such as databases, graphical interface libraries, audio players, etc. These resources or services can be implemented through dependencies, without having to be directly implemented in the program. This type of dependency is usually called runtime dependency or installation-time dependency. If there is redundancy between build-time dependency and runtime dependency, the scope and severity of its impact are very different. There is redundancy in build-time dependency, just installing a few more software packages on the build environment will not bring much impact. And runtime dependency has a relatively large impact on the performance and reliability of the software package. Therefore, the embodiment of the present application mainly confirms the redundant dependency of runtime dependency, and proposes an automated software dependency analysis method that is independent of the software implementation development language, and uses a dependency analysis server in combination with a detector to summarize and analyze the files actually accessed by the software package during installation and operation, and then determine the redundant dependency of the software package. Specifically, the dependency analysis server is first required to determine the target software package, that is, the software package that needs to be screened for redundant dependencies (redundant dependencies to be determined). For example, in the operating environment of a certain computer, there are software packages A, B, and C. The dependency analysis server is associated with the computer, and the above three software packages will be displayed in the software list of the dependency analysis server. The user selects one of them by using the mouse pointer or sending instructions, and the dependency analysis server will use the selected software package as the target software package. If software package A is selected, the dependency analysis server will use software package A as the target software package and determine redundant dependencies for software package A. In this way, the flexibility and accuracy of software package redundant dependency analysis are improved.
[0048] In addition, since the content of information transmitted to the detector is not exactly the same, the embodiment of the present application can illustrate one possible transmission content.
[0049] In one embodiment, before obtaining the file data actually accessed by the target software package during operation from one or more operating environments based on the detector, the method further includes:
[0050] Send detection configuration to the detector;
[0051] The detection configuration is used to indicate that the target software package is used as the detection object of the probe.
[0052] In actual applications, the dependency analysis server needs to be used in conjunction with the detector. Among them, the detector is arranged in the actual production environment to detect the entire operation process of the target software package according to the requirements issued by the dependency analysis server, so it is first necessary to determine the same target software package as the dependency analysis server. Specifically, after determining the target software package, the dependency analysis server can send a detection configuration including indication information of the target software package to the detector, and then the detector parses the detection configuration to determine the target software package consistent with that determined by the dependency analysis server, that is, the detection configuration is used to indicate that the target software package is used as the detection object of the detector. It should be noted that the detection configuration can also include the content that needs to be detected and the system monitoring tools that need to be used. In this way, it is ensured that the target software package determined by the dependency analysis server is consistent with the detector, which improves the detection accuracy of the detector and thus improves the accuracy of the redundant dependency analysis of the software package.
[0053] S102: Based on the detector, obtain file data actually accessed during operation of the target software package from one or more operating environments; the file data includes a file path and a file name; the operating environment is an operating system and hardware environment that satisfies the normal operation of the target software package.
[0054] In practical applications, Figure 2 A redundant dependency analysis architecture diagram provided in an embodiment of the present application. Figure 2As shown, the detector is arranged in the actual production environment, and in order to avoid the judgment error in individual environments and improve the accuracy of determining redundant dependencies, the embodiment of the present application can deploy the detector in multiple environments (environment A, environment B and environment C), and the dependency analysis server sends the detection configuration to each detector after determining the target software package, so that each detector determines the target software package based on the detection configuration, and detects the target software package, and obtains the file data actually accessed by the target software package during the entire operation process in environment A, environment B and environment C respectively. Among them, the operating environment is an operating system and hardware environment that satisfies the normal operation of the target software package. The detector takes the file data actually accessed by the target software package during the entire operation process in environment A, environment B and environment C as detection data and reports it to the dependency analysis server for analysis, that is, the dependency analysis server can obtain the file data actually accessed by the target software package in environment A, environment B and environment C during the entire operation process from the detector. It can be understood that in order to parse the actual dependency of the target software package from the file data, the file data should include the file path and file name, etc. In addition, it should be noted that environment A, environment B, and environment C are only examples of multiple environments. In fact, there may also be environment D, environment E, environment F, etc., which are not limited here. In this way, by deploying detectors in multiple environments and analyzing based on the detection results of multiple environments, errors in individual environments can be avoided, thereby more accurately identifying software dependencies and improving the accuracy of determining redundant dependencies.
[0055] In addition, since the methods for the detector to generate the file data actually accessed by the target software package are not the same, the embodiment of the present application can illustrate a possible generation method.
[0056] In one case, S102: based on the detector, obtaining the file data actually accessed when the target software package is running from one or more running environments may specifically include:
[0057] The triggering detector obtains the system call data of the target software package when it is running in one or more running environments based on the detection configuration;
[0058] Get system call data from the probe;
[0059] Generate file data actually accessed by the target software package based on the system call data.
[0060] In actual application, the dependency analysis server sends the detection configuration to the detector and triggers the detection process of the detector for the target software package. The system call is an interface provided by the operating system to the application program for accessing the services and resources provided by the operating system. The application program can send a request to the operating system through the system call to perform privileged operations, access hardware devices, manage processes and files, etc. Therefore, system calls may be involved in the installation and operation of the software package, and the system call can directly map the dependency of the software package with other software and libraries during the installation and operation. Therefore, the embodiment of the present application obtains the system call data of the target software package during the installation and operation process, and then determines the redundant dependency of the target software package. Specifically, continue to take the above-mentioned deployment of the detector in environment A, environment B and environment C as an example, when the detection process of the detector is triggered, the target software package is installed and run in environment A, environment B and environment C respectively, and the detectors deployed corresponding to each environment respectively detect and obtain the system call data involved in the entire operation process of the target software package in each environment, and send it to the dependency analysis server. The dependency analysis server obtains the system call data from the detector, and then obtains the path and file name of the file accessed by the application program by parsing the system call data, that is, generates the file data actually accessed by the target software package during the entire operation process. In this way, by deploying detectors in multiple environments and performing analysis based on the detection results of multiple environments, errors in individual environments can be avoided, thereby more accurately identifying software dependencies and improving the accuracy of determining redundant dependencies.
[0061] In addition, since the subjects of parsing system call data are not the same, the embodiments of the present application can illustrate a possible parsing subject.
[0062] In one case, the file data actually accessed by the target software package when it is running is obtained from one or more running environments, including:
[0063] The triggering detector obtains the system call data of the target software package when it is running under one or more running environments based on the detection configuration, and generates the file data actually accessed by the target software package through parsing;
[0064] Get file data directly from the detector.
[0065] In practical applications, combined with the above, it can be known that system calls may be involved in the installation and operation of the software package, and the system call can directly map the dependency of the software package with other software and libraries during the installation and operation. Therefore, the embodiment of the present application obtains the system call data of the target software package during the installation and operation, and then determines the redundant dependency of the target software package. Further, in order to reduce the parsing burden of the dependency analysis server, the embodiment of the present application can be parsed by the detector. Specifically, continue to take the above-mentioned deployment of the detector in environment A, environment B and environment C as an example, when the detection process of the detector is triggered, the target software package is installed and run on environment A, environment B and environment C respectively, and the detectors deployed corresponding to each environment respectively detect and obtain the system call data involved in the entire operation process of the target software package in each environment, and parse the parameters of the system call data to obtain the path and file name of the file accessed by the application, that is, generate the file data actually accessed by the target software package during the entire operation process, and report it to the dependency analysis server. Finally, the dependency analysis server obtains the file data actually accessed by the target software package reported by the server when it runs in each environment from each detector. In this way, by deploying detectors in multiple environments and performing analysis based on the detection results of multiple environments, errors in individual environments can be avoided, thereby more accurately identifying software dependencies and improving the accuracy of determining redundant dependencies. Because file parsing is performed in the detector, the dependency analysis server directly obtains file data for analysis, which reduces the parsing burden of the dependency analysis server and improves the efficiency of determining redundant dependencies.
[0066] In addition, since the detector obtains system call data in different ways, the embodiment of the present application can illustrate one possible way of obtaining it.
[0067] In one case, the triggering probe obtains system call data of the target software package at runtime in one or more runtime environments based on the probe configuration, including:
[0068] Based on the system monitoring tool, the system calls of the target software package are obtained when it is running, and the corresponding system call data is obtained.
[0069] In actual applications, the detector can obtain the system call data of the target software package during the entire operation process based on the system monitoring tool that comes with the operating system. Specifically, the dependency analysis server can specify the system monitoring tool that the detector can call in the detection configuration sent to the detector. After the detector is triggered, the detection configuration is parsed, the system monitoring tool is determined, and the system monitoring tool is used to detect the system calls of the target software package during the entire operation process, and the corresponding system call data is obtained. In this way, the system calls of the target software package are monitored based on the monitoring tool that comes with the system, without the need to introduce new tools from the outside, thereby saving detection time, avoiding the uncertainty factors of external software, and thus improving the efficiency and accuracy of determining redundant dependencies.
[0070] In addition, since the system monitoring tools used are not the same, the embodiment of the present application can illustrate a possible tool to be used.
[0071] In one embodiment, the system monitoring tool includes: an eBPF monitoring tool and / or a kprobe monitoring tool.
[0072] In practical applications, as above, the dependency analysis server can specify the system monitoring tools that the detector can call in the detection configuration sent to the detector. Among them, eBPF allows developers to execute custom code in the kernel to achieve efficient network traffic analysis, performance monitoring and security auditing and other applications. Kprobe is a programmable tracking tool provided by the Linux operating system kernel, which is used for dynamic tracking, debugging and performance analysis when kernel functions are executed. Therefore, in an embodiment of the present application, the detector can monitor the system calls of the target software package during operation based on the monitoring function of the eBPF monitoring tool and / or kprobe monitoring tool that comes with the Linux operating system. It is understandable that the detector can also monitor the system calls of the target software package based on other system monitoring tools and obtain the corresponding system call data, such as top, strace and lsof. In this way, the system calls of the target software package are monitored based on the monitoring tools that come with the system, without the need to introduce new tools from the outside, thereby saving detection time, avoiding the uncertainty factors of external software, and thus improving the efficiency and accuracy of determining redundant dependencies.
[0073] Figure 3 A schematic diagram of a detector logic unit provided in an embodiment of the present application. Figure 3As shown, the software package is installed and run in user mode, and the detector detects the file data actually accessed by the software during the entire running process. Specifically, since the files accessed in the software process are mapped in the system call in the kernel state, the detector can monitor the target software package system call based on the eBPF monitoring tool and / or kprobe monitoring tool in the kernel state. The detector then parses the parameters of these system calls to obtain the path and file name of the file being accessed by the application. There is no need to introduce new tools from the outside, thereby saving detection time, avoiding the uncertainty factors of external software, and improving the efficiency and accuracy of determining redundant dependencies.
[0074] In addition, since the monitored system calls are not the same, the embodiments of the present application can illustrate a possible monitoring target.
[0075] In one case, the system calls include: an open system call and an execve system call.
[0076] In practical applications, in combination with the above, the eBPF monitoring tool and / or the kprobe monitoring tool can monitor system calls such as open() and execve(). Among them, the open() system call is used to open a file, and the execve() system call is used to execute an application in a new process context. In this way, by monitoring the open system call and the execve system call, the obtained system call data can map the file paths and file names accessed by the target software package during the entire running process, and then determine the redundant dependencies of the target software package, thereby improving the accuracy of the redundant dependency determination.
[0077] In summary, Figure 4 A schematic diagram of a detector execution process provided in an embodiment of the present application. Figure 4 As shown, at the beginning of the process, the detector first receives the detection configuration sent by the dependency analysis server, and determines the target software package and the monitoring tools needed by parsing the detection configuration. Then, the system call of the software process to access the file is detected through the eBPF monitoring tool and / or the kprobe monitoring tool, and the corresponding detection data (the file data actually accessed by the target software package during the entire operation process) is generated. Finally, the detection data is reported to the dependency analysis server, thereby realizing the entire detection process for the target software package. In this way, through the cooperation between the detector and the dependency analysis server, the efficiency and accuracy of determining redundant dependencies are improved.
[0078] S103: Determine redundant dependencies of the target software package based on the file data actually accessed.
[0079] In actual applications, the file data actually accessed by the target software package obtained by the dependency analysis server from the detector is the actual dependency of the target software package. As mentioned above, the existing dependency management method is to determine the dependency relationship of the software package by manually specifying or analyzing the source code of the software package, and add it to the description file of the software package (such as a .spec format file) for management. It can be understood that the description file records all the dependencies of the target software package, and the dependency analysis server can determine the redundant dependencies of the target software package based on the file data actually accessed. For example, there is a software package A, and the description file of software package A records that software package A depends on software package B, software package C and software package D. Software package A runs in an actual production environment, and is detected by the detector, and it is determined that software package A accesses the x file of software package B and the y file of software package D during actual operation. The above data is organized into detection data and reported to the dependency analysis server. It can be imagined that the dependency analysis server can know through analysis that software package A actually depends on software package B and software package D, and the dependency relationship of software package A relying on software package C recorded in the description file is a redundant dependency. In this way, the redundant dependencies of the target software package are determined by the file data actually accessed, which improves the efficiency and accuracy of determining redundant dependencies.
[0080] In addition, since the methods for determining the redundant dependencies of the target software package are not the same, the embodiment of the present application can illustrate a possible determination method.
[0081] In one case, S103: determining the redundant dependencies of the target software package based on the file data actually accessed, specifically includes:
[0082] Aggregate the file data actually accessed from each operating environment;
[0083] Compare the file data actually accessed with the description file corresponding to the target software package to determine the redundant dependencies of the target software package;
[0084] The description file is used to record all dependencies of the target software package.
[0085] In practical applications, Figure 5 A schematic diagram of a dependency analysis server analyzing redundant dependencies provided in an embodiment of the present application. Figure 5As shown, first deploy a dependency analysis server. Users can configure the software to be detected and view the final analysis report through the interface of the dependency analysis server. Deploy a detector in each environment where the software to be analyzed is running. The detector is connected to the dependency analysis server. Through the configuration issued by the analysis server, the detection of the software to be analyzed is started, and the detection data (actually accessed file data) is reported to the dependency analysis server. Assume that the target software package is S, and the description file corresponding to S records that S depends on software D1, software D2, and software D3, where software D1 contains three files f1, f2, and f3, software D2 contains three files f4, f5, and f6, and software D3 contains three files f7, f8, and f9. Then when S is deployed in environment A, environment B, and environment C, running software S will install software D1, software D2, and software D3 in addition to software S in the three environments. If the data detected by the detector from environment A is "S accessed f1 and f2 during operation", the data detected in environment B is "S accessed f4 and f5 during operation", and the data detected in environment C is "S accessed f3 and f6 during operation", the above detection data is reported to the dependency analysis server. The dependency analysis server then summarizes the detection data reported by the detectors deployed in each operating environment (environment A, environment B and environment C), and compares them with the description file. It can be understood that during the operation in different environments, S has accessed f1, f2, f4, f5, f3 and f6, that is, the three files f7, f8 and f9 contained in the D3 software that S depends on in the description file have never been accessed. Therefore, through the summary comparison of the dependency analysis server, it can be determined that software S actually depends on software D1 and software D2, and software D3 is a redundant dependency. In this way, through a simple comparison logic with the description file, redundant dependencies are determined based on the file data actually accessed during the operation of the software package, thereby improving the accuracy and efficiency of redundant dependency determination.
[0086] In addition, since data is recorded in different ways, the embodiment of the present application can illustrate a possible determination method.
[0087] In one embodiment, the method further comprises:
[0088] Generate redundant dependency reports based on the file data actually accessed;
[0089] The redundant dependency report is used to record all redundant dependencies of the target software package.
[0090] In actual applications, the analysis of redundant dependencies of the target software package can be presented to the user in the form of a report. Specifically, the dependency analysis server obtains the detection data (actually accessed file data) reported by the detectors deployed in each environment, and after determining the redundant dependencies through summary analysis, all redundant dependencies can be summarized to generate a redundant dependency report corresponding to the target software package. Combined with the above example, the redundant dependency of S is software D3, then in the generated redundant dependency report, its content can be displayed as "software D3 is a redundant dependency of software S." In this way, the redundant dependencies are recorded in the form of a report and displayed to the user for viewing, which improves the user experience.
[0091] In summary, Figure 6 A schematic diagram of a dependency analysis server execution process provided in an embodiment of the present application. Figure 6 As shown, after the dependency analysis server starts the process, it first sends the detection configuration to the detector, so that the detector starts the detection process and reports the detection data. Then, the dependency analysis server receives the detection data reported by the detectors deployed in each environment, and performs summary analysis to generate a detection report (redundant dependency report) for developers to eliminate redundant dependencies of the software. In this way, the embodiment of the present application provides an automated software dependency analysis process that is independent of the software development language, uses a system monitoring tool to detect system calls during the software operation process, and counts the files in other dependencies actually accessed by the software, thereby determining the runtime dependencies actually required by the software, and summarizes and analyzes the detection results of multiple environments to avoid errors in individual environments, thereby more accurately identifying software dependencies. In addition, eliminating redundant dependencies between software can reduce the time and space wasted when installing the system, improve the security and reliability of the system operation process, and reduce the maintenance work of the system.
[0092] In summary, the embodiment of the present application first determines the target software package. The target software package is the software package whose redundant dependencies are to be determined. Then, based on the detector, the file data actually accessed when the target software package is running is obtained from one or more operating environments. The file data includes the file path and file name, and the operating environment is an operating system and hardware environment that satisfies the normal operation of the target software package. Finally, the redundant dependencies of the target software package are determined based on the file data actually accessed. In this way, the files accessed by the target software package in each operating environment during the entire operation process are directly obtained based on the detector, and then the runtime dependencies that are really needed are identified without manual participation, while avoiding the phenomenon of incorrect redundant dependency judgment caused by the software implementation development language, while ensuring accuracy while improving the efficiency of determining redundant dependencies.
[0093] Based on the method for determining redundant dependencies of software packages provided in the above embodiment, the present application embodiment further provides an apparatus for determining redundant dependencies of software packages. The apparatus for determining redundant dependencies of software packages is described below in conjunction with the embodiments and drawings.
[0094] Figure 7 A schematic diagram of a structure of a device for determining redundant dependencies of a software package provided in an embodiment of the present application. Figure 7 As shown, the apparatus 700 for determining redundant dependencies of a software package provided in an embodiment of the present application includes:
[0095] The first determination module 701 is used to determine a target software package; the target software package is a software package whose redundant dependency relationship is to be determined;
[0096] The acquisition module 702 is used to acquire the file data actually accessed by the target software package when it is running from one or more running environments based on the detector; the file data includes the file path and file name; the running environment is the operating system and hardware environment that can meet the normal operation of the target software package;
[0097] The second determining module 703 is used to determine the redundant dependencies of the target software package based on the file data actually accessed.
[0098] As an implementation manner, with respect to how to transmit information with the detector, the apparatus 700 for determining redundant dependencies of a software package further includes: a sending module;
[0099] The sending module is used to send the detection configuration to the detector; the detection configuration is used to indicate that the target software package is used as the detection object of the detector.
[0100] As an implementation manner, with respect to how to obtain the file data actually accessed when the target software package is running, the acquisition module 702 is specifically used to:
[0101] The triggering detector obtains the system call data of the target software package when it is running in one or more running environments based on the detection configuration;
[0102] Get system call data from the probe;
[0103] Generate file data actually accessed by the target software package based on the system call data.
[0104] The system call data obtained when the target software package is running includes:
[0105] Based on the system monitoring tool, the system calls of the target software package are obtained when it is running, and the corresponding system call data is obtained.
[0106] System monitoring tools include: eBPF monitoring tools and / or kprobe monitoring tools.
[0107] System calls include: open system call and execve system call.
[0108] As an implementation manner, regarding how to determine the redundant dependencies of the target software package, the second determination module 703 is specifically used to:
[0109] Aggregate the file data actually accessed from each operating environment;
[0110] Compare the file data actually accessed with the description file corresponding to the target software package to determine the redundant dependencies of the target software package;
[0111] The description file is used to record all dependencies of the target software package.
[0112] As an implementation manner, with respect to how to record redundant dependencies, the apparatus 700 for determining redundant dependencies of a software package further includes: a recording module;
[0113] A recording module is used to generate redundant dependency reports based on the file data actually accessed;
[0114] The redundant dependency report is used to record all redundant dependencies of the target software package.
[0115] As an implementation manner, with respect to how to obtain the file data actually accessed when the target software package is running, the acquisition module 702 is further specifically used to:
[0116] The triggering detector obtains the system call data of the target software package when it is running under one or more running environments based on the detection configuration, and generates the file data actually accessed by the target software package through parsing;
[0117] Get file data directly from the detector.
[0118] In summary, the embodiment of the present application first determines the target software package. The target software package is the software package whose redundant dependencies are to be determined. Then, based on the detector, the file data actually accessed when the target software package is running is obtained from one or more operating environments. The file data includes the file path and file name, and the operating environment is an operating system and hardware environment that satisfies the normal operation of the target software package. Finally, the redundant dependencies of the target software package are determined based on the file data actually accessed. In this way, the files accessed by the target software package in each operating environment during the entire operation process are directly obtained based on the detector, and then the runtime dependencies that are really needed are identified without manual participation, while avoiding the phenomenon of incorrect redundant dependency judgment caused by the software implementation development language, while ensuring accuracy while improving the efficiency of determining redundant dependencies.
[0119] In addition, the present application also provides a server, including: a memory for storing a computer program; a processor for implementing the steps of the above-mentioned method for determining redundant dependencies of a software package when executing the computer program.
[0120] In addition, the present application also provides a readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for determining redundant dependencies of software packages as described above are implemented.
[0121] Figure 8 A schematic diagram of a server structure provided in an embodiment of the present application, combined with Figure 8 As shown, the server 800 includes a processor 810 and a memory 820; wherein the memory 820 stores computer programs / instructions, and the processor 810 is used to execute computer instructions, so that the server 800 executes the method for determining redundant dependencies of software packages mentioned above.
[0122] In some embodiments, the processor 810 may be a central processing unit, or other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, transistor logic devices, hardware components or any combination thereof. The general-purpose processor may be a microprocessor or any conventional processor.
[0123] In some embodiments, the memory 820 may be a volatile memory or a non-volatile memory, such as a register. Specifically, a volatile memory refers to a memory in which the data stored inside will be lost when the power supply is interrupted. Among them, the volatile memory is mainly a random access memory (RAM), including a static random access memory (SRAM) and a dynamic random access memory (DRAM). A non-volatile memory refers to a memory in which the data stored inside will not be lost even if the power supply is interrupted. Common non-volatile memories include read-only memory (ROM), optical disks, magnetic disks, solid-state hard disks, and various memory cards based on flash memory technology.
[0124] In some embodiments, the memory 820 has executable codes, and the memory 820 executes the codes to implement a method for determining redundant dependencies of software packages.
[0125] The communication interface 830 is used for communicating with the outside. For example, the communication interface 830 serves as an external interface, and the external interface receives a request to create a virtual machine. The communication interface 830 can also receive various parameters required for creating the virtual machine.
[0126] The bus can be a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of understanding, Figure 8 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.
[0127] It should be understood that the above-mentioned servers are only schematic representations. In actual use, the above-mentioned servers can be independent physical servers, or they can be server clusters or distributed systems composed of multiple physical servers. They can also be cloud servers that provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), as well as basic cloud computing services such as large databases and artificial intelligence platforms. When the above-mentioned servers are server clusters or distributed systems composed of multiple physical servers, multiple physical servers can form a blockchain, and each physical server is a node on the blockchain. The physical type of the service area can be a rack server, a high-density server, a GPU server, a tower server, and can also be a blade server, a whole cabinet server, etc., which is not specifically limited in this application.
[0128] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using a software program, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions in the embodiments of the present application are generated.
[0129] The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a magnetic disk, a magnetic tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid state drive (SSD)), etc.
[0130] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for determining redundant dependencies of a software package, characterized in that: Methods include: Determine the target software package; The target software package is a software package whose redundant dependencies are to be determined; Based on the detector, the file data actually accessed by the target software package when it is running is obtained from one or more running environments; the file data includes the file path and the file name; the running environment is the software and hardware environment that satisfies the normal operation of the target software package; The redundant dependencies of the target software package are determined based on the file data actually accessed.
2. The method according to claim 1, characterized in that Before obtaining the file data actually accessed by the target software package during operation from one or more operating environments based on the detector, the method further includes: Send the detection configuration to the detector; the detection configuration is used to indicate that the target software package is used as the detection object of the detector.
3. The method according to claim 2, characterized in that Obtain the file data actually accessed by the target software package during runtime from one or more runtime environments, including: The triggering detector obtains the system call data of the target software package when it is running in one or more running environments based on the detection configuration; Get system call data from the probe; Generate file data actually accessed by the target software package based on the system call data.
4. The method according to claim 2, characterized in that Obtain the file data actually accessed by the target software package during runtime from one or more runtime environments, including: The triggering detector obtains the system call data of the target software package when it is running in one or more running environments based on the detection configuration, and parses and generates the file data actually accessed by the target software package; Get the actual accessed files data from the probe.
5. The method according to claim 3 or 4, characterized in that The trigger probe obtains the system call data of the target software package at runtime in one or more runtime environments based on the probe configuration, including: Based on the system monitoring tool, the system calls of the target software package are obtained when it is running, and the corresponding system call data is obtained.
6. The method according to claim 5, characterized in that System monitoring tools include: eBPF monitoring tools and / or kprobe monitoring tools.
7. The method according to claim 5 or 6, characterized in that System calls include: open system call and execve system call.
8. The method according to any one of claims 1 to 7, characterized in that Determine the redundant dependencies of the target software package based on the file data actually accessed, including: Aggregate the file data actually accessed from each operating environment; Compare the file data actually accessed with the description file corresponding to the target software package to determine the redundant dependencies of the target software package; The description file is used to record all dependencies of the target software package.
9. The method according to any one of claims 1 to 8, characterized in that The method also includes: Generate redundant dependency reports based on the file data actually accessed; The redundant dependency report is used to record all redundant dependencies of the target software package.
10. A server, characterized in that: include: Memory and processor; Memory and processor coupling; Memory for storing computer programs; A processor, configured to implement the steps of the method for determining redundant dependencies of software packages according to any one of claims 1 to 9 when executing a computer program.
Citation Information
Patent Citations
Dependence package recommendation method and device, electronic equipment and readable storage medium
CN112182199A
Method and device for reducing bundle dependent chain redundancy and medium
CN112732267A
Redundant file determination method, device and equipment
CN113467781A
Software package processing method and device for target operating system
CN115543415A
Mirror image packaging method and device and electronic equipment
CN115599402A
