Software package installation method and software package installation apparatus
By constructing a package index tree and a dependency database, the problem of inefficiency in package management tools is solved, enabling fast and accurate package installation and dependency resolution, thus improving the overall efficiency of package management.
Patent Information
- Application Number
- CN202510375922.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-27
- Publication Date
- 2026-05-15
- Estimated Expiration
- 2045-03-27
AI Technical Summary
In the existing technology, the massive package management tools for software repositories cannot effectively solve the technical problems of software repositories. The existing technology cannot effectively solve the problems of low efficiency in package management, performance bottlenecks, insufficient concurrent processing capabilities, repeated parsing, and low resource utilization efficiency.
By constructing a package index tree and a dependency database, and utilizing key-value storage features to store package attribute information and dependency relationship data, a composite index is built to reduce repeated database queries, improve dependency resolution efficiency, and dynamically adjust the resolution strategy to cope with dynamic changes in package dependencies.
It improves the efficiency of package installation, avoids repeated searches, enhances the flexibility and adaptability of dependency resolution, optimizes resolution speed, and reduces unnecessary computational and storage overhead.
Smart Images

Figure CN120215967B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software management technology, and in particular to a software package installation method and a software package installation apparatus. Background Technology
[0002] With the rapid development of technology, software types are becoming increasingly diverse. In this context, software package management tools are typically used to manage software package installation, upgrades, deletion, and uninstallation on the terminal.
[0003] In related technologies, a software package management tool is used to pre-obtain the attribute information of the software packages supported by the terminal, and a software repository is built based on this attribute information. If a software package installation request is detected in the software package management tool, the attribute information of the software to be installed is queried from the software repository, the corresponding software package installation package is downloaded from the source database, and the software package installation package is parsed to complete the software package installation.
[0004] However, the software repositories in related technologies contain massive amounts of software package attribute information, resulting in low software package installation efficiency. Summary of the Invention
[0005] Therefore, it is necessary to provide a software package installation method and device that can reduce the burden of local database caching and thus improve the efficiency of software package installation, in order to address the above-mentioned technical problems.
[0006] In a first aspect, this application provides a software package installation method, applied to a terminal device, the terminal device having a software package management tool deployed thereon, the method comprising:
[0007] In response to a package installation request entered in the package management tool, obtain the attribute information of the package to be installed;
[0008] Query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages;
[0009] If the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database; the dependency database stores key-value pairs based on each package; each key-value pair of a package includes the package's attribute information and a list of dependent packages;
[0010] Based on the list of dependent packages, perform the installation steps for the software to be installed.
[0011] In one embodiment, based on the package installation request entered in the package management tool, the attribute information of the package to be installed is obtained, including:
[0012] Based on the package installation request entered in the package management tool, obtain the installation information of the package to be installed; the installation information includes the name of the software to be installed, and / or, the package identifier;
[0013] Based on the installation information, the identifier and version number of the software package to be installed are determined from the preset mapping table; the preset mapping table includes the correspondence between the name, identifier and version number of each software package.
[0014] The identifier and version number of the package to be installed are combined to obtain the attribute information of the package to be installed.
[0015] In one embodiment, based on a list of dependent packages, the installation steps for the software to be installed are performed, including:
[0016] Obtain the set of downloadable software packages for the terminal device;
[0017] If the download package set includes all the dependent packages in the dependent package list, then the package to be installed is retrieved from the source database and downloaded.
[0018] Otherwise, the downloaded package set and the list of dependent packages are compared to identify any missing dependent packages in the downloaded package set, and the installation information for each dependent package is displayed; the installation information is used to instruct the installation of each dependent package to complete the package installation.
[0019] In one embodiment, the method further includes:
[0020] For any dependent software package, in response to a dependency package installation request for that dependent software package, the dependency package installation request is parsed;
[0021] If the dependency package installation request contains an identifier for the dependency package but not a version number for the dependency package, multiple candidate dependency packages that match the identifier of the dependency package are identified from the source database.
[0022] The dependency package with the latest version or the highest frequency of use among multiple candidate dependency packages is determined as the dependency package corresponding to the dependency package installation request.
[0023] In one embodiment, the method further includes:
[0024] In response to a trigger request from the package management tool, obtain the identifier, version number, and list of dependent packages for each package;
[0025] The identifier and version number corresponding to the same software package are combined to obtain the key of each software package; and the dependency data package of each software package is used as the value of each software package.
[0026] Build a package index tree based on the keys of each package; and build a dependency database based on the keys and values of each package.
[0027] In one embodiment, a package index tree is constructed based on the keys of each package, including:
[0028] The keys of each software package are used to define the attribute information of each software package;
[0029] The attribute information of each software package is used as leaf nodes, and a software package index tree is created based on preset index node creation conditions.
[0030] In one embodiment, a dependency database is constructed based on the keys and values of each software package, including:
[0031] Combine the keys and values corresponding to the same software package to obtain key-value pairs for each software package;
[0032] The key-value pairs of each software package are stored in a pre-defined hash table to obtain a dependency database.
[0033] In one embodiment, the method further includes:
[0034] In response to an update request for the dependency database, obtain the package update timestamp from the source database;
[0035] By comparing the package update timestamp with the package acquisition timestamp in the dependency database, it can be determined whether the dependency database needs to be updated.
[0036] If an update is needed, the contents of the dependency database are compared with the contents of the source database to obtain the updated content, and the dependency database is updated accordingly.
[0037] In one embodiment, updating the dependency database based on the updated content includes:
[0038] During the update process of the dependency database, obtain the storage capacity and number of storage entries of the dependency database;
[0039] If the storage capacity reaches a preset capacity threshold, and / or the number of storage entries reaches a preset number threshold, then based on the information retrieval time of each key-value pair in the dependency database, the key-value pair furthest from the current time will be deleted one by one from the dependency database until the preset capacity threshold and / or the preset number threshold are met.
[0040] Secondly, this application also provides a software package installation apparatus, comprising:
[0041] The acquisition module is used to obtain the attribute information of the package to be installed in response to the package installation request entered in the package management tool;
[0042] The query module is used to query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages.
[0043] The determination module is used to determine the list of dependent packages of the package to be installed from the dependency database, given that the attribute information of the package to be installed exists in the package index tree; the dependency database stores key-value pairs based on each package; each key-value pair of a package includes the package's attribute information and a list of dependent packages;
[0044] The installation module is used to perform the installation steps for the software to be installed based on a list of dependent packages.
[0045] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of the method in any of the embodiments of the first aspect described above.
[0046] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method in any of the embodiments of the first aspect described above.
[0047] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the method in any of the embodiments of the first aspect described above.
[0048] The aforementioned software package installation method and apparatus, based on a software package installation request input into a software package management tool, obtain the attribute information of the software package to be installed, and then query the attribute information of the software package to be installed in a software package index tree. Next, if the attribute information of the software package to be installed exists in the software package index tree, a list of dependent software packages of the software package to be installed is determined from a dependency database. Finally, based on the list of dependent software packages, the installation steps of the software to be installed are executed. The leaf nodes of the software package index tree contain the attribute information of multiple software packages; the dependency database stores key-value pairs based on each software package; each key-value pair of a software package includes the attribute information of the software package and a list of dependent software packages. In this method, the software package index tree constructed based on the attribute information of each software package stores the attribute information of each software package hierarchically, supporting top-down layer-by-layer querying of the index tree of the software package to be installed, avoiding repeated searches, improving the retrieval efficiency of the software package to be installed, and thus obtaining query results quickly and accurately. Furthermore, if the query result shows that the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database based on the attribute information of the package to be installed. Since the attribute information of each package and the list of dependent packages in the dependency database are stored in a key-value pair data structure, the attribute information of the package to be installed is equivalent to the key of the package to be installed. In this case, the list of dependent packages of the package to be installed can be quickly determined from the dependency database based on the key of the package to be installed, and the package can be installed according to the list of dependent packages of the package to be installed, thereby improving the efficiency of package installation. Attached Figure Description
[0049] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 This is an application environment diagram of a software package installation method in one embodiment;
[0051] Figure 2 This is a flowchart illustrating a software package installation method in one embodiment;
[0052] Figure 3 This is a flowchart illustrating the steps for obtaining software package installation information in one embodiment;
[0053] Figure 4 This is a flowchart illustrating a software package installation method in another embodiment;
[0054] Figure 5 This is a flowchart illustrating the dependent software package acquisition step in one embodiment;
[0055] Figure 6 This is a flowchart illustrating the database construction steps in one embodiment;
[0056] Figure 7 This is a flowchart illustrating the database update steps in one embodiment;
[0057] Figure 8 This is a structural block diagram of a software package installation device in one embodiment;
[0058] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0060] The software package installation method provided in this application embodiment can be applied to, for example, Figure 1 In the application environment shown, terminal device 102 communicates with server 104 via a network. The data storage system can store the data that server 104 needs to process, such as the massive software packages supported by the operating system corresponding to terminal device 102. The data storage system can be integrated on server 104 or placed on the cloud or other network servers. Terminal device 102 can be, but is not limited to, various personal computers, laptops, smartphones, tablets, IoT devices, and portable wearable devices. IoT devices can be smart speakers, smart TVs, smart air conditioners, smart in-vehicle devices, projection devices, etc. Portable wearable devices can be smartwatches, smart bracelets, head-mounted devices, etc. Head-mounted devices can be virtual reality (VR) devices, augmented reality (AR) devices, smart glasses, etc. Server 104 can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0061] In the field of internet technology, a software package is a collection that bundles software, its dependencies, configuration files, and other related files together, enabling the software to be easily distributed and installed. In this context, software package management tools are typically used to manage the installation, upgrades, deletion, and uninstallation of software packages.
[0062] Package management tools in related technologies typically rely on centralized software repositories to retrieve metadata and dependencies of the packages to be processed. Package dependency resolution is a crucial step in package management, which usually involves checking all relevant packages in the software repository to determine all dependencies required to install or update a package, ensuring that all dependencies are satisfied.
[0063] However, the software repositories in related technologies contain massive amounts of package attribute information, resulting in low package installation efficiency. In addition, existing technologies may also have the following problems: (1) Performance bottleneck. When dealing with a large number of packages or complex dependencies, performance bottlenecks may be encountered, resulting in slow dependency resolution. (2) Insufficient concurrent processing capability: Many existing systems perform poorly in concurrent environments, especially when multiple users or processes perform package management operations simultaneously. (3) Duplicate resolution: Without an effective caching mechanism, package management tools may repeatedly resolve the same dependencies, wasting computing resources. (4) Data consistency problem: In concurrent operations, data inconsistency may occur, leading to repeated execution of transactions, especially when dependencies are updated. (5) Low resource utilization efficiency. Existing dependency resolution methods may not fully utilize the multi-core and high-speed storage characteristics of modern computer hardware.
[0064] To address the aforementioned issues, this application provides a software package installation method. It utilizes key-value storage to store package attribute information and dependency relationship data, constructs a composite index for package name and version number to improve dependency data retrieval efficiency, designs a dependency relationship caching index tree to store attribute information for each package, reducing redundant database queries and improving dependency resolution efficiency, and dynamically adjusts the dependency resolution strategy based on actual package installation and updates to enhance flexibility and adaptability, address dynamic changes in package dependencies, further optimize resolution speed, and reduce unnecessary computational and storage overhead.
[0065] 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.
[0066] In one exemplary embodiment, such as Figure 2 As shown, a software package installation method is provided, applied to a terminal device. The terminal device has a software package management tool deployed on it. The method includes:
[0067] S201, in response to a package installation request entered in the package management tool, obtain the attribute information of the package to be installed.
[0068] Package management tools, in this context, refer to tools used for installing, updating, deleting, and managing software packages. In practical applications, package management tools are deployed on terminal devices, providing detailed package management functions through a command-line interface displayed on the terminal device.
[0069] Enter the package installation information in the command-line interface of the package management tool to trigger a package installation request. Based on the package installation request, determine the attribute information of the package to be installed. The attribute information refers to the index information required to describe the package installation, which is used to uniquely identify the package to be installed, such as a composite index obtained by combining the package's identifier ID and version number.
[0070] Taking the attribute information as a combination of identifier ID and version number as an example, the package installation request can carry the identifier ID of the package to be installed. In this case, the latest version number of the software to be installed is determined based on the identifier ID, and the identifier ID and the latest version number are combined to obtain the attribute information of the package to be installed.
[0071] In another implementation scenario, the package installation request carries the attribute information of the package to be installed. In this case, the package installation request can be directly parsed to obtain the attribute information of the package to be installed.
[0072] S202, query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages.
[0073] The package index tree refers to a tree-like structure with multiple branches, consisting of at least one layer of non-leaf nodes (root node and intermediate nodes) and one layer of leaf nodes from top to bottom, such as a B+ tree or a binary tree. Multiple packages refer to the set of software packages supported by the operating system of the terminal device. In this embodiment, the number of leaf nodes in the package index tree is the same as the number of packages, and each leaf node stores the attribute information of one package. The root node and intermediate nodes both store pointers to their corresponding child nodes, used to index lower-level nodes.
[0074] Based on the tree structure of the package index tree, the search proceeds from top to bottom until the bottom layer of the package index tree, namely the leaf node layer, is reached, and it is determined whether there is a leaf node that contains the attribute information of the package to be installed.
[0075] S203, if the attribute information of the package to be installed exists in the package index tree, determine the list of dependent packages of the package to be installed from the dependency database; the dependency database stores key-value pairs based on each package; each key-value pair of a package includes the package's attribute information and a list of dependent packages.
[0076] The dependency database refers to a cached database stored locally, which stores key-value pairs based on the attribute information of each software package and the list of dependent packages. Each key-value pair includes the key (attribute information) of the software package and the value (list of dependent packages). The list of dependent packages is a combination of the identifiers of multiple dependent packages.
[0077] The attribute information of the package to be installed is used to uniquely identify the package, and the format of the attribute information of the package to be installed is consistent with the attribute information of the package represented by each leaf node in the package index tree. For example, if the leaf node stores a combination of the package identifier ID and version number, then the attribute information of the package to be installed includes the combination of the package identifier ID and version number.
[0078] If the package index tree contains the attribute information of the package to be installed, it means that the current environment has the conditions to download and install the software. Then, the key-value pairs that match the attribute information of the software to be installed are retrieved from the dependency database, and the list of dependent packages of the key-value pairs is used as the list of dependent packages of the package to be installed.
[0079] If the package index tree does not contain the attribute information for the package to be installed, it means that the current environment does not have the conditions for downloading and installing the software, and an indication message indicating that the current environment does not support the package to be installed is generated.
[0080] S204, based on the list of dependent packages, execute the installation steps for the software to be installed.
[0081] Obtaining a list of dependent packages typically involves multiple dependent packages. The attribute information of each dependent package is queried from the package index tree. If the package index tree includes the attribute information of each dependent package, it is determined that the current environment supports the download and installation of the package to be installed. In this case, the package to be installed and each dependent package are retrieved and downloaded from the source database. Otherwise, if the package index tree does not contain the attribute information of at least one dependent package, an indication message is generated that the current environment does not support the package to be installed.
[0082] In this embodiment, based on the package installation request input in the package management tool, the attribute information of the package to be installed is obtained, and then the attribute information of the package to be installed is queried in the package index tree. Next, if the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database. Finally, based on the list of dependent packages, the installation steps of the software to be installed are executed. The leaf nodes of the package index tree contain the attribute information of multiple packages; the dependency database stores key-value pairs based on each package; each key-value pair includes the package's attribute information and a list of dependent packages. In this method, the package index tree constructed based on the attribute information of each package stores the attribute information of each package hierarchically, supporting top-down layer-by-layer querying of the index tree of the package to be installed, avoiding repeated searches, improving the retrieval efficiency of the package to be installed, and thus obtaining query results quickly and accurately. Furthermore, if the query result shows that the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database based on the attribute information of the package to be installed. Since the attribute information of each package and the list of dependent packages in the dependency database are stored in a key-value pair data structure, the attribute information of the package to be installed is equivalent to the key of the package to be installed. In this case, the list of dependent packages of the package to be installed can be quickly determined from the dependency database based on the key of the package to be installed, and the package can be installed according to the list of dependent packages of the package to be installed, thereby improving the efficiency of package installation.
[0083] In an exemplary embodiment, a feasible method is provided for the aforementioned step S201, "obtaining the attribute information of the package to be installed based on the package installation request entered in the package management tool," such as... Figure 3 As shown, it includes the following steps:
[0084] S301, based on the package installation request entered in the package management tool, obtain the installation information of the package to be installed; the installation information includes the name of the software to be installed, and / or, the package identifier.
[0085] The package installation request carries the name of the software to be installed and / or the package identifier. The package installation request is parsed to extract the name of the software to be installed and / or the package identifier.
[0086] In practical applications, software package installation requests can also carry other descriptive information about the software to be installed, such as its version number. For example, a software package installation request may carry the software name and version number, or the package identifier and version number, or the name, identifier, and version number of the software to be installed.
[0087] S302, based on the installation information, determine the identifier and version number of the software package to be installed from the preset mapping table; the preset mapping table includes the correspondence between the name, identifier and version number of each software package.
[0088] A preset mapping table is cached locally. This table contains multiple mapping entries, each including the package name, identifier, and version number. Therefore, given the name of the software to be installed and / or the package identifier, the mapping relationship matching the installation information can be directly determined from the preset mapping table, thus obtaining the identifier and version number of the package to be installed.
[0089] S303 combines the identifier and version number of the package to be installed to obtain the attribute information of the package to be installed.
[0090] The identifier and version number of the package to be installed are combined to obtain the composite index key of the package to be installed, which is also the attribute information of the package to be installed.
[0091] In this embodiment, the correspondence between each software package name, identifier, and version number is treated as a mapping relationship. Multiple mapping relationships corresponding to each software package are pre-stored in a mapping table. This allows for quick retrieval of the mapping relationship of the software package to be installed from the mapping table based on the software name or identifier of the software package to be installed. The identifier and version number of the software package to be installed are then combined to obtain the attribute information of the software package to be installed, ensuring the uniqueness and accuracy of the attribute information of the software package to be installed.
[0092] In an exemplary embodiment, one possible implementation of the aforementioned step S204, "based on the list of dependent packages, perform the installation step of the software to be installed," is provided, such as... Figure 4 As shown, it includes the following steps:
[0093] S401, Obtain the set of downloadable software packages for the terminal device.
[0094] The downloaded software package set includes attribute information of the software packages already installed on the terminal device. The terminal device can dynamically maintain a downloaded software package set, storing the attribute information of each downloaded software package into the downloaded software package set.
[0095] Alternatively, the currently installed downloaded software packages on the terminal device can be retrieved from the local cache database, and the attribute information of each downloaded software package can be summarized to obtain a set of downloaded software packages.
[0096] S402, if the download package set includes each dependent package in the dependent package list, then retrieve the package to be installed from the source database and download the package to be installed.
[0097] The downloaded package set is compared with the dependent package list to determine whether the packages in the downloaded package set completely cover each dependent package in the dependent package list. If so, the metadata of the package to be installed is pulled from the source database, and the pulled package is downloaded and installed locally.
[0098] S403, otherwise, compare the downloaded package set and the dependent package list to determine the missing dependent packages in the downloaded package set and display the installation information for each dependent package; the installation information is used to instruct the installation of each dependent package to complete the package installation.
[0099] If the packages in the downloaded package set do not completely cover all the dependent packages in the dependent package list, then the dependent packages that are in both the dependent package list and the downloaded package set are identified as missing dependent packages, and their installation information is displayed in the visual editing interface of the terminal device. Further, if a continue installation instruction is received regarding the installation information of each missing dependent package, then each dependent package and the package to be installed are retrieved from the source database, and the retrieved missing dependent packages and the package to be installed are downloaded to the local terminal device in sequence. Conversely, if a stop installation instruction is received regarding the installation information of each missing dependent package, then the package installation process is aborted, and there is no need to retrieve the dependent packages from the source database.
[0100] Optionally, the installation information of each missing dependency package can be displayed in batches to instruct the batch installation of each dependency software to complete the package installation, or the installation information of each dependency package can be displayed sequentially to instruct the individual installation of each dependency software to complete the package installation.
[0101] In this embodiment, the downloaded package set is compared with the dependent package list. If the downloaded package set does not cover all the dependent packages of the package to be installed, the missing dependent packages required for the installation package are determined, and the missing dependent packages are instructed to be installed to complete the package installation. This is equivalent to showing the terminal device user the underlying installation management logic of the package installation, providing the choice of whether to install the package, and improving the package installation experience.
[0102] Next, we will describe one possible way to pull missing dependency packages when the downloaded package set does not cover the dependency packages in the dependency package list. In an exemplary embodiment, such as Figure 5 As shown, the method includes the following steps:
[0103] S501, for any dependent software package, in response to a dependency package installation request for the dependent software package, parse the dependency package installation request.
[0104] It is important to emphasize that while dependency package installation requests carry the identifiers of dependent software packages, multiple versions of the same identifier can exist. This means that the specific dependent software package cannot be identified solely based on its identifier. Therefore, in this embodiment, the dependency package installation request is parsed to determine the version field within the request, and subsequently, the content corresponding to the version field—namely, the version number of the dependent software package.
[0105] S502, if the dependency package installation request contains an identifier for the dependency package but does not contain a version number for the dependency package, determine from the source database multiple candidate dependency packages that match the identifier of the dependency package.
[0106] If the version number of the dependent package is not found in the dependency package installation request, multiple candidate dependent packages matching the identifier are determined from the source database based on the identifier of the dependent package. Then, according to the preset pull strategy, the dependent package corresponding to the dependency package installation request is determined from the multiple candidate dependent packages.
[0107] S503 identifies the latest version or the most frequently used dependency package among multiple candidate dependency packages as the dependency package corresponding to the dependency package installation request.
[0108] Optionally, if the strategy for determining the dependency package is to use the latest version, then the version numbers of each candidate dependency package are compared to determine the latest version of the candidate dependency package, which is then used as the dependency package corresponding to the dependency package installation request.
[0109] Optionally, if the strategy for determining the dependency package is based on the highest frequency of use, then the frequency of use of each candidate dependency package is compared, and the candidate dependency package with the highest frequency of use is determined as the dependency package corresponding to the dependency package installation request.
[0110] If the dependency package installation request contains the identifier and version number of the dependency package, the dependency package is directly determined from the source database based on the dependency package identifier and version number.
[0111] In this embodiment, when the dependency package installation request contains an identifier of the dependency package but not a version number of the dependency package, the scope of the dependency package is initially screened based on the identifier of the dependency package. Then, according to a preset determination strategy, the dependency package corresponding to the dependency package installation request is accurately determined from the scope. The determination basis is clear and reliable, which can improve the rationality of the finally determined dependency package to a certain extent.
[0112] It should be understood that the software package installation process is based on a locally cached software package index tree and dependency database. The foregoing embodiments have described the software package installation process; the following will describe the process of building the software package index tree and dependency database used during software package installation.
[0113] In one exemplary embodiment, such as Figure 6 As shown, the method also includes the following steps:
[0114] S601, in response to a trigger request for the package management tool, obtains the identifier, version number, and list of dependent packages for each package.
[0115] The source database includes all software packages supported by the operating system corresponding to the terminal device, and these packages are upgraded periodically. In response to trigger requests from the package management tool, the system retrieves the identifier, version number, and list of dependent data packages for each package from the source database.
[0116] S602, combine the identifier and version number corresponding to the same software package to obtain the key of each software package; and use the dependency data package of each software package as the value of each software package.
[0117] For any software package, combine the package's identifier and version number to obtain the package's key, and combine the identifiers of each dependent data package to obtain the package's value.
[0118] S603, construct a package index tree based on the keys of each package; and construct a dependency database based on the keys and values of each package.
[0119] For any given software package, the package key includes the package identifier and the package version number, expressed in numeric form. The package value includes the identifiers of the packages that depend on the package, also expressed in numeric form.
[0120] When constructing a package index tree, you can choose to use the keys of each package as leaf nodes, group different versions of packages corresponding to the same package identifier into a group, group each leaf node, determine the parent node corresponding to each leaf node, and then construct the package index tree based on the reference relationship between the parent node and the leaf node.
[0121] For example, constructing a package index tree based on the keys of each package includes: determining the keys of each package as the attribute information of each package; using the attribute information of each package as leaf nodes, and creating a package index tree based on preset index node creation conditions.
[0122] The index node creation condition refers to the conditions for generating the parent node (index node) corresponding to the leaf node, such as the number of child nodes corresponding to an index node. Based on the index node creation condition, the leaf nodes are grouped to obtain the parent nodes corresponding to each leaf node. Then, if the parent nodes satisfy the index node creation condition, the parent nodes are further grouped to determine the parent nodes corresponding to each parent node, until the highest-level node no longer satisfies the index node creation condition, thus obtaining the package index tree.
[0123] Taking an index node with 8 child nodes as an example, if there are 80 leaf nodes, then the 80 leaf nodes are divided into 10 groups of a maximum of 8 leaf nodes each. Each group of leaf nodes corresponds to a parent node, meaning there are 10 parent nodes for each leaf node. Since the number of parent nodes also meets the index node creation requirements, the parent nodes need to be further divided, for example, by grouping the 10 parent nodes into 2 groups, and constructing the parent index node corresponding to each group of parent nodes. Thus, the package index tree has three levels: the first level is the root node level, including 2 root nodes (parent index nodes), each root node corresponding to 5 intermediate nodes; the second level is the intermediate node level, including 10 intermediate nodes (parent nodes), each intermediate node corresponding to 10 leaf nodes; and the third level is the leaf node level, including 80 leaf nodes.
[0124] In this embodiment, the attribute information of each software package is used as a leaf node. Based on the preset index node creation conditions, a software package index tree is created to hierarchically represent the attribute information of each software package, thereby improving the efficiency of querying software package attribute information based on the software package index tree.
[0125] For example, a dependency database is constructed based on the keys and values of each software package, including: combining the keys and values corresponding to the same software package to obtain key-value pairs for each software package; and storing the key-value pairs of each software package in a preset hash table to obtain the dependency database.
[0126] The keys and values corresponding to the same software package are combined to obtain the key-value pairs of the software package. The key-value pairs of the software packages are stored as a set of cache entries in a preset hash table. The above steps are repeated for different software packages in the source database to obtain the dependency database.
[0127] It is important to emphasize that the dependency database is built only once when the package management tool is first triggered, and can be continuously updated afterward.
[0128] In this embodiment, the keys of each software package are obtained based on the identifier and version number of the software package, and a software package index tree is constructed to support the query of the software package to be installed; and a dependency relationship database is constructed based on the identifier, version number and dependent software packages of the software package, so as to quickly obtain the dependent software packages of the software package to be installed when the software package to be installed is found in the software package index tree.
[0129] As can be seen from the foregoing embodiments, the information about the software packages stored in the source database is the basis for constructing the software package index tree and the dependency database. However, in practical applications, the information in the source database may be updated, in which case it is necessary to synchronize and update the dependency database. In an exemplary embodiment, such as... Figure 7 As shown, the method also includes the following steps:
[0130] S701, in response to an update request for the dependency database, obtains the package update timestamp from the source database.
[0131] The source database stores information about multiple software packages supported by the operating system corresponding to the terminal device. Operating system developers can perform update operations on the source database, such as adding, deleting, or replacing software packages. Each time a software package in the source database is updated, the update time is recorded and designated as a software package update timestamp. It is important to emphasize that in this embodiment, the software package update timestamp represents the update status of the entire source database; that is, the source database corresponds to one software package update timestamp.
[0132] Update requests to the dependency database can occur after the package management tool was initially triggered to create the dependency database, and then triggered again by the package management tool. In response to an update request to the dependency database, the time of the last package update in the source database is retrieved to obtain the package update timestamp.
[0133] S702 obtains the timestamp by comparing the package update timestamp with the information in the dependency database, and determines whether the dependency database needs to be updated.
[0134] The information retrieval timestamp of a dependency database refers to the time when the latest content change occurred in the dependency database, and each dependency database corresponds to an information retrieval timestamp.
[0135] The package update timestamp and the dependency database information retrieval timestamp are compared to determine if the source database's package update timestamp is later than the dependency database's information retrieval timestamp. If so, it indicates that the source database has changed after the dependency database was created or updated, and the dependency database needs to be updated. Otherwise, no update to the dependency database is required.
[0136] S703 If an update is required, the contents of the dependency database are compared with the contents of the source database to obtain the updated content, and the dependency database is updated according to the updated content.
[0137] Optionally, the changes involve adding new software packages to the source database, meaning the information for these new packages exists in the source database but not in the dependency database. The process involves retrieving the attribute information and dependent package list of the new package, constructing key-value pairs for the new package, adding these pairs to the dependency database, updating the dependency database, and simultaneously adding the key of the new package as a leaf node to the package index tree, thus updating the package index tree synchronously.
[0138] Optionally, the change involves deleting packages from the dependency database. This means the information for the deleted package is not in the source database but exists in the dependency database. The deleted package is removed from the dependency database, its contents are updated, and the corresponding leaf node in the package index tree is deleted, thus updating the package index tree synchronously.
[0139] In this embodiment of the application, in response to an update request for the dependency database, if the software package update timestamp of the source database is later than the software package acquisition timestamp of the dependency database, the software package information in the dependency database is updated in a timely manner according to the changes, so as to ensure the consistency between the source database and the dependency database.
[0140] The dependency database is cached locally on the terminal device, and its memory space is typically pre-set. In this case, the dependency database may become full, necessitating adjustments to its storage content. In one exemplary embodiment, updating the dependency database based on updated content includes:
[0141] During the update process of the dependency database, the storage capacity and number of stored entries of the dependency database are obtained. If the storage capacity reaches a preset capacity threshold and / or the number of stored entries reaches a preset number threshold, the key-value pairs that are furthest from the current time are deleted one by one from the dependency database according to the information retrieval time of each key-value pair in the dependency database, until the preset capacity threshold and / or the preset number threshold are met.
[0142] The dependency database includes key-value pairs corresponding to multiple software packages, as well as the retrieval time for each key-value pair, representing the moment when the attribute information and list of dependent software packages for that package were retrieved from the source database. The preset capacity threshold refers to the maximum storage capacity pre-set for the dependency database; the preset quantity threshold refers to the maximum quantity pre-set for the dependency database.
[0143] During the process of storing new key-value pairs into the dependency database, the storage capacity and number of stored entries of the dependency database are monitored in real time. If the storage capacity reaches a preset capacity threshold, it means that the dependency database can no longer store new key-value pairs. In this case, the key-value pairs that are furthest from the current time are deleted from the dependency database one by one until the preset capacity threshold is met. If the number of stored entries reaches a preset number threshold, it means that the dependency database can no longer store new key-value pairs. In this case, the key-value pairs that are furthest from the current time are deleted from the dependency database one by one until the preset number threshold is met.
[0144] In this embodiment, the storage capacity of the dependency database is quantitatively evaluated from two dimensions: storage capacity and storage quantity. When the storage capacity reaches a preset capacity threshold and / or the number of storage entries reaches a preset quantity threshold, the key-value pairs that are furthest from the current time are deleted one by one from the dependency database until the preset capacity threshold and / or the preset quantity threshold are met. This ensures the storage space of the dependency database while ensuring the validity of the content stored in the dependency database.
[0145] In one exemplary embodiment, a software package installation method is provided, comprising the following steps:
[0146] (1) In response to a trigger request for the package management tool, obtain the identifier, version number and dependency package list of each package.
[0147] (2) Combine the identifier and version number corresponding to the same software package to obtain the key of each software package; and use the dependency data package of each software package as the value of each software package.
[0148] (3) Determine the key of each software package as the attribute information of each software package; use the attribute information of each software package as the leaf node, and create a software package index tree based on the preset index node creation conditions.
[0149] (4) Combine the keys and values corresponding to the same software package to obtain key-value pairs for each software package.
[0150] (5) Store the key-value pairs of each software package into a preset hash table to obtain a dependency database.
[0151] (6) In response to a package installation request entered in the package management tool, obtain the installation information of the package to be installed; the installation information includes the name of the software to be installed, and / or, the package identifier.
[0152] (7) Based on the installation information, determine the identifier and version number of the software package to be installed from the preset mapping table.
[0153] The preset mapping table includes the correspondence between the name, identifier, and version number of each software package.
[0154] (8) Combine the identifier of the package to be installed and the version number of the package to be installed to obtain the attribute information of the package to be installed.
[0155] (9) Query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages.
[0156] (10) If the attribute information of the package to be installed exists in the package index tree, determine the list of dependent packages of the package to be installed from the dependency database.
[0157] (11) Obtain the set of download packages for the terminal device.
[0158] (12) If the download package set includes each of the dependent packages in the dependent package list, then pull the package to be installed from the source database and download the package to be installed.
[0159] (13) Otherwise, compare the downloaded package set and the dependent package list to determine the missing dependent packages in the downloaded package set and display the installation information of each dependent package; the installation information is used to instruct the installation of each dependent package to complete the package installation.
[0160] (14) For any missing dependency package in the download package set, in response to the dependency package installation request for the dependency package, parse the dependency package installation request.
[0161] (15) If there is an identifier of the dependent package in the dependency package installation request but no version number of the dependent package, determine multiple candidate dependent packages that match the identifier of the dependent package from the source database; determine the dependent package with the latest version or the most frequent use among the multiple candidate dependent packages as the dependent package corresponding to the dependency package installation request.
[0162] (16) In response to an update request for the dependency database, obtain the package update timestamp of the source database.
[0163] (17) Obtain the timestamp by comparing the package update timestamp and the information in the dependency database, and determine whether the dependency database needs to be updated.
[0164] (18) If an update is required, the contents of the dependency database are compared with the contents of the source database to obtain the updated content, and the dependency database is updated according to the updated content.
[0165] (19) During the update process of the dependency database, obtain the storage capacity and number of storage entries of the dependency database.
[0166] (20) If the storage capacity reaches the preset capacity threshold and / or the number of storage entries reaches the preset number threshold, then based on the information retrieval time of each key-value pair in the dependency relation database, the key-value pair that is furthest from the current time will be deleted one by one from the dependency relation database until the preset capacity threshold and / or the preset number threshold are met.
[0167] In this embodiment, a package index tree is constructed based on the attribute information of each package, and the attribute information of each package is stored hierarchically. This supports querying the index tree of the package to be installed from top to bottom, avoiding repeated searches, improving the retrieval efficiency of the package to be installed, and thus obtaining query results quickly and accurately. Furthermore, if the query result shows that the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database based on the attribute information of the package to be installed. Since the attribute information of each package and the list of dependent packages in the dependency database are stored in a key-value pair data structure, the attribute information of the package to be installed is equivalent to the key of the package to be installed. In this case, the list of dependent packages of the package to be installed can be quickly determined from the dependency database based on the key of the package to be installed, and the package can be installed according to the list of dependent packages, improving the package installation efficiency.
[0168] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0169] Based on the same inventive concept, this application also provides a software package installation apparatus for implementing the software package installation method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more software package installation apparatus embodiments provided below can be found in the limitations of the software package installation method described above, and will not be repeated here.
[0170] In one exemplary embodiment, such as Figure 8 As shown, a software package installation apparatus is provided, including: an acquisition module 801, a query module 802, a determination module 803, and an installation module 804, wherein:
[0171] The acquisition module 801 is used to obtain the attribute information of the package to be installed in response to the package installation request entered in the package management tool;
[0172] The query module 802 is used to query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages.
[0173] The determination module 803 is used to determine the list of dependent packages of the package to be installed from the dependency database when the attribute information of the package to be installed exists in the package index tree; the dependency database stores key-value pairs based on each package; each key-value pair of the package includes the package's attribute information and a list of dependent packages;
[0174] Install module 804 is used to perform installation steps for the software to be installed based on a list of dependent packages.
[0175] In an exemplary embodiment, the acquisition module 801 includes: an installation information acquisition unit, a table query unit, and an identification version number combination unit, wherein:
[0176] The installation information acquisition unit is used to acquire the installation information of the software package to be installed in response to the software package installation request entered in the software package management tool; the installation information includes the name of the software to be installed, and / or, the software package identifier;
[0177] The table query unit is used to determine the identifier and version number of the software package to be installed from a preset mapping table based on the installation information; the preset mapping table includes the correspondence between the name, identifier and version number of each software package;
[0178] The version number combination unit is used to combine the identifier of the package to be installed and the version number of the package to be installed to obtain the attribute information of the package to be installed.
[0179] In an exemplary embodiment, the installation module 804 includes: a collection acquisition unit, a package retrieval unit, and a package comparison unit, wherein:
[0180] The set acquisition unit is used to acquire the set of downloaded software packages from the terminal device.
[0181] The package retrieval unit is used to retrieve the package to be installed from the source database and download the package to be installed when the package download set includes each dependent package in the dependent package list;
[0182] The package comparison unit is used to compare the downloaded package set with the dependent package list when the dependent packages in the downloaded package set are not included, to identify the missing dependent packages in the downloaded package set, and to display the installation information of each dependent package; the installation information is used to instruct the installation of each dependent package to complete the package installation.
[0183] In an exemplary embodiment, the installation module 804 is further configured to: for any dependent software package, in response to a dependency package installation request for the dependent software package, parse the dependency package installation request; if the dependency package installation request contains an identifier of the dependent software package but does not contain a version number of the dependent software package, determine from the source database a plurality of candidate dependent software packages that match the identifier of the dependent software package; and determine the dependency software package with the latest version or the highest frequency of use among the plurality of candidate dependent software packages as the dependency software package corresponding to the dependency package installation request.
[0184] In one exemplary embodiment, the software package installation apparatus further includes: a trigger request-response module, a key-value pair acquisition module, and a database creation module, wherein:
[0185] The trigger request and response module is used to respond to trigger requests from the package management tool and obtain the identifier, version number, and list of dependent data packages for each package.
[0186] The key-value pair retrieval module is used to combine the identifier and version number corresponding to the same software package to obtain the key of each software package; and to use the dependency data package of each software package as the value of each software package.
[0187] The database creation module is used to build a package index tree based on the keys of each package; and to build a dependency database based on the keys and values of each package.
[0188] In an exemplary embodiment, the database creation module is further configured to determine the keys of each software package as the attribute information of each software package; and to create a software package index tree based on preset index node creation conditions, using the attribute information of each software package as leaf nodes.
[0189] In an exemplary embodiment, the database creation module is further configured to combine the keys and values corresponding to the same software package to obtain key-value pairs for each software package; and store the key-value pairs of each software package into a preset hash table to obtain a dependency database.
[0190] In one exemplary embodiment, the software package installation apparatus further includes: a timestamp acquisition module, a timestamp comparison module, and a database update module, wherein:
[0191] The timestamp acquisition module is used to obtain the package update timestamp from the source database in response to update requests to the dependency database.
[0192] The timestamp comparison module is used to obtain timestamps by comparing the update timestamps of software packages with information in the dependency database, and to determine whether the dependency database needs to be updated.
[0193] The database update module is used to compare the contents of the dependency database with the contents of the source database when the dependency database needs to be updated, obtain the updated content, and update the dependency database according to the updated content.
[0194] In an exemplary embodiment, the database update module includes: a storage information determination unit and a key-value pair deletion unit, wherein:
[0195] The storage information determination unit is used to obtain the storage capacity and number of storage entries of the dependency database during the update process of the dependency database;
[0196] The key-value pair deletion unit is used to delete the key-value pairs that are furthest from the current time from the dependency database one by one, based on the information retrieval time of each key-value pair in the dependency database, when the storage capacity reaches a preset capacity threshold and / or the number of storage entries reaches a preset number threshold, until the preset capacity threshold and / or the preset number threshold are met.
[0197] Each module in the aforementioned software package installation device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0198] In one exemplary embodiment, a computer device is provided, which may be a terminal device, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a software package installation method. The display unit is used to form a visually visible image and can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be an LCD screen or an e-ink screen. The input device of the computer device can be a touch layer covering the display screen, or buttons, trackballs, or touchpads set on the casing of the computer device, or external keyboards, touchpads, or mice, etc.
[0199] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0200] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0201] In one exemplary embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-described method embodiments.
[0202] In one exemplary embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above-described method embodiments.
[0203] 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, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0204] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0205] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0206] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A software package installation method, characterized in that, Applied to a terminal device, wherein the terminal device is equipped with a software package management tool, the method includes: In response to a trigger request for the package management tool, obtain the identifier, version number, and list of dependent data packages for each package; The identifier and version number corresponding to the same software package are combined to obtain the key of each software package; and the dependency data package of each software package is used as the value of each software package. The keys of each software package are determined as the attribute information of each software package. The attribute information of each software package is used as leaf nodes. Based on preset index node creation conditions, each leaf node is grouped to obtain the upper-level node corresponding to each leaf node. Then, if the upper-level node satisfies the index node creation conditions, the upper-level node is further grouped to determine the upper-level node corresponding to each upper-level node, until the highest-level node no longer satisfies the index node creation conditions, thus obtaining a software package index tree. The index node creation conditions include the number of child nodes corresponding to the index node. A dependency database is constructed based on the keys and values of each software package. The software package index tree and the dependency database are cached locally on the terminal device. In response to a package installation request entered in the package management tool, the attribute information of the package to be installed is obtained; The attribute information of the package to be installed is queried in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages. If the attribute information of the package to be installed exists in the package index tree, the list of dependent packages of the package to be installed is determined from the dependency database; the dependency database stores key-value pairs based on each package; each key-value pair of a package includes the package's attribute information and a list of dependent packages; Based on the list of dependent packages, the installation steps for the software to be installed are performed.
2. The method according to claim 1, characterized in that, The step of responding to a package installation request entered in the package management tool and obtaining the attribute information of the package to be installed includes: In response to a package installation request entered in the package management tool, the installation information of the package to be installed is obtained; the installation information includes the name of the software to be installed, and / or, the package identifier; Based on the installation information, the identifier and version number of the software package to be installed are determined from a preset mapping table; the preset mapping table includes the correspondence between the name, identifier, and version number of each software package. The attribute information of the software package to be installed is obtained by combining the identifier of the software package to be installed and the version number of the software package to be installed.
3. The method according to claim 1, characterized in that, The step of installing the software to be installed based on the list of dependent packages includes: Obtain the set of downloadable software packages for the terminal device; If the download package set includes each of the dependent packages in the dependent package list, then the package to be installed is retrieved from the source database and downloaded. Otherwise, the downloaded package set and the dependent package list are compared to determine the missing dependent packages in the downloaded package set, and the installation information of each dependent package is displayed; the installation information is used to instruct the installation of each dependent package to complete the package installation.
4. The method according to claim 3, characterized in that, The method further includes: For any dependent software package, in response to a dependency package installation request for said dependent software package, the dependency package installation request is parsed; If the dependency package identifier exists in the dependency package installation request, but the version number of the dependency package does not exist, determine multiple candidate dependency packages that match the dependency package identifier from the source database; The dependency package with the latest version or the highest frequency of use among the multiple candidate dependency packages is determined as the dependency package corresponding to the dependency package installation request.
5. The method according to any one of claims 1-4, characterized in that, The step of constructing the dependency database based on the keys and values of each software package includes: The keys and values corresponding to the same software package are combined to obtain the key-value pairs of each software package; The key-value pairs of each software package are stored in a preset hash table to obtain the dependency database.
6. The method according to any one of claims 1-4, characterized in that, The method further includes: In response to an update request for the dependency database, obtain the package update timestamp of the source database; The timestamp is obtained by comparing the update timestamp of the software package with the information in the dependency database, and it is determined whether the dependency database needs to be updated. If an update is required, the contents of the dependency database are compared with the contents of the source database to obtain the updated content, and the dependency database is updated according to the updated content.
7. The method according to claim 6, characterized in that, The step of updating the dependency database based on the updated content includes: During the update process of the dependency database, the storage capacity and number of storage entries of the dependency database are obtained; If the storage capacity reaches a preset capacity threshold, and / or the number of storage entries reaches a preset number threshold, then based on the information retrieval time of each key-value pair in the dependency database, the key-value pair furthest from the current time will be deleted one by one from the dependency database until the preset capacity threshold and / or the preset number threshold are met.
8. A software package installation device, characterized in that, The device includes: The trigger request and response module is used to respond to trigger requests from the package management tool and obtain the identifier, version number, and list of dependent data packages for each package. The key-value pair acquisition module is used to combine the identifier and version number corresponding to the same software package to obtain the key of each software package; and to use the dependency data package of each software package as the value of each software package. A database creation module is used to determine the keys of each software package as the attribute information of each software package, use the attribute information of each software package as leaf nodes, group each leaf node based on preset index node creation conditions to obtain the upper-level nodes corresponding to each leaf node, and then further group the upper-level nodes if the upper-level nodes satisfy the index node creation conditions to determine the upper-level nodes corresponding to each upper-level node, until the highest-level node does not satisfy the index node creation conditions, thus obtaining a software package index tree; the index node creation conditions include the number of child nodes corresponding to the index node; and, based on the keys and values of each software package, construct a dependency relationship database; the software package index tree and the dependency relationship database are cached locally on the terminal device; The acquisition module is used to acquire the attribute information of the package to be installed in response to the package installation request entered in the package management tool; The query module is used to query the attribute information of the package to be installed in the package index tree; the leaf nodes of the package index tree contain the attribute information of multiple packages. A determination module is configured to determine, in the case that the attribute information of the package to be installed exists in the package index tree, a list of dependent packages of the package to be installed from the dependency database; the dependency database stores key-value pairs based on each package; each key-value pair of a package includes the package's attribute information and a list of dependent packages; The installation module is used to perform the installation steps of the software to be installed based on the list of dependent packages.
9. The apparatus according to claim 8, characterized in that, The acquisition module includes: The installation information acquisition unit is used to acquire the installation information of the software package to be installed in response to a software package installation request entered in the software package management tool; the installation information includes the name of the software to be installed and / or, the software package identifier; A table query unit is used to determine the identifier and version number of the software package to be installed from a preset mapping table based on the installation information; the preset mapping table includes the correspondence between the name, identifier, and version number of each software package. The version number combination unit is used to combine the identifier of the software package to be installed and the version number of the software package to be installed to obtain the attribute information of the software package to be installed.
10. The apparatus according to claim 8, characterized in that, The installation module includes: A set acquisition unit is used to acquire the set of downloadable software packages of the terminal device; A package retrieval unit is configured to retrieve the package to be installed from the source database and download the package to be installed when the download package set includes each dependent package in the dependent package list; The package comparison unit is used to compare the downloaded package set and the dependent package list when the dependent packages in the dependent package set are not included in the dependent package set, to determine the missing dependent packages in the downloaded package set, and to display the installation information of each dependent package; the installation information is used to instruct the installation of each dependent package to complete the package installation.