Software package dependency detection method, device and storage medium

By parsing and matching the operating system's database files, missing dependency detection results are generated, solving the problem of low automation in existing technologies and improving the automation and accuracy of software package dependency detection.

CN119225790BActive Publication Date: 2026-03-17CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

Existing technologies have a low degree of automation in detecting package dependencies, resulting in a poor user experience.

Method used

By acquiring multiple database files, parsing and matching file names within the database files, and generating dependency detection results for missing information, the level of automation and accuracy are improved.

Benefits of technology

It enables automated detection of all software package dependencies in the operating system without user specification, improving the automation and accuracy of the detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119225790B_ABST
    Figure CN119225790B_ABST
Patent Text Reader

Abstract

The application provides a software package dependency detection method, device and storage medium. The method comprises the following steps: acquiring a plurality of database files, the database files comprising a dependency table and a providing table; traversing each database file, and acquiring at least one first file name corresponding to the database file for each traversed database file; if the first file name is a composite name, parsing the first file name to obtain a target file name, a corresponding version interval and a preposed file; for each target file name, performing a matching operation in the providing table of the database file and other database files until the target file name is successfully matched with any database file or fails to be matched with all database files; and generating a dependency relationship detection missing result according to the matching result corresponding to each target file name and outputting the result. The method can automatically detect the dependency relationship of the software package, improve the automation degree of detection and enhance the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, device and storage medium for detecting software package dependencies. Background Technology

[0002] A software package is a program or a group of programs with specific functions used to accomplish a specific task. An operating system contains multiple software packages, and these packages have dependencies on each other. When installing a software package in an operating system, if a dependency file is missing, the package will fail to install. The information about the package's dependency file is represented by the `requires` table, and the information about providing that dependency file is represented by the `provides` table.

[0003] Existing technologies can detect dependencies of specified software packages or user-input software packages, but the degree of automation is low, resulting in a poor user experience. Summary of the Invention

[0004] This application provides a method, device, and storage medium for detecting software package dependencies, in order 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] Firstly, this application provides a method for detecting software package dependencies, including:

[0006] Retrieve multiple database files, each containing dependency tables and provider tables;

[0007] For each database file, obtain at least one first filename corresponding to the database file. The first filename is a filename that exists in the dependency table of the database file but does not exist in the provider table of the database file.

[0008] If the first file name is a compound name, then the first file name is parsed. The compound name is a file name that carries a version range. After parsing, the target file name to be matched, the version range corresponding to the target file name, and the preceding file are obtained.

[0009] For each target file name, a matching operation is performed in the database file and the provided tables of other database files until the target file name matches any database file successfully, or fails to match any database file. The matching operation between the target file name and any provided table includes: if the operating system to be tested has installed the prerequisite files and the target file name exists in the provided table, then it is determined whether the version range matches the version information corresponding to the target file name in the provided table to determine the matching result.

[0010] Based on the matching results corresponding to each target file name, generate and output the dependency missing detection results.

[0011] Secondly, this application provides a software package dependency detection device, comprising:

[0012] The acquisition module is used to acquire multiple database files, which contain dependency tables and provider tables.

[0013] The processing module is used to traverse each database file and obtain at least one first file name corresponding to the traversed database file. The first file name is: the file name that exists in the dependency table of the database file but does not exist in the provider table of the database file.

[0014] The processing module is also used to parse the first file name if the first file name is a compound name, where 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 preceding file are obtained;

[0015] The processing module is also used to perform a matching operation on each target file name in the database file and the provided tables of other database files until the target file name is successfully matched with any database file or fails to match with 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 prerequisite files and the target file name exists in the provided table, then it is determined whether the version range matches the version information corresponding to the target file name in the provided table 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] Thirdly, this application provides a software package dependency detection device, including: a processor, a memory, code stored in the memory, and the processor running the code stored in the memory to perform the method as described in any of the first aspects.

[0018] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any of the first aspects.

