Software package dependency relationship detection method and device and storage medium
The method and device enhance software package dependency detection by automating the matching of database files and version ranges, improving accuracy and user experience through comprehensive dependency detection.
Patent Information
- Application Number
- CN202310788069.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-29
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2043-06-29
AI Technical Summary
Existing software package dependency detection methods have low automation levels, leading to poor user experience.
A method and device for detecting software package dependencies that automatically obtain and match database files containing dependency and provision tables, processing compound names, and matching version ranges to generate accurate dependency detection results without user specification.
Improves the automation and accuracy of software package dependency detection, enhancing user experience by automatically identifying missing dependencies and their affected software packages.
Smart Images

Figure CN119225790A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device and storage medium for detecting software package dependencies. Background Art
[0002] A software package is a program or a group of programs that has a specific function and is used to complete a specific task. There are multiple software packages in the operating system, and there are certain dependencies between the software packages. When installing a software package in the operating system, if the software package lacks a dependent file, the software package cannot be successfully installed. The relevant information of the software package dependent file can be represented by the requires table, and the relevant information of the dependent file can be represented by the provides table.
[0003] The prior art can detect the dependencies of specified software packages or software packages input by users when detecting software package dependencies, but the automation level is low, resulting in poor user experience. Summary of the invention
[0004] The present application provides a software package dependency detection method, device and storage medium, which are used to solve the problem that the existing technology has a low degree of automation when detecting software package dependencies, resulting in a poor user experience.
[0005] In a first aspect, the present application provides a method for detecting software package dependencies, comprising:
[0006] Get multiple database files, the database files contain dependent tables and provided tables;
[0007] Traversing each database file, and obtaining at least one first file name corresponding to the database file for the traversed database file, wherein the first file name is: a file name that exists in a dependency table of the database file but does not exist in a provision table of the database file;
[0008] If the first file name is a compound name, the first file name is parsed, wherein the compound name is a file name carrying a version range, and after parsing, the target file name to be matched, the version range corresponding to the target file name, and the prefix file are obtained;
[0009] For each target file name, a matching operation is performed in the provided tables of the database file and other database files until the target file name successfully matches any database file, or fails to match all database files; wherein the matching operation of the target file name with any provided table includes: if the operating system to be tested has installed the pre-installed file and the target file name exists in the provided table, then judging whether the version interval matches the version information corresponding to the target file name in the provided table, so as to determine the matching result;
[0010] According to the matching results corresponding to each target file name, the dependency detection missing results are generated and output.
[0011] In a second aspect, the present application provides a software package dependency detection device, comprising:
[0012] The acquisition module is used to obtain multiple database files, and the database files contain dependency tables and provision tables;
[0013] The processing module is used to traverse each database file, and for the traversed database file, obtain at least one first file name corresponding to the database file, wherein the first file name is: a file name that exists in a dependency table of the database file but does not exist in a provision table of the database file;
[0014] The processing module is further used to parse the first file name if the first file name is a compound name, wherein the compound name is a file name carrying a version range, and obtain the target file name to be matched, the version range corresponding to the target file name, and the prefix file after parsing;
[0015] The processing module is further used to perform a matching operation on each target file name in the provided tables of the database file and other database files until the target file name successfully matches any database file, or fails to match all database files; wherein the matching operation of the target file name with any provided table includes: if the operating system to be tested has installed the pre-installed file and the target file name exists in the provided table, then judging whether the version interval matches the version information corresponding to the target file name in the provided table, so as to determine the matching result;
[0016] The processing module is also used to generate and output dependency detection missing results based on the matching results corresponding to each target file name.
[0017] In a third aspect, the present application provides a software package dependency detection device, comprising: a processor and a memory, wherein the memory stores code, and the processor runs the code stored in the memory to execute any method in the first aspect.
[0018] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement any method as in the first aspect.
[0019] The present application provides a software package dependency detection method, device and storage medium, which obtains multiple database files, traverses each database file, and obtains at least one first file name corresponding to the database file for the traversed database file. If the first file name is a compound name, the first file name is parsed to obtain the target file name to be matched, the version interval and the pre-file corresponding to the target file name. For each target file name, a matching operation is performed in the provided table of the database file and other database files until the target file name successfully matches any database file, or fails to match all database files. According to the matching results corresponding to each target file name, a dependency detection missing result is generated and output. The method provided in the embodiment of the present application can automatically obtain multiple database files corresponding to the operating system to be tested, and match the file names contained in each database file. The dependency detection of all software packages corresponding to the operating system to be tested can be realized without user specification, thereby improving the degree of automation of dependency detection and improving user experience. The present application can also process the compound name and detect the processed file name again, which is conducive to improving the accuracy of detection. At the same time, when this application matches each target file name, the target file name must successfully match any database file, or the matching operation ends when it fails to match all database files. This effectively improves the accuracy compared to matching only one or part of the database files. During the matching process, this application can also match the version range corresponding to the target file name when the pre-installed file has been installed on the test system, further improving the accuracy of dependency detection. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0021] Figure 1 A schematic diagram of a scenario for detecting software package dependencies provided in an embodiment of the present application;
[0022] Figure 2 A flowchart of a software package dependency detection method provided in an embodiment of the present application;
[0023] Figure 3 A flow chart of a method for generating a dependency detection missing result provided in an embodiment of the present application;
[0024] Figure 4 A method for obtaining a database file provided in an embodiment of the present application Figure 1 ;
[0025] Figure 5A method for obtaining a database file provided in an embodiment of the present application Figure 2 ;
[0026] Figure 6 A flow chart of a method for detecting missing dependent files of a software package provided in an embodiment of the present application;
[0027] Figure 7 A schematic diagram of a software package dependency detection device provided in an embodiment of the present application Figure 1 ;
[0028] Figure 8 A schematic diagram of a software package dependency detection device provided in an embodiment of the present application Figure 2 .
[0029] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0030] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0031] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0032] First, the terms involved in this application are explained:
[0033] sqlite: is a lightweight database and a relational database management system that complies with ACID.
[0034] Structured Query Language (SQL): is a special-purpose programming language, a database query and programming language used to access data and query, update and manage relational database systems.
[0035] When detecting the dependency relationship of software packages, the prior art may detect the dependency relationship of specified software packages or software packages input by the user, but the automation level is low, resulting in a poor user experience.
[0036] The embodiment of the present application provides a software package dependency detection method, which can automatically obtain multiple database files corresponding to the operating system to be tested, and query the file name contained in each database file, that is, perform matching operations in the dependency table and the provided table of the database file, and automatically realize the dependency detection of all software packages corresponding to the operating system to be tested without user specification, thereby improving the degree of automation of dependency detection and enhancing user experience.
[0037] At the same time, when the application queries the file name in the database file, if the file name is a compound name, the file name is parsed to obtain the target file name to be matched, the corresponding version range and the pre-file. The target file name is matched again until the target file name successfully matches any database file, or fails to match all database files. Compared with matching only in some database files, the application performs a compound query with all database files, which effectively increases the accuracy of dependency detection.
[0038] If the target file name matches any database file successfully, and the prerequisite file has been installed on the operating system to be tested, the version range is further matched to determine the matching result, which effectively improves the accuracy of dependency detection.
[0039] Figure 1 A schematic diagram of a scenario for detecting software package dependencies provided in an embodiment of the present application. Figure 1 As shown, the device under test runs the operating system under test, obtains N warehouses under test corresponding to the operating system under test, and further obtains the database file corresponding to each warehouse under test. For the convenience of description, database file 1 is used as an example. The first file name missing from the software package in database file 1 is obtained, and the first file name is matched with other database files except database file 1 until the first file name successfully matches any database file, or fails to match N database files and ends the matching. For other database files except database file 1, the detection process of database file 1 mentioned above can be referred to. According to the matching results of the first file names corresponding to the N database files, the dependency detection missing results are generated and output.
[0040] The embodiments of the present application can be applied to multiple application scenarios such as changes in the software package repository, continuous daily testing, and full testing before the release of an operating system version.
[0041] The software package repository changes, specifically, by adding, deleting or modifying software packages. For example, after deleting a software package, other software packages that depend on the software package will be affected, so the dependency of the current software package needs to be detected to obtain the current dependency detection missing result.
[0042] For the application scenario of continuous daily testing, when the dependencies of the software package are periodically checked, each test can output the dependency detection missing result.
[0043] Before the operating system version is released, in order to ensure that the software package in the operating system can be installed and run normally, it is also necessary to perform a full detection of the software package dependencies and obtain the dependency detection missing results.
[0044] After obtaining the missing dependency detection results, relevant personnel can promptly understand the currently missing dependency files and affected software packages through the missing dependency detection results, and handle them in a timely manner to ensure the quality of the operating system version.
[0045] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0046] Figure 2 A flowchart of a software package dependency detection method provided in an embodiment of the present application. The method of this embodiment can be executed by a software package dependency detection device, which can be a device under test running an operating system to be tested, and can be implemented by hardware, software, or a combination of hardware and software. Figure 2 As shown, the method includes:
[0047] S201: Acquire multiple database files, where the database files include a dependency table and a provision table.
[0048] In one implementation scenario, the addresses of multiple warehouses to be tested corresponding to the operating system to be tested may be obtained, and then the corresponding database files may be obtained according to the addresses of the warehouses to be tested. The operating system to be tested may be a Linux operating system, or a Linux-like operating system.
[0049] The repository to be tested is a software package repository, which stores information about software packages included in the operating system to be tested.
[0050] The dependency table is the requires table, which is used to represent the information of the software package's dependent files. For example, software package A depends on file a, software package B depends on file b, etc. A software package can depend on one or more files.
[0051] The provides table is used to indicate the information of the files that the software package depends on in the requires table. For example, the file a that software package A depends on is provided by software package C. In another implementation scenario, the provides table does not contain the file b that software package B depends on. In this case, it can be indicated that the file b is not provided and software package B lacks the dependent file b.
[0052] S202: traverse each database file, and for the traversed database file, obtain at least one first file name corresponding to the database file, wherein the first file name is: a file name that exists in a dependency table of the database file but does not exist in a provision table of the database file.
[0053] In some embodiments, a SQL statement may be used to query tables and quickly obtain the name of the first file.
[0054] The first file name may be one or more names, including compound names and non-compound names. The compound name includes not only the file name, but also the version interval and the pre-file, such as (corosync>=2.99ifpacemaker), where corosync indicates the file name, >=2.99 indicates the version interval, and pacemaker indicates the dependent file.
[0055] In another implementation scenario, for a file name that exists in the dependency table of a database file and in the provision table of the database file, it can be indicated that the file corresponding to the file name has been provided and exists in the warehouse to be tested.
[0056] S203: If the first file name is a compound name, the first file name is parsed, wherein the compound name is a file name carrying a version range, and after parsing, the target file name to be matched, the version range corresponding to the target file name, and the prefix file are obtained.
[0057] In one implementation scenario, if the first file name is a compound name, string matching processing can be performed through the Python re module to obtain the target file name to be matched, the corresponding version range and the prefix file. For example, after string matching processing, (corosync>=2.99if pacemaker) will be converted into the form of [corosync,[2.99,1e4],pacemaker], and (npm(abbrev)>=1.0with npm(abbrev)<1.1) will be converted into the form of [npm(abbrev),[1.0,1.1],none]. In summary, after string matching processing of the compound name, information of the three fields of target file name, version range and prefix file is obtained. At this time, the target file name is a non-compound name.
[0058] It should be noted that for the compound name (npm (abbrev)> = 1.0 with npm (abbrev) < 1.1), it can be seen that there is no corresponding prefix file, so after the string matching process is performed on the compound name, the information corresponding to the prefix file can be set to the empty value none.
[0059] In another implementation scenario, if the first file name is a non-compound name, the first file name is used as the target file name, and a matching operation is performed in the provided tables of other database files until the target file name successfully matches any database file, or fails to match all database files.
[0060] Since the first file name is a non-compound name, the name exists in the requires table of the current database file, but does not exist in the provides table of the current database file. Therefore, it is necessary to check whether it exists in the provides table of other data path files.
[0061] S204: For each target file name, a matching operation is performed in the database file and the provided table of other database files until the target file name successfully matches any database file, or fails to match all database files.
[0062] Among them, the matching operation of the target file name with any provided table includes: if the operating system to be tested has installed the prerequisite file and the target file name exists in the provided table, then determine whether the version range matches the version information corresponding to the target file name in the provided table to determine the matching result.
[0063] In one implementation scenario, the target file name successfully matches any database file, that is, the provides table of the database file contains the target file name, the file corresponding to the target file name has been provided, and the software package that depends on the file does not lack this file.
[0064] In another implementation scenario, the target file name fails to match all database files, indicating that the provides table of all database files does not contain the target file name, the file corresponding to the target file name is not provided, and the software package that depends on the file lacks this file.
[0065] In some embodiments, if the operating system to be tested has installed the pre-installed file, but the target file name does not exist in the provided table, there is no need to match the version interval corresponding to the target file name.
[0066] In some embodiments, the operation of matching the target file name with any provided table may further include: if the operating system to be tested does not have the pre-installed file installed, determining whether the target file name exists in the provided table.
[0067] In an implementation scenario, if the target file name is in a provided table, it may indicate that the file corresponding to the target file name is provided, and the software package that depends on the file does not lack the file.
[0068] In another implementation scenario, if the target file name does not exist in the provided table of all database files, it may indicate that the file corresponding to the target file name is not provided, and the software package that depends on the file lacks this file.
[0069] S205: Generate and output the dependency detection missing result according to the matching results corresponding to the target file names.
[0070] In some embodiments, the dependency detection missing result may include the target file name that fails to match all database files, and may also include the software packages that depend on the target file name that fails to match, and the software packages that depend on the software packages, so as to obtain the software packages affected by the missing dependent files.
[0071] In some embodiments, the present application can also obtain dependency detection results through yum / rpm, apt / dpdk related commands in the test machine for further processing, but the time taken will be relatively long and the efficiency will be low.
[0072] It should be noted that this application can be implemented using Python scripts or other programming languages, and this application does not limit this.
[0073] The embodiment of the present application provides a method for detecting software package dependencies, obtaining multiple database files, wherein the database files contain a requires table and a provides table. Each database file is traversed, and at least one corresponding first file name is obtained for the traversed database file. Among them, the first file name is a file name that exists in the requires table of a certain database file but does not exist in the provides table of the database file. If the first file name is a composite name, the first file name is parsed to obtain the target file name to be matched, the version interval corresponding to the target file name, and the pre-file. For each target file name, a matching operation is performed in the provided table of the database file and other database files until the target file name successfully matches any database file, or fails to match all database files. According to the matching results corresponding to each target file name, a dependency detection missing result is generated and output. The method provided in the embodiment of the present application can process the composite name, and again detect whether the processed file name, that is, the target file name, exists in the provides table, which is conducive to improving the detection accuracy. At the same time, the present application also matches the version interval corresponding to the target file name when the pre-file has been installed in the operating system to be tested, further improving the accuracy of dependency detection. The present application can also automatically and fully detect and judge the software packages of all database files corresponding to the operating system to be tested, without specifying the software package or user inputting the software package, thereby improving the automation and comprehensiveness of dependency detection and helping to enhance the user experience.
[0074] Figure 3 A flow chart of a method for generating a dependency detection missing result provided in an embodiment of the present application. In one or more embodiments of the present application, the method for generating a dependency detection missing result may include: Figure 3 Steps shown:
[0075] S301: According to the matching results corresponding to each target file name, the target file name that fails to match all database files, the version interval and the pre-file corresponding to the target file name are obtained to generate a list of missing dependent files.
[0076] The target file name that fails to match all database files indicates that the file corresponding to the target file name is not provided, so the file is the missing dependent file.
[0077] There can be one or more target file names that fail to match all database files.
[0078] S302: According to the list of missing dependent files, the name, version and warehouse of the target software package that depends on the target file name are obtained to generate a software package list.
[0079] In one implementation scenario, if a software package is missing one or more dependent files, the installation of the software package will be affected. Therefore, after obtaining the list of missing dependent files, it is also necessary to obtain the software packages that depend on the missing files.
[0080] S303: Acquire a first software package that depends on the target software package according to the software package list.
[0081] For example, if the above software package list includes target software package A, and first software package B depends on a file a, which is provided by target software package A, then there is a certain dependency relationship between target software package A and first software package B. Whether target software package A can be successfully installed will affect the installation of first software package B. When target software package A cannot be installed normally, first software package B will also fail to be installed normally.
[0082] S304: Taking the first software package as the target software package, obtaining the first software package that depends on the current target software package, until there is no software package that depends on the target software package, and updating the software package list.
[0083] For example, it can be seen from the above that the first software package B depends on the target software package A. Similarly, for the first software package B, there may be a software package C that depends on the first software package B. Further, there may be a software package D that depends on software package C. And so on. Step S304 is repeated until there is no software package that depends on the target software package. That is, all software packages affected by the missing file corresponding to the target file name are obtained.
[0084] S305: Outputting the dependency file missing list and the updated software package list as dependency relationship missing detection results.
[0085] The updated software package list includes all software packages that are affected by the missing file corresponding to the target file name, as well as the corresponding versions and repositories.
[0086] In summary, according to the matching results corresponding to each target file name, the target file name that fails to match all database files, the version range and the prefix file corresponding to the target file name are obtained, a list of missing dependent files is generated, and the software packages affected by the missing files corresponding to the target file name are further obtained. This helps developers quickly solve the problem of some software packages lacking dependent files in the software package repository of the specified operating system version.
[0087] Figure 4 A method for obtaining a database file provided in an embodiment of the present application Figure 1 In one or more embodiments of the present application, obtaining database files contained in multiple warehouses to be tested may include: Figure 4 Steps shown:
[0088] S401: Acquire addresses of multiple warehouses to be tested, where the addresses of the warehouses to be tested include system version and architecture fields.
[0089] In one implementation scenario, the address of the warehouse to be tested can be automatically obtained according to the yum source file of the test machine, that is, the device running the operating system to be tested, and there can be multiple addresses of the warehouse to be tested.
[0090] In one implementation scenario, an operating system may include multiple yum source files, and a yum source file may include multiple repositories. A repository is a software package repository that stores information about software packages included in the operating system.
[0091] S402: Obtain the system version and architecture of the current operating system to be tested, and replace the information contained in the system version and architecture fields in the address of the warehouse to be tested according to the system version and architecture of the operating system to be tested.
[0092] A feasible implementation method is to use the command cat / etc / os-release and the echo content of uname -i as the system version and architecture of the current operating system to be tested, and replace the information corresponding to the system version and architecture fields in the address of the warehouse to be tested.
[0093] S403: Obtain the corresponding database file according to the address of the replaced warehouse to be tested.
[0094] In one implementation scenario, a metadata file may be obtained according to the address of the warehouse to be tested. Based on the metadata file, a corresponding database file may be obtained. Usually, the metadata file of each warehouse to be tested is unique.
[0095] It should be noted that, since there may be multiple addresses of the warehouse to be tested, it is necessary to repeatedly execute S401-S403 to obtain the database files of all the warehouses to be tested.
[0096] In summary, the addresses of multiple warehouses to be tested corresponding to the operating system to be tested are obtained, and the corresponding database files are obtained based on the addresses of the warehouses to be tested. The multiple database files are used for software package dependency detection, which is conducive to improving the accuracy of software package dependency detection.
[0097] Figure 5 A method for obtaining a database file provided in an embodiment of the present application Figure 2 In one or more embodiments of the present application, obtaining the corresponding database file according to the address of the replaced warehouse to be tested may include: Figure 5 Steps shown:
[0098] S501: remotely obtain a corresponding metadata file according to the address of the replaced warehouse to be tested, and read the metadata file line by line to obtain a name of a database compression file of a preset type.
[0099] In one implementation scenario, / repodata / repomd.xml may be added after the address of the replaced repository to be tested, and the metadata file, namely, the repomd.xml file, may be remotely obtained using the wget command.
[0100] The name of the preset type of database compression file can be determined according to actual conditions, and can be a primary database compression file name in the form of "repodata / 5c03df97d45b12d75e34c33f06ae1663720c2312514b11379d4c3620c44d6800-primary.sqlite.bz2".
[0101] S502: According to the database compression file name and the address of the warehouse to be tested, obtain the corresponding database compression file address.
[0102] In one implementation scenario, the address of the database compressed file may be obtained by adding / repodata / and the above-mentioned database compressed file name after the address of the warehouse to be tested.
[0103] S503: Obtain the corresponding database compressed file according to the database compressed file address, and decompress the database compressed file to obtain the database file.
[0104] In one implementation scenario, the corresponding database compressed file can be remotely obtained through the wget command according to the database compressed file address, and the database file can be decompressed to obtain the database file. The database file can be a primary.sqlite database file. In some embodiments, remotely obtaining the database compressed file through the wget command can be completed in seconds, which is highly efficient.
[0105] It should be noted that, since there may be multiple addresses of the warehouse to be tested, it is necessary to repeatedly execute S501-S503 to obtain the database files of all the warehouses to be tested.
[0106] In some embodiments, if the detection of all software package dependencies in all database files is completed, the metadata files and database compressed files may be cleaned up.
[0107] In summary, this application remotely obtains the corresponding metadata file through the address of the warehouse to be tested, and further remotely obtains the corresponding database compressed file, decompresses the database compressed file to obtain the database file, and does not need to use createrepo to generate the software package dependency database, which is beneficial to reducing the time of software package dependency detection and improving detection efficiency.
[0108] Based on the above embodiment, a specific embodiment is provided below to describe in detail the process of detecting the dependent files missing from the software package after the database file is acquired.
[0109] Figure 6 A flow chart of a method for detecting a missing dependent file of a software package provided in an embodiment of the present application, such as Figure 6 As shown, the method is as follows:
[0110] S601: Connect with any database file to obtain the first file name that exists in the dependency table of the database file but does not exist in the provision table of the database file.
[0111] S602: Determine whether each file name of the first file name carries a version requirement. If yes, execute step S603; if no, execute step S608.
[0112] S603: Perform string matching on the first file name carrying the version requirement to obtain the target file name, the version range corresponding to the target file name, and the pre-file.
[0113] S604: Determine whether the pre-installed file has been installed in the operating system to be tested. If yes, execute step S605; if not, execute step S606.
[0114] S605: If the operating system to be tested has installed the pre-installed file, determine whether the target file name exists in the provided table and whether the version item of the corresponding row matches the version range. If so, execute step S607; if not, execute step S608.
[0115] S606: If the operating system to be tested does not have the pre-installed file installed, determine whether the target file name exists in the provided table. If so, execute step S607; if not, execute step S608.
[0116] S607: Determine whether the test has passed.
[0117] S608: Based on the target file name that failed the test, traverse and check the database files of other warehouses to be tested. If the database files of all warehouses to be tested fail the test, the target file name is used as the missing dependent file.
[0118] After obtaining the missing dependent files, the dependency relationship detection missing result can be generated and output according to the dependent files. The present application embodiment describes the process of detecting the missing dependent files of the software package, and its specific implementation principle can refer to the above other embodiments, which will not be repeated here.
[0119] Figure 7 A schematic diagram of a software package dependency detection device provided in an embodiment of the present application Figure 1 .like Figure 7 As shown, an embodiment of the present application provides a software package dependency detection device 700, which may include an acquisition module 701 and a processing module 702.
[0120] The acquisition module 701 is used to acquire multiple database files, where the database files include a dependency table and a provision table;
[0121] Processing module 702 is used to traverse each database file, and for the traversed database file, obtain at least one first file name corresponding to the database file, wherein the first file name is: a file name that exists in the dependency table of the database file but does not exist in the provision table of the database file;
[0122] The processing module 702 is further used to parse the first file name if the first file name is a compound name, wherein the compound name is a file name carrying a version range, and obtain the target file name to be matched, the version range corresponding to the target file name, and the prefix file after parsing;
[0123] The processing module 702 is further used to perform a matching operation on each target file name in the provided tables of the database file and other database files until the target file name successfully matches any database file, or fails to match all database files; wherein the matching operation of the target file name with any provided table includes: if the operating system to be tested has installed the pre-installed file and the target file name exists in the provided table, then determining whether the version interval matches the version information corresponding to the target file name in the provided table to determine the matching result;
[0124] The processing module 702 is also used to generate and output a dependency detection missing result according to the matching results corresponding to each target file name.
[0125] The device of this embodiment can be used to perform the following steps: Figures 2 to 6 The implementation principle and technical effect of the method embodiment shown are similar and will not be repeated here.
[0126] Figure 8 A schematic diagram of a software package dependency detection device provided in an embodiment of the present application Figure 2 .like Figure 8As shown, an embodiment of the present application provides a software package dependency detection device 800 including a processor 801 and a memory 802 , wherein the processor 801 and the memory 802 are connected via a bus 803 .
[0127] In the specific implementation process, the memory 802 stores codes, and the processor 801 runs the codes stored in the memory 802 to execute the method of the above method embodiment.
[0128] The specific implementation process of the processor 801 can be found in the above method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.
[0129] In the above Figure 8 In the illustrated embodiment, it should be understood that the processor 801 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.
[0130] The memory 802 may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk storage.
[0131] The bus 803 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 803 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus 803 in the drawings of the present application is not limited to only one bus or one type of bus.
[0132] An embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the method of the above method embodiment.
[0133] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.
[0134] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0135] An embodiment of the present application provides a computer program product, including a computer program. When the computer program is executed by a processor, the method provided in any embodiment of the present application is implemented.
[0136] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0137] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A software package dependency detection method, characterized in that: include: Acquire multiple database files, wherein the database files include a dependency table and a provision table; Traversing each database file, and for each traversed database file, obtaining at least one first file name corresponding to the database file, wherein the first file name is: a file name that exists in a dependency table of the database file but does not exist in a provision table of the database file; If the first file name is a compound name, the first file name is parsed, wherein the compound name is a file name carrying a version range, and after parsing, the target file name to be matched, the version range corresponding to the target file name, and the prefix file are obtained; For each target file name, a matching operation is performed in the provided tables of the database file and other database files until the target file name successfully matches any database file or fails to match all database files; wherein the matching operation of the target file name with any provided table includes: if the operating system to be tested has the pre-installed file and the target file name exists in the provided table, then determining whether the version interval matches the version information corresponding to the target file name in the provided table to determine a matching result; Based on the matching results corresponding to each target file name, the dependency detection missing results are generated and output.
2. The method according to claim 1, characterized in that The matching operation further includes: if the operating system to be tested does not have the pre-installed file installed, determining whether the target file name exists in the provided table.
3. The method according to claim 1, characterized in that Also includes: If the first file name is a non-compound name, the first file name is used as the target file name, and a matching operation is performed in the provided table of other database files until the target file name successfully matches any database file or fails to match all database files.
4. The method according to any one of claims 1 to 3, characterized in that The process of generating and outputting dependency detection missing results based on the matching results corresponding to the target file names includes: According to the matching results corresponding to each target file name, the target file name that fails to match all database files, the version range and the prefix file corresponding to the target file name are obtained to generate a list of missing dependent files; According to the list of missing dependent files, obtain the name, version and repository of the target software package that depends on the target file name to generate a software package list; According to the software package list, obtaining a first software package that depends on the target software package; Taking the first software package as the target software package, obtaining first software packages that depend on the current target software package until no software packages that depend on the target software package exist, and updating the software package list; The dependency file missing list and the updated software package list are taken as dependency relationship missing results and output.
5. The method according to claim 1, characterized in that The obtaining of multiple database files includes: Obtain addresses of multiple warehouses to be tested, where the addresses of the warehouses to be tested include system version and architecture fields; Obtaining the system version and architecture of the current operating system to be tested, and replacing the information contained in the system version and architecture fields in the address of the warehouse to be tested according to the system version and architecture of the operating system to be tested; Get the corresponding database file according to the address of the replaced warehouse to be tested.
6. The method according to claim 5, characterized in that The step of obtaining the corresponding database file according to the address of the replaced warehouse to be tested includes: According to the address of the replaced warehouse to be tested, remotely obtain the corresponding metadata file, and read the metadata file line by line to obtain the name of the database compression file of the preset type; According to the database compressed file name and the address of the warehouse to be tested, obtain the corresponding database compressed file address; The corresponding database compressed file is obtained according to the database compressed file address, and the database compressed file is decompressed to obtain the database file.
7. The method according to claim 6, characterized in that Also includes: The metadata file and the database compressed file are cleaned up.
8. A software package dependency detection device, characterized in that: include: An acquisition module, configured to acquire a plurality of database files, wherein the database files include a dependency table and a provision table; a processing module, configured to traverse each database file and, for each traversed database file, obtain at least one first file name corresponding to the database file, wherein the first file name is a file name that exists in a dependency table of the database file but does not exist in a provision table of the database file; The processing module is further configured to parse the first file name if the first file name is a compound name, wherein the compound name is a file name carrying a version interval, and obtain the target file name to be matched, the version interval corresponding to the target file name, and the prefix file after parsing; The processing module is further configured to perform a matching operation on each target file name in the provided tables of the database file and other database files until the target file name successfully matches any database file or fails to match all database files; wherein the matching operation of the target file name with any provided table includes: if the operating system to be tested has the pre-installed file and the target file name exists in the provided table, determining whether the version interval matches the version information corresponding to the target file name in the provided table to determine a matching result; The processing module is also used to generate and output dependency detection missing results based on the matching results corresponding to each target file name.
9. A software package dependency detection device, comprising: A processor and a memory, wherein the memory stores codes, and the processor runs the codes stored in the memory to perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Linux operation system software package and dependency deficiency detecting method thereof
CN102945155A
Project version detection method and system based on text information association relation analysis
CN110659502A
Software package dependency relationship processing method, computing device and readable storage medium
CN114879978A
Software project dependency analysis method and device, computer equipment and storage medium
CN115202709A
Dependence package installation time analysis method and device, equipment and storage medium
CN116028108A