[0019] This application provides a method, device, and storage medium for detecting software package dependencies. It involves acquiring multiple database files, traversing each database file, and obtaining at least one first filename corresponding to each database file. If the first filename is a compound name, it is parsed to obtain the target filename to be matched, the version range corresponding to the target filename, and the predecessor file. For each target filename, a matching operation is performed in the tables provided by the database files and other database files until the target filename matches any database file successfully, or fails to match all database files. Based on the matching results corresponding to each target filename, a dependency detection missing result is generated and output. The method provided in this application can automatically acquire multiple database files corresponding to the operating system under test and perform matching operations on the filenames contained in each database file. It can achieve dependency detection of all software packages corresponding to the operating system under test without user specification, improving the automation level of dependency detection and enhancing the user experience. This application can also process compound names and then perform detection on the processed filenames again, which helps to improve the detection accuracy. Furthermore, when matching each target file name, this application requires that the target file name successfully matches any database file, or fails to match all database files, thus ending the matching operation. Compared to matching only one or some database files, this effectively improves the accuracy. During the matching process, this application can also match the version range corresponding to the target file name, even when the prerequisite files are already installed on the test system, further improving the accuracy of dependency detection. Attached Figure Description

[0020] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0021] Figure 1 A schematic diagram illustrating a scenario for software package dependency detection provided in an embodiment of this application;

[0022] Figure 2 A flowchart of a software package dependency detection method provided in this application embodiment;

[0023] Figure 3 A flowchart illustrating a method for generating missing dependency detection results provided in this application embodiment;

[0024] Figure 4 A method flow for obtaining a database file provided in this application embodiment Figure 1 ;

[0025] Figure 5A method flow for obtaining a database file provided in this application embodiment Figure 2 ;

[0026] Figure 6 A flowchart illustrating a method for detecting missing dependency files in a software package, as provided in this application embodiment;

[0027] Figure 7 A schematic diagram of a software package dependency detection device provided in this application embodiment. Figure 1 ;

[0028] Figure 8 A schematic diagram of a software package dependency detection device provided in this application embodiment. Figure 2 .

[0029] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0030] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.

[0032] First, let me explain the terms used in this application:

[0033] SQLite is a lightweight database that is an ACID-compliant relational database management system.

[0034] Structured Query Language (SQL) is a special-purpose programming language used for database querying and programming. It is used to access, query, update, and manage relational database systems.

[0035] Existing technologies can detect dependencies of specified software packages or user-input software packages, but the degree of automation is low, resulting in a poor user experience.

[0036] This application provides a software package dependency detection method that can automatically obtain multiple database files corresponding to the operating system under test and query the file names contained in each database file, that is, perform matching operations in the dependency table and the provider table of the database file. It can automatically realize the dependency detection of all software packages corresponding to the operating system under test without user specification, thereby improving the automation level of dependency detection and enhancing the user experience.

[0037] Furthermore, when querying filenames in the database files, if the filename is a compound name, the filename is parsed to obtain the target filename to be matched, the corresponding version range, and the preceding file. The target filename is then matched again until it matches any database file or fails to match any database file. Compared to matching only some database files, this application performs compound queries on all database files, effectively increasing the accuracy of dependency detection.

[0038] If the target file name matches any database file, and the prerequisite files are already installed on the operating system under test, the version range is further matched to determine the matching result, which effectively improves the accuracy of dependency detection.

[0039] Figure 1 This is a schematic diagram illustrating a scenario for software package dependency detection provided in an embodiment of this application. Figure 1 As shown, the device under test (DUT) runs the operating system under test (OS), obtains N repositories corresponding to the OS, and further obtains the database file corresponding to each repository. For ease of description, database file 1 is used as an example. The first filename of the missing software package in database file 1 is obtained, and this first filename is matched against all other database files except database file 1, until the first filename matches any database file successfully, or fails to match any of the N database files. For other database files besides database file 1, the detection process for database file 1 can be referenced above. Based on the matching results of the first filenames corresponding to the N database files, dependency missing result is generated and output.

[0040] The embodiments of this application can be applied to various scenarios, such as changes in the software package repository, continuous daily testing, and full testing before the release of an operating system version.

[0041] Changes to the software package repository specifically refer to changes caused by adding, deleting, or modifying software packages. For example, deleting a software package will affect other packages that depend on it. Therefore, it is necessary to check the dependencies of the current packages to obtain any missing dependency information.

[0042] For the application scenario of continuous daily testing, when periodically checking the dependencies of software packages, each check can output the result of missing dependencies.

[0043] Before the operating system version is released, in order to ensure that the software packages in the operating system can be installed and run normally, it is also necessary to perform a full check on the dependencies of the software packages and obtain the results of missing dependencies.

[0044] After obtaining the dependency missing detection results, relevant personnel can promptly identify the missing dependency files and affected software packages, and take timely action to ensure the quality of the operating system version.

[0045] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0046] Figure 2 This is a flowchart illustrating a software package dependency detection method provided in an embodiment of this application. The method in this embodiment can be executed by a software package dependency detection device, which can be a device under test running the operating system to be tested, and can be implemented through hardware, software, or a combination of hardware and software. Figure 2 As shown, the method includes:

[0047] S201: Retrieve multiple database files, which contain dependency tables and provider tables.

[0048] In one implementation scenario, the addresses of multiple repositories corresponding to the operating system under test can be obtained, and then the corresponding database files can be retrieved based on the addresses of the repositories under test. The operating system under test can be a Linux operating system or a Linux-like operating system.

[0049] The repository to be tested is a software package repository that stores information about the software packages included in the operating system to be tested.

[0050] The dependency table, or `requires` table, is used to represent information about the files that a software package depends on. For example, package A depends on file `a`, package B depends on file `b`, etc., where a package can depend on one or more files.

[0051] The `provides` table is used to represent the files that packages depend on, as shown in the `requires` table. For example, file `a`, which package A depends on, is provided by package C. In another implementation scenario, the `provides` table may not contain file `b`, which package B depends on. This indicates that file `b` is not provided, and package B lacks the dependent file `b`.

[0052] S202: Traverse each database file. For each traversed database file, obtain at least one first file name corresponding to the database file. The first file name is: the file name that exists in the dependency table of the database file but does not exist in the provider table of the database file.

[0053] In some embodiments, SQL statements can be used to join tables to quickly obtain the first file name.

[0054] The first file name can 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 range and the preceding file, and can be in the form of (corosync>=2.99ifpacemaker), where corosync represents the file name, >=2.99 represents the version range, and pacemaker represents the dependent file.

[0055] In another implementation scenario, for a file name that exists in both the dependency table and the provider table of the database file, it can be indicated that the file corresponding to that file name has been provided and that the file exists in the repository to be tested.

[0056] S203: If the first file name is a compound name, then the first file name is parsed, where the compound name is a file name carrying a version range. After parsing, the target file name to be matched, the version range corresponding to the target file name, and the preceding file are obtained.

[0057] In one implementation scenario, if the first filename is a compound name, the `re` module in Python can be used for string matching to obtain the target filename, its corresponding version range, and its preceding file. For example, `(corosync>=2.99if pacemaker)` will be transformed into the form `[corosync,[2.99,1e4],pacemaker]` after string matching, and `(npm(abbrev)>=1.0with npm(abbrev)<1.1)` will be transformed into the form `[npm(abbrev),[1.0,1.1],none]`. In summary, after string matching of a compound name, the target filename, version range, and preceding file are obtained; in this case, the target filename is a non-compound name.

[0058] It should be noted that for the compound name (npm(abbrev)>=1.0with npm(abbrev)<1.1), it is known that there is no corresponding predecessor file. Therefore, after performing string matching processing on the compound name, the information corresponding to the predecessor file can be set to the null value none.

[0059] In another implementation scenario, if the first file name is a non-compound name, then the first file name is used as the target file name, and a matching operation is performed in the tables provided by 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, this name exists in the requires table of the current database file, but not in the provides table of the current database file. Therefore, it is necessary to check whether it exists in the provides table of other database files.

[0061] S204: For each target file name, perform a matching operation in the tables provided by the database file and other database files until the target file name matches any database file successfully, or fails to match all database files.

[0062] The matching operation between the target file name and any provided table includes: if the operating system to be tested has installed the prerequisite files 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, so as to determine the matching result.

[0063] In one implementation scenario, the target file name matches any database file successfully, meaning that the database file's provides table contains the target file name, the file corresponding to the target file name has been provided, and the software packages that depend on the file do not lack this file.

[0064] In another implementation scenario, the target file name fails to match any of the database files, indicating that the target file name is not included in the provides table of any of the database files, the file corresponding to the target file name has not been provided, and the software package that depends on the file is missing this file.

[0065] In some embodiments, if the operating system to be tested has already installed the prerequisite files, but the target file name does not exist in the provided table, then it is not necessary to match the version range corresponding to the target file name.

[0066] In some embodiments, the matching operation between the target file name and any provided table may further include: if the operating system to be tested does not have the prerequisite files installed, determining whether the target file name exists in the provided table.

[0067] In one implementation scenario, if the target file name is in a certain provision table, it indicates that the file corresponding to the target file name is provided, and the software packages that depend on the file do not lack this file.

[0068] In another implementation scenario, if the target file name does not exist in the provision table of all database files, it indicates that the file corresponding to the target file name has not been provided, and the software package that depends on the file is missing this file.

[0069] S205: Based on the matching results corresponding to each target file name, generate and output the dependency missing detection results.

[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 software packages that depend on the aforementioned target file names that fail to match, as well as software packages that depend on the aforementioned software packages, to obtain the software packages affected by the missing dependent files.

[0071] In some embodiments, this application can also obtain dependency detection results on the test machine through yum / rpm, apt / dpdk related commands for further processing, but the time required 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 the use of any of them.

[0073] This application provides a method for detecting software package dependencies. It obtains multiple database files, each containing a `requires` table and a `provides` table. Each database file is traversed, and for each traversed file, at least one corresponding first filename is obtained. The first filename is a filename that exists in the `requires` table of a particular database file but not in the `provides` table. If the first filename is a compound name, it is parsed to obtain the target filename to be matched, the version range corresponding to the target filename, and the prerequisite files. For each target filename, a matching operation is performed in the `provides` tables of the database file and other database files until the target filename matches any database file successfully, or fails to match any database file. Based on the matching results corresponding to each target filename, a dependency detection missing result is generated and output. The method provided in this application can process compound names and then further detect whether the processed filename (i.e., the target filename) exists in the `provides` table, which helps improve the detection accuracy. Furthermore, this application also matches the version range corresponding to the target filename when the operating system under test has already installed the prerequisite files, further improving the accuracy of dependency detection. This application can also automatically and fully detect and judge the software packages of all database files corresponding to the operating system under test, without the need to specify the software packages or have the user input the software packages, which improves the automation and comprehensiveness of dependency detection and helps to improve the user experience.

[0074] Figure 3 This document provides a flowchart of a method for generating missing dependency detection results, as illustrated in an embodiment of this application. In one or more embodiments of this application, the method for generating missing dependency detection results may include, for example... Figure 3 The steps shown are as follows:

[0075] S301: Based on the matching results corresponding to each target file name, obtain the target file name that fails to match all database files, the version range corresponding to the target file name, and the predecessor file, in order to generate a list of missing dependency files.

[0076] If a target file name fails to match any database file, it indicates that the file corresponding to that target file name has not been provided, and therefore that file is the missing dependent file.

[0077] The target file name that fails to match all database files can be one or more.

[0078] S302: Based on the list of missing dependency files, obtain the name, version, and repository of the target package whose dependency target file name is used to generate a package list.

[0079] In one implementation scenario, if a software package is missing one or more dependent files, it will affect the installation of the software package. 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: Based on the package list, retrieve the first package that depends on the target package.

[0081] For example, if the above package list includes target package A, and first package B depends on a file 'a', which is provided by target package A, then target package A and first package B also have a dependency relationship. Whether target package A can be successfully installed will affect the installation of first package B. If target package A cannot be installed normally, first package B will also fail to install normally.

[0082] S304: Take the first package as the target package, obtain the first packages that depend on the current target package, and continue until there are no packages that depend on the target package, and update the package list.

[0083] For example, as shown above, the first software package B depends on the target software package A. Similarly, for the first software package B, there may also be a software package C that depends on the first software package B. Furthermore, there may also be a software package D that depends on software package C, and so on. Repeat step S304 until there are no software packages that depend 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: Output the list of missing dependency files and the updated list of software packages as the results of dependency missing detection.

[0085] The updated package list includes all packages affected by the missing file corresponding to the target file name, along with their corresponding versions and repositories.

[0086] In summary, based on the matching results corresponding to each target file name, the target file name that fails to match all database files, the version range corresponding to the target file name, and the predecessor file are obtained. A list of missing dependency 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 dependency files in the software package repository of a specified operating system version.

[0087] Figure 4 A method flow for obtaining a database file provided in this application embodiment Figure 1 In one or more embodiments of this application, obtaining database files contained in multiple repositories to be tested may include, for example: Figure 4 The steps shown are as follows:

[0088] S401: Obtain the addresses of multiple repositories to be tested. The addresses of the repositories to be tested contain the system version and architecture fields.

[0089] In one implementation scenario, the address of the repository to be tested can be automatically obtained from the yum source files of the test machine, i.e., the device running the operating system to be tested. There can be multiple addresses of the repository to be tested.

[0090] In one implementation scenario, an operating system can contain multiple yum source files, and a single yum source file can contain multiple repositories. A repository is a software package repository that stores information about the 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 repository to be tested according to the system version and architecture of the operating system to be tested.

[0092] One feasible implementation is to use the output of the commands `cat / etc / os-release` and `uname -i` as the system version and architecture of the current operating system to be tested, and then replace the information corresponding to the system version and architecture fields in the address of the repository to be tested.

[0093] S403: Obtain the corresponding database file based on the address of the replaced repository to be tested.

[0094] In one implementation scenario, the metadata file can be obtained based on the address of the repository to be tested. The corresponding database file is then retrieved from the metadata file. Typically, the metadata file for each repository to be tested is unique.

[0095] It should be noted that since there can be multiple addresses of the repository to be tested, it is necessary to repeat S401-S403 to obtain the database files of all the repositories to be tested.

[0096] In summary, obtaining the addresses of multiple repositories corresponding to the operating system under test, and then using these repositories to obtain the corresponding database files, along with using these multiple database files for software package dependency detection, helps improve the accuracy of software package dependency detection.

[0097] Figure 5 A method flow for obtaining a database file provided in this application embodiment Figure 2 In one or more embodiments of this application, obtaining the corresponding database file based on the address of the replaced repository to be tested may include, for example: Figure 5 The steps shown are as follows:

[0098] S501: Based on the address of the replaced repository to be tested, remotely obtain the corresponding metadata file, and read the metadata file line by line to obtain the name of the database compressed file of the preset type.

[0099] In one implementation scenario, / repodata / repomd.xml can be appended to the address of the replaced repository to be tested, and the metadata file, i.e., the repomd.xml file, can be obtained remotely via the wget command.

[0100] The default database compressed file name can be determined according to the actual situation. It can be a primary database compressed file name in the form of: "repodata / 5c03df97d45b12d75e34c33f06ae1663720c2312514b11379d4c3620c44d6800-primary.sqlite.bz2".

[0101] S502: Obtain the corresponding database compressed file address based on the database compressed file name and the address of the repository to be tested.

[0102] In one implementation scenario, the database compressed file address can be obtained by appending / repodata / and the database compressed file name mentioned above to the address of the repository to be tested.

[0103] S503: Obtain the corresponding database compressed file based on the database compressed file address, and decompress the database compressed file to obtain the database file.

[0104] In one implementation scenario, the corresponding compressed database file can be remotely obtained via the wget command based on the database compressed file address, and then decompressed to obtain the database file. The database file can be a primary.sqlite database file. In some embodiments, obtaining the compressed database file remotely via the wget command can be completed in seconds, offering high efficiency.

[0105] It should be noted that since there can be multiple addresses of the repository to be tested, it is necessary to repeat S501-S503 to obtain the database files of all the repositories to be tested.

[0106] In some embodiments, if the detection of all package dependencies in all database files is completed, the metadata files and database compressed files can be cleaned up.

[0107] In summary, this application remotely obtains the corresponding metadata file through the address of the repository to be tested, and further remotely obtains the corresponding database compressed file. The database compressed file is then decompressed to obtain the database file. This eliminates the need to use createrepo to generate a package dependency database, which helps reduce the time for package dependency detection and improves detection efficiency.

[0108] Based on the above embodiments, a specific embodiment is provided below to describe in detail the process of detecting missing dependency files of the software package after obtaining the database file.

[0109] Figure 6 A flowchart illustrating a method for detecting missing dependency files in a software package, as provided in this application embodiment, is shown below. Figure 6 As shown, the method is as follows:

[0110] S601: Connect to any database file and obtain the first file name that exists in the dependency table of the database file but does not exist in the provider table of the database file.

[0111] S602: Determine whether each filename in the first filename carries a version requirement. If yes, proceed to step S603; otherwise, proceed to step S608.

[0112] S603: Perform string matching on the first file name carrying version requirements to obtain the target file name, the version range corresponding to the target file name, and the preceding file.

[0113] S604: Determine whether the prerequisite files have been installed on the operating system to be tested. If yes, proceed to step S605; otherwise, proceed to step S606.

[0114] S605: If the operating system to be tested has already installed the prerequisite files, determine whether the target file name exists in the provided table and whether the version entry in the corresponding row matches the version range. If yes, proceed to step S607; otherwise, proceed to step S608.

[0115] S606: If the operating system to be tested does not have the prerequisite files installed, determine whether the target file name exists in the provided table. If yes, proceed to step S607; otherwise, proceed to step S608.

[0116] S607: Test passed.

[0117] S608: Based on the name of the target file that failed the test, traverse and check the database files of other repositories to be tested. If all database files of the repositories to be tested fail the test, then the target file name is taken as the missing dependency file.

[0118] After obtaining the missing dependency files, dependency relationship detection results can be generated and output based on the dependency files. This application embodiment describes the process of detecting missing dependency files in a software package; the specific implementation principle can be found in the other embodiments described above, and will not be repeated here.

[0119] Figure 7 A schematic diagram of a software package dependency detection device provided in this application embodiment. Figure 1 .like Figure 7 As shown in the figure, this application embodiment provides a software package dependency detection device 700, which may include an acquisition module 701 and a processing module 702.

[0120] Module 701 is used to retrieve multiple database files, which contain dependency tables and provider tables.

[0121] Processing module 702 is used to traverse each database file and obtain at least one first file name corresponding to the traversed database file. The first file name is: the file name that exists in the dependency table of the database file but does not exist in the provider table of the database file.

[0122] The processing module 702 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 range, and after parsing, the target file name to be matched, the version range corresponding to the target file name, and the preceding file are obtained;

[0123] The processing module 702 is further configured to perform a matching operation on each target file name in the database file and the provision tables of other database files until the target file name is successfully matched with any database file or fails to match with all database files; wherein, the matching operation of the target file name with any provision table includes: if the operating system to be tested has installed the prerequisite files and the target file name exists in the provision table, then determining whether the version range matches the version information corresponding to the target file name in the provision table, so as to determine the matching result;

[0124] The processing module 702 is also used to generate and output dependency detection missing results based on the matching results corresponding to each target file name.

[0125] The device in this embodiment can be used to perform, for example... Figures 2 to 6 The method embodiments shown are similar in principle and technical effect, and will not be described again here.

[0126] Figure 8 A schematic diagram of a software package dependency detection device provided in this application embodiment. Figure 2 .like Figure 8As shown in the figure, this application provides a software package dependency detection device 800, which includes a processor 801 and a memory 802, wherein the processor 801 and the memory 802 are connected through a bus 803.

[0127] In the specific implementation process, the memory 802 stores code, and the processor 801 runs the code stored in the memory 802 to execute the method of the above method embodiment.

[0128] The specific implementation process of processor 801 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0129] In the above Figure 8 In the illustrated embodiments, it should be understood that the processor 801 can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0130] The memory 802 may include high-speed RAM memory, and may also include non-volatile memory (NVM), such as at least one disk storage.

[0131] Bus 803 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Bus 803 can be divided into address bus, data bus, control bus, etc. For ease of illustration, the bus 803 in the accompanying drawings of this application is not limited to only one bus or one type of bus.

[0132] This application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the above-described method embodiments.

[0133] The aforementioned computer-readable storage medium 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 storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to general-purpose or special-purpose computers.

[0134] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from 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 reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0135] This application provides a computer program product, including a computer program that, when executed by a processor, implements the methods provided in any of the embodiments described above.

[0136] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.

[0137] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.

Claims

1. A method for detecting software package dependencies, characterized in that, The method comprises the following steps: obtaining a plurality of database files, wherein the database files comprise a dependency table and a providing table; traversing each database file, and obtaining at least one first file name corresponding to the database file traversed, 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 providing table of the database file; if the first file name is a composite name, then the first file name is parsed, wherein the composite name is a file name carrying a version interval, and the parsing obtains a target file name to be matched, a version interval corresponding to the target file name, and a preposition file; for each target file name, performing a matching operation in the providing table of the database file and the providing table of other database files until the target file name is successfully matched with any database file or fails to be matched with all database files; wherein the matching operation of the target file name with any providing table comprises: if the preposition file has been installed in the operating system to be tested and the target file name exists in the providing table, then determining whether the version interval matches the version information corresponding to the target file name in the providing table to determine a matching result; generating a dependency relationship detection missing result according to the matching result corresponding to each target file name and outputting the dependency relationship detection missing result.

2. The method of claim 1, wherein, The matching operation further comprises: if the preposition file has not been installed in the operating system to be tested, then determining whether the target file name exists in the providing table.

3. The method of claim 1, wherein, The method further comprises: if the first file name is not a composite name, then taking the first file name as a target file name, and performing a matching operation in the providing table of other database files until the target file name is successfully matched with any database file or fails to be matched with all database files.

4. The method according to any one of claims 1 to 3, characterized in that, The generating of the dependency relationship detection missing result according to the matching result corresponding to each target file name and the outputting of the dependency relationship detection missing result comprise: obtaining, according to the matching result corresponding to each target file name, a target file name that fails to be matched with all database files, a version interval corresponding to the target file name, and a preposition file to generate a dependency file missing list; obtaining, according to the dependency file missing list, the name, version, and repository of a target software package that depends on the target file name to generate a software package list; obtaining a first software package that depends on the target software package according to the software package list; taking the first software package as a target software package, obtaining a 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; taking the dependency file missing list and the updated software package list as a dependency relationship detection missing result and outputting the dependency relationship detection missing result.

5. The method of claim 1, wherein, The obtaining of the plurality of database files comprises: obtaining addresses of a plurality of repositories to be tested, wherein the addresses of the repositories to be tested contain system version and architecture fields; obtaining the system version and architecture of the operating system to be tested, and replacing the information contained in the system version and architecture fields in the addresses of the repositories to be tested according to the system version and architecture of the operating system to be tested. According to the address of the replaced to-be-tested warehouse, a corresponding database file is obtained.

6. The method of claim 5, wherein, The obtaining of the corresponding database file according to the address of the replaced to-be-tested warehouse comprises: According to the address of the replaced to-be-tested warehouse, a corresponding metadata file is obtained remotely, and the metadata file is read line by line to obtain a database compressed file name of a preset type. According to the database compressed file name and the address of the to-be-tested warehouse, a corresponding database compressed file address is obtained. According to the database compressed file address, a corresponding database compressed file is obtained, and the database compressed file is decompressed to obtain a database file.

7. The method of claim 6, wherein, Further comprising: The metadata file and the database compressed file are cleaned up.

8. A software package dependency detection device characterized by comprising: Comprise: The obtaining module is configured to obtain a plurality of database files, and the database files include dependent tables and provided tables. The processing module is configured to traverse each database file, and obtain 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 dependent table of the database file but does not exist in a provided table of the database file. The processing module is further configured to, if the first file name is a composite name, parse the first file name, wherein the composite name is a file name carrying a version interval, and the parsing obtains a target file name to be matched, a version interval corresponding to the target file name, and a preposed file. The processing module is further configured to, for each target file name, perform a matching operation in the provided table of the database file and other database files until the target file name is successfully matched with any database file or fails to be matched with all database files, wherein the matching operation of the target file name with any provided table comprises: if the to-be-tested operating system has installed the preposed file and the target file name exists in the provided table, determining whether the version interval matches version information corresponding to the target file name in the provided table to determine a matching result. The processing module is further configured to generate a dependent relationship detection missing result according to the matching result corresponding to each target file name and output the dependent relationship detection missing result.

9. A software package dependency detection device comprising: The processor and the memory, the memory stores codes, and the processor executes the codes stored in the memory to execute the method in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method in any one of claims 1-7.

Citation Information

Patent Citations

  • Software package dependency relationship processing method, computing device and readable storage medium

    CN114879978A

  • Dependence package installation time analysis method and device, equipment and storage medium

    CN116028108A