Software package management method and device, equipment and storage medium
By using a lightweight package manager and target database in the sandbox for package management, the problem of relying on operating system tools and libraries in the existing technology is solved, and the convenience and efficiency of package management are achieved.
Patent Information
- Application Number
- CN202411786575.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-06
- Publication Date
- 2025-04-15
AI Technical Summary
The existing package manager relies on specific operating system tools and libraries, and is complex and bloated, making it inconvenient to use and maintain.
Provides a lightweight package management method, using the package manager and target database in the sandbox for package management, including installation, update, query and uninstallation, and does not rely on other tools or libraries provided by the operating system.
It realizes the lightweight and convenient software package management, reduces the resource occupation and maintenance costs of the manager, and provides finer granular permission management and cross-system content synchronization capabilities.
Smart Images

Figure CN119829114A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to computer technology, and relate to, but are not limited to, a software package management method and apparatus, device, and storage medium. Background Art
[0002] In the computing world, package managers, as core tools, play a crucial role. They are responsible for installing, updating, configuring, uninstalling, and managing various software packages in computer systems, including applications, libraries, and system tools. With the rapid development of information technology, the complexity and diversity of software systems are increasing, and the importance of package managers is becoming increasingly prominent.
[0003] Current package managers rely on tools and libraries provided by specific operating systems, are complex to configure, bloated, and inconvenient to use and maintain. Summary of the Invention
[0004] In view of this, the software package management method, apparatus, device, and storage medium provided in the embodiments of the present application can manage software packages using a lightweight software package manager, facilitating the use and maintenance of the software package manager. The software package management method, apparatus, device, and storage medium provided in the embodiments of the present application are implemented as follows:
[0005] In a first aspect, an embodiment of the present application provides a software package management method, applied to an electronic device, wherein the electronic device runs a sandbox, the sandbox including a software package manager and a target database, the target database being used to store software package information of software installed in the sandbox, including:
[0006] Obtaining a processing request for a first software package;
[0007] In response to the processing request, a processing operation corresponding to the processing request is performed on the first software package through the software package manager and the target database, where the processing request includes one of software package installation, software package update, software package query, or software package uninstallation.
[0008] In a second aspect, an embodiment of the present application provides a software package management device, including:
[0009] An acquisition module acquires a processing request for a first software package;
[0010] a processing module configured to, in response to the processing request, perform a processing operation corresponding to the processing request on the first software package through a software package manager and a target database in a sandbox running on the electronic device, wherein the processing request includes one of software package installation, software package update, software package query, or software package uninstallation, and the target database is configured to store software package information of software installed in the sandbox.
[0011] In a third aspect, an embodiment of the present application provides a computer device comprising a memory and a processor, wherein the memory stores a computer program that can be run on the processor, and when the processor executes the program, the method described in the embodiment of the present application is implemented.
[0012] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method provided in the embodiment of the present application.
[0013] Embodiments of the present application provide a software package management method, apparatus, computer device, and computer-readable storage medium. The method is applied to an electronic device running a sandbox, the sandbox including a software package manager and a target database for storing software package information for software installed in the sandbox. The electronic device may obtain a processing request for a first software package and, in response to the processing request, perform a processing operation corresponding to the processing request on the first software package through the software package manager and the target database. The processing request may include one of: software package installation, software package update, software package query, or software package uninstallation.
[0014] In the embodiments of the present application, software packages can be managed based on the software package manager and target database in the sandbox, without relying on other tools or libraries provided by the operating system. This shows that the embodiments of the present application can utilize a lightweight software package manager to manage software packages, making it easier to use and maintain the software package manager. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to illustrate the technical solutions of the present application.
[0016] Figure 1 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0017] Figure 2 A schematic diagram of the implementation flow of the software package management method provided in an embodiment of the present application;
[0018] Figure 3 A schematic diagram of an implementation flow for processing a software package provided in an embodiment of the present application;
[0019] Figure 4 A schematic diagram of another implementation flow for processing a software package provided in an embodiment of the present application;
[0020] Figure 5 A schematic diagram of the implementation flow of processing another pair of software packages provided in an embodiment of the present application;
[0021] Figure 6 A schematic diagram of the operation of the functional plug-in provided in an embodiment of the present application;
[0022] Figure 7 A schematic diagram of the overall process of the software package management method provided in an embodiment of the present application;
[0023] Figure 8 A schematic diagram of the structure of a software package management device provided in an embodiment of the present application;
[0024] Figure 9 A schematic diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0025] To make the purpose, technical solutions and advantages of the embodiments of the present application clearer, the specific technical solutions of the present application will be further described in detail below in conjunction with the drawings in the embodiments of the present application. The following embodiments are used to illustrate the present application but are not intended to limit the scope of the present application.
[0026] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the art to which this application pertains. The terms used herein are for the purpose of describing the embodiments of this application only and are not intended to limit this application.
[0027] In the following description, reference is made to “some embodiments”, which describes a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0028] It should be pointed out that the terms "first\second\third" involved in the embodiments of the present application are used to distinguish similar or different objects, and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.
[0029] Before introducing the relevant solutions of the embodiments of the present application, the technical terms involved in the embodiments of the present application are first explained:
[0030] Sandbox: Sandbox technology is a solution proposed to address increasingly stringent privacy regulations and user privacy protection needs. It aims to create an isolated and secure computing environment that allows a certain degree of user data tracking, but at the same time protects user privacy from being abused. It does this by creating an independent network space or computing environment in which user data is processed and tracked. This environment provides some specific APIs for developers and content providers (such as advertising platforms, media, etc.), but the use of these APIs will not or can only expose user privacy information in a controllable manner. For example, cross-application or web page tracking can be performed within the sandbox, but the user's sensitive information will not be directly leaked to third parties.
[0031] Advanced Packaging Tools (APT): APT is a package manager widely used in Debian and its derivatives (such as Ubuntu) for managing software packages, upgrading the system, and maintaining system stability. With APT, users can easily install, update, and remove software packages without worrying about dependencies and version conflicts.
[0032] YUM (Yellow Dog Updater Modified): A package manager used in Fedora and Community Enterprise Operating System (CentOS). It saves system administrators time and effort by simplifying the software package management process and improves system stability and security.
[0033] DNF (Dandified Yum): The next evolution of the YUM package manager, DNF uses a more advanced algorithm for handling dependencies, better handling complex dependencies between packages and reducing installation issues caused by dependency conflicts. It supports not only basic package installation, updating, and uninstallation operations, but also advanced features such as searching for packages, viewing package availability, and installing package groups.
[0034] Managing software packages primarily involves installing, updating, querying, and uninstalling them within the operating system. Different operating systems and environments require different package management tools. Common Linux distributions like Debian and Ubuntu use APT for package management, while Fedora and CentOS use YUM or DNF. These tools help users more efficiently manage system packages and ensure consistent and complete software installations.
[0035] In addition, package managers are designed with security in mind, using digital signatures to verify the integrity of packages and repositories, reducing the risk of downloading and installing malware.
[0036] A digital signature is a security mechanism based on public-key cryptography. It allows the sender of information to sign the information they send, and the receiver can verify the authenticity of the signature using the sender's public key. In the context of package management, digital signatures are often used to ensure that a package has a reliable source and has not been tampered with. When a package is created or updated, its developer signs the package using their private key. This signature is then published along with the package to a repository. When a user downloads a package from the repository, the package manager verifies the signature using the developer's public key. If the signature verification is successful, the user can be confident that the package comes from a reliable developer and has not been tampered with since it was published to the repository.
[0037] Package managers in related technologies all run on specific operating systems and rely on the services and features provided by that operating system. For example, APT can only process packages in the .deb format, while YUM can only process packages in the .rpm format. These package managers also rely on tools and libraries provided by the operating system when processing their corresponding packages. Therefore, decoupling such package management technologies from their original systems and integrating them into specific projects is difficult and can significantly bloat the original project.
[0038] In view of this, an embodiment of the present application provides a software package management method, which is applied to electronic devices. Electronic devices may include but are not limited to mobile phones, wearable devices (such as smart watches, smart bracelets, smart glasses, etc.), tablet computers, laptop computers, vehicle-mounted terminals, PCs (Personal Computers), etc. The functions implemented by this method can be implemented by a processor in the electronic device calling program code. Of course, the program code can be stored in a computer storage medium. It can be seen that the electronic device includes at least a processor and a storage medium.
[0039] For example, Figure 1 As shown, the electronic device 10 may include a processor 101 , an external memory interface 102 , an internal memory 103 and a universal serial bus (USB) interface 104 .
[0040] It should be understood that the structures illustrated in the embodiments of the present application do not constitute a specific limitation on the electronic device 10. In other embodiments of the present application, the electronic device 10 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0041] The processor 101 may include one or more processing units, for example: the processor 101 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural network processing unit (NPU). Among them, different processing units can be independent devices or integrated into one or more processors. Exemplarily, the processor 101 can be a smart terminal CPU, such as a Snapdragon series processor. In some embodiments, the processor 101 may include one or more interfaces. The interface may include an inter integrated circuit (I2C) interface, an inter integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0042] The external memory interface 102 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 10. The external memory card communicates with the processor 101 via the external memory interface 102 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.
[0043] The internal memory 103 can be used to store computer-executable program code, which includes instructions. The internal memory 103 can include a program storage area and a data storage area. The program storage area can store an operating system and at least one application required for a function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 10 (such as audio data, a phone book, etc.).
[0044] In addition, the electronic device involved in the embodiments of the present application may also be installed with an operating system, and application programs can be installed and run on the operating system, which is not limited in the embodiments of the present application.
[0045] Figure 2 The following is a schematic diagram of the implementation process of the software package management method provided in the embodiment of the present application. Figure 2 As shown, the method may include the following steps 201 to 203:
[0046] Step 201: Obtain a processing request for a first software package.
[0047] The software package management method provided in the embodiments of the present application can be applied to an electronic device in which a sandbox is running. The sandbox includes a software package manager and a target database. The target database can be used to store software package information of software installed in the sandbox.
[0048] In the embodiments of the present application, there is no limitation on the type of software package. For example, the software package may be an .exe (executable file), an .msi (Microsoft Installer), etc. These software packages generally include an installation program that can guide the user to complete the software installation process.
[0049] Alternatively, the software package may also be a data packet consisting of various request information for accessing user privacy, etc., sent by an application on the electronic device to the software package manager.
[0050] In the embodiment of the present application, there is no limitation on the initiator of the processing request for the first software package. For example, the processing request may be initiated by a user, or sent by a script or tool, or initiated by an administrator, or initiated by an updater or upgrade package, or sent by a distribution system, etc.
[0051] Step 202 : In response to the processing request, a processing operation corresponding to the processing request is performed on the first software package through the software package manager and the target database. The processing request includes one of software package installation, software package update, software package query, or software package uninstallation.
[0052] In some embodiments, the format of the target database may be a universal format, so that the target database can be adapted to various operating systems and can be used on different operating systems, facilitating the porting of the software package manager and the target database.
[0053] The package manager in the related art needs to rely on different tools for different operating systems. Therefore, if you want to port the package manager from one operating system to another operating system, you need to have tools with the same functions in the other operating system, which makes the porting inconvenient.
[0054] In the embodiment of the present application, when the software package manager performs the processing operation corresponding to the processing request on the first software package, it only needs to rely on the software package manager's own functions, such as parsing functions, and complete the processing operation on the first software package by calling the target database.
[0055] As can be seen, in the embodiments of the present application, software packages can be managed based on the software package manager and target database in the sandbox, without relying on other tools or libraries provided by the operating system. As can be seen, in the embodiments of the present application, a lightweight software package manager can be used to manage software packages, facilitating the use and maintenance of the software package manager.
[0056] In the embodiment of the present application, based on different types of processing requests, the electronic device uses the software package manager and the target database to perform processing operations corresponding to the processing requests on the first software package in different ways.
[0057] For example, in some embodiments, the processing request is a software package installation request, and the target database includes an installation database, which is used to store installation information of installed software packages.
[0058] Thus, in response to the processing request, the electronic device performs the processing operation corresponding to the processing request on the first software package through the software package manager and the target database, which can be achieved by executing the following steps 301 to 303:
[0059] Step 301: In response to a software package installation request, a first software package is written into a management directory of a software package manager, and the received first software package is parsed and verified to obtain a verification result.
[0060] In an embodiment of the present application, upon receiving an installation request for a first software package, the electronic device may first write relevant information about the first software package to a control directory of the software package manager. In this way, the electronic device can determine identification information of the software package stored in the sandbox based on the control directory. This identification information may include the software package name, version, publisher or developer information, signature and verification information, etc.
[0061] In the embodiment of the present application, after receiving the first software package, the electronic device may further parse and verify the first software package to determine whether the first software package is a legitimate software package.
[0062] For example, if the first software package is a software package of an application to be installed, the electronic device may first parse and verify the legitimacy of the application to be installed to determine whether the application to be installed has installation permission in the sandbox.
[0063] Alternatively, if the first software package may be a data packet consisting of request information for access to user privacy initiated by an application already installed in the electronic device, the electronic device may first parse and verify the legitimacy of the application that sends the first software package to determine whether the application that sends the first software package has the installation permission to install the first software package in the sandbox.
[0064] In the embodiments of the present application, the method for parsing and verification is not limited. For example, a whitelist may be pre-stored in the software package manager, and the whitelist may include identification information of software packages that are allowed to be installed or accessed. In this way, after obtaining a first software package, the electronic device can compare the first software package with the whitelist to determine whether the first software package is on the whitelist. If the first software package is on the whitelist, it indicates that the first software package is a legitimate software package. If the first software package is not on the whitelist, it indicates that the first software package is an illegal software package.
[0065] Step 302: If the verification result indicates that the first software package is an illegal software package, the first software package in the management directory is deleted; if the verification result indicates that the first software package is a legal software package, whether an installation record of the first software package is stored in the installation database is determined.
[0066] In an embodiment of the present application, when it is determined that the first software package is an illegal software package, it can be determined that the first software package cannot be installed in the sandbox. In this case, the first software package in the control directory of the software package manager can be directly cleared to free up storage space in the control directory of the software package manager, and secure management of the software package can be achieved.
[0067] When it is determined that the first software package is a legitimate software package, it can also be determined first whether the installation database in the sandbox stores the installation record of the first software package. If the installation record of the first software package is stored in the installation database, in order to avoid repeated installation, the relevant information of the first software package in the control directory of the software package manager can be cleared to free up storage space in the control directory of the software package manager.
[0068] Step 303: If the installation record of the first software package is not stored in the installation database, the first software package is installed, and the installation record of the first software package is stored in the installation database.
[0069] When it is determined that the installation record of the first software package is not stored in the installation database, the first software package may be installed in the sandbox, and the installation record of the first software package may be stored in the installation database for subsequent use.
[0070] It should be noted that when a software package runs normally, it may also need to rely on the functions provided by other software packages or library files. The dependencies between these packages ensure the integrity and functionality of the software package. If the necessary dependencies are missing, the software package may not work properly or may exhibit abnormal behavior.
[0071] Based on this, in some embodiments, before installing the first software package, a third software package that has a dependency on the first software package may be determined first; and the third software package may be installed after the first software package is installed.
[0072] That is, when the software package manager installs the first software package, it will automatically download the third software package that is dependent on the first software package and install the third software package to ensure the normal operation of the first software package.
[0073] In this way, the package manager ensures the normal installation and operation of the software package by managing dependencies, and the dependencies are managed efficiently and accurately through the package manager.
[0074] In some embodiments, the sandbox also includes a deprecated database for storing information about uninstalled software packages. Thus, after installing a first software package in the sandbox, it is possible to determine whether information about the first software package is stored in the deprecated database. If information about the first software package is stored in the deprecated database, since the first software package needs to be installed, it indicates that the first software package is not deprecated, and the information about the first software package in the deprecated database can be cleared.
[0075] As can be seen, in the embodiments of the present application, when the software package manager is used to install the software package, it can be implemented solely by relying on the installation database in the sandbox, without requiring other functions provided by the operating system (such as requiring the logging system provided by the operating system to record relevant information through logs, etc.). In this way, the software package manager can be decoupled from other operating systems in the electronic device when managing the software package, making the installation process of the software package more convenient.
[0076] Furthermore, the permission management of package managers in related technologies typically relies on the corresponding operating system's permission model, which can include mechanisms such as user authentication, permission allocation, and access control. However, due to differences in the permission models of different operating systems, package management technology needs to adapt to these differences and follow the operating system's permission management specifications, rather than providing its own permission management solution. This means that if the operating system's permission model changes or has restrictions, the package manager may not be able to provide the required permission control. As a result, for scenarios requiring fine-grained permission control, it is difficult for users to implement permission control solely with current package managers.
[0077] Based on this, in some embodiments, the target database may further include a permissions database, i.e., the sandbox may further include a permissions database, which may be used to store permission information for installed software packages. In this way, after a first software package is installed in the sandbox, the permission information for the first software package may also be stored in the permissions database.
[0078] It can be seen that by setting up a permission database in the sandbox and storing the permission information of the software package in the permission database, the software package manager can have its own permission management solution and implement permission management of the software package only by relying on the permission information of the software package recorded in the permission database.
[0079] In other embodiments, the processing request may be a software package update request. In this way, the electronic device, in response to the processing request, performs a processing operation corresponding to the processing request on the first software package through the software package manager and the target database, which can be achieved by executing the following steps 401 to 402:
[0080] Step 401: In response to a software package update request, determine whether an installation record of a second software package is stored in an installation database, where the second software package is of the same type as the first software package.
[0081] In an embodiment of the present application, after receiving a software package update request, the electronic device may first search the installation database to determine whether there is a second software package of the same type as the first software package.
[0082] For example, when the software package is a software package including an installation program, the first software package may be a software package corresponding to application program A, and then the installation database may be searched to determine whether a second software package corresponding to application program A exists.
[0083] Step 402: If the installation database stores an installation record of the second software package and the installation information of the second software package is different from the installation information of the first software package, update the installation information of the second software package stored in the installation database to the installation information of the first software package.
[0084] In the embodiments of the present application, the type of installation information is not limited. For example, when the software package is a software package that includes an installation program, the installation information may be version information. Thus, comparing the installation information of the second software package with the first software package may be comparing the version information of the second software package with the first software package. If the version information of the two software packages is different, the first software package (i.e., the new version software package) may be reinstalled in the sandbox, and the installation information of the second software package stored in the installation database may be deleted, and the installation information of the first software package may be rewritten.
[0085] When a software package is a data packet consisting of various request information for accessing user privacy sent by an application on an electronic device to a software package manager, the installation information can be the request information. In this way, you can first check in the installation database whether there is a request information for accessing user privacy sent by the same application as the application that sent the first software package within a historical period. If so, when comparing the installation information of the second software package with the first software package, you can determine whether the request information contained in the two software packages is the same (for example, the second software package is a request for accessing the user's communication information, and the first software package is a request for accessing the user's shopping information); in this way, if it is determined that the request information contained in the two software packages is different, the request information of the second software package stored in the installation database can be updated to the request information of the first software package.
[0086] Of course, in some embodiments, if it is determined that the request information included in the second software package is different from that included in the first software package, the request information of the second software package in the installation database may not be deleted, but the request information of the first software package may be directly stored in the installation database.
[0087] It can be seen that in the embodiment of the present application, when the software package manager updates the software package, it can be achieved by only using the installation database, making the management of the software package more convenient.
[0088] In other embodiments, the processing request may also be a software package query request, and the processing request includes the identity information of the query object that initiates the software package query request.
[0089] Thus, in response to the processing request, the electronic device performs the processing operation corresponding to the processing request on the first software package through the software package manager and the target database, which can be achieved by executing the following steps 501 to 503:
[0090] Step 501: In response to a software package query request, determine whether an installation record of a first software package corresponding to the query object is stored in an installation database.
[0091] In some embodiments, the query object of the software package query request may be an application. Based on this, after receiving the software package query request for the first software package, the electronic device may first determine whether the installation database stores an installation record of the first software package corresponding to the application.
[0092] Step 502: If the installation record of the first software package is stored in the installation database, determine whether the query object has the query authority based on the authority information of the first software package stored in the authority database and the identity information of the query object.
[0093] It is understandable that in order to protect application security and user privacy, in some embodiments, when the electronic device receives a software package query request, it is also necessary to verify the identity information of the query object that initiated the software package query request.
[0094] Therefore, in an embodiment of the present application, when it is determined that an installation record of the first software package is stored in the installation database, the permission database can be called to obtain permission information of the first software package from the permission database, and the permission information of the first software package can be matched with the identity information of the query object to determine whether the query object has the query permission.
[0095] The permission information of the first software package stored in the permission database may include the query permission corresponding to the first software package and the identity information of the initiator corresponding to the first software package. If the identity information of the initiator corresponding to the first software package is the same as the identity information of the query object (for example, both are application B), it means that the query object has the query permission, and therefore the query result required by the query object can be fed back to the query object.
[0096] Step 503: If it is determined that the query object has the query authority, the query result is fed back to the query object.
[0097] In the embodiments of the present application, there is no limitation on the type of the query result. For example, in some embodiments, the query result may be detailed information of the first software package, such as version number, release date, dependency relationship, etc.
[0098] Alternatively, in other embodiments, the query result may also be private information fed back to the first software package. For example, if application B wishes to query some information involving user privacy, such as the user's call logs for a target user, to protect the user's call privacy, the package manager may choose not to feed all of the user's call logs back to application B, which would then parse all of the call logs to obtain the call logs for the target user. Instead, the package manager may verify application B's identity information and, upon determining that application B has query permission, retrieve the call logs for the target user and feed them back to application B.
[0099] It can be seen that the software package manager provided in the embodiment of the present application can determine whether the query object has query permission based on the permission database, thereby protecting application privacy, and does not need to rely on other tools or libraries in the operating system when querying, thereby achieving decoupling from the operating system.
[0100] In other embodiments, the processing request may also be a software package uninstallation request, and the target database further includes an abandoned database, which is used to store information about uninstalled software packages.
[0101] In this way, the electronic device can uninstall the first software package in response to the received software package uninstall request, store the uninstall information of the first software package in the abandonment database, clear the installation information of the first software package in the installation database, and clear the permission information of the first software package in the permission database.
[0102] It can be seen that the software package manager in the embodiment of the present application only relies on the installation database, permission database and deprecation database when uninstalling the software package, without relying on other tools or libraries in the operating system, thereby achieving decoupling from the operating system and making processing more convenient.
[0103] As can be seen from the above description, in the embodiment of the present application, when the software package manager performs relevant management on the software package, it can be achieved by relying only on the functions provided by the software package manager itself and calling the installation database, permission database and deprecation database.
[0104] It can be seen that the software package manager provided in the embodiment of the present application does not rely on the tools and libraries provided by a specific operating system, its structure is relatively lightweight, and it is relatively easy to port.
[0105] Furthermore, the software package manager provided in the embodiment of the present application also has a rights management mechanism for software packages, and can implement more fine-grained rights management for software packages through a rights database.
[0106] It should be noted that the software package management technology in related technologies usually follows a strict and complex process and is difficult to adjust flexibly. The configuration options it provides may not be sufficient to meet specific business needs or personalized settings. Most importantly, current software package management technologies almost do not support function extensions, so it is difficult to add custom functions for specific scenarios.
[0107] Based on this, in some embodiments, the software package manager may further include at least one functional plug-in. Thus, after performing relevant management on the first software package, the target plug-in may be called to perform a functional operation corresponding to the target plug-in on the first software package. The target plug-in is determined based on a mapping relationship between a preset processing operation and a functional plug-in, and the target plug-in is one of the at least one functional plug-in.
[0108] That is to say, a plug-in port can be reserved in the software package manager. By installing multiple target plug-ins in the software package manager, the software package manager can call the target plug-in corresponding to the processing operation performed on the first software package after performing relevant processing on the first software package, and perform the functional operation corresponding to the target plug-in.
[0109] In the embodiments of the present application, there is no limitation on the type of functional plug-in.
[0110] For example, the functional plug-in may include a content synchronization plug-in or a backup plug-in. The content synchronization plug-in is used to synchronize the operation results of the first software package to the operating system on the electronic device. The operating system and the sandbox are independent systems; the backup plug-in is used to back up the operation results of the first software package.
[0111] Understandably, since the sandbox runs across systems, in some cases, it is also necessary to synchronize the processing results of the software package between the two systems, but existing package managers cannot meet this requirement.
[0112] Based on this, the software package manager in the embodiment of the present application can call the functions corresponding to the plug-ins by adding functional plug-ins, thereby realizing cross-system processing between the sandbox and the operating system of the electronic device, so that the software package manager can adapt to richer application scenarios.
[0113] For example, the package manager runs on the Microdroid system (sandbox), a stripped-down version of the Android operating system launched by Google designed for virtualized environments. Microdroid can be used to virtualize a single Android application instead of providing a complete auxiliary desktop environment. It makes it easier to run secure applications in the cloud and switch security profiles between operating system iterations; the other operating system of the electronic device is the Android system.
[0114] Figure 6 A schematic diagram of the operation of a functional plug-in is given. Figure 6 As shown, to achieve cross-system operation, the package manager can synchronize the results of each package installation, update, or uninstallation process on the two systems through a content synchronization plug-in to ensure that the two systems have the same content. Alternatively, the backup plug-in can be called at the end of the package manager installation process to back up the installed package to the other operating system.
[0115] It can be seen that by implementing this embodiment, by adding a customizable function plug-in to the software package manager, the functions corresponding to the plug-in can be utilized to adapt to richer application scenarios.
[0116] In the embodiments of the present application, the software package manager manages software packages solely by relying on its own functionality and by invoking the installation database, permissions database, and deprecation database. The software package manager provided in the embodiments of the present application is independent of tools and libraries provided by a specific operating system, resulting in a lightweight architecture and ease of portability.
[0117] Furthermore, the software package manager provided in the embodiment of the present application also has a rights management mechanism for software packages, and can implement more fine-grained rights management for software packages through a rights database.
[0118] The following describes an exemplary application of the embodiments of the present application in a practical application scenario.
[0119] Figure 7 The overall flow diagram of the software package management method provided in the embodiment of the present application is shown in FIG. Figure 7 As shown, the method includes the following contents:
[0120] In a privacy sandbox, a lightweight solution is needed to manage a large number of security applications. Beyond basic management capabilities, fine-grained permission management is also required for each security application. Furthermore, because the privacy sandbox operates across multiple operating systems, the package manager must also synchronize content between the two systems. However, this requirement is difficult to achieve using the package managers provided by current operating systems.
[0121] Based on this, in an embodiment of the present application, a software package manager is provided for implementing a lightweight software package management method. The software package management method in the embodiment of the present application can manage software packages through a software package manager and three databases. The three databases can be an installation database, a permissions database, and an abandoned database. Here, the installation database can be used to record information about normally installed software packages, the permissions database can be used to record permission information contained in normally installed software packages, and the abandoned database can be used to record information about normally uninstalled software packages.
[0122] The package manager's installation and update process for software packages is as follows: Figure 7 As shown in the dotted box on the right.
[0123] When installing a software package, the package manager first writes the package file to the package manager's control directory. The package manager then parses and verifies the package. If the verification result confirms that the package is legitimate, the package manager will continue to determine whether there is an installation record for the package in the installation database. If there is no installation record for the package in the installation database, the package will be treated as a new installation package and installed. The package's permission information will be recorded in the permission database. The package manager will also check whether there is any relevant record information for the package in the deprecated database. If so, the relevant information stored in the deprecated database will be cleared.
[0124] In addition, if the package manager fails to parse or verify the package, the package files that have been written to the package manager's control directory can be cleared.
[0125] In addition, if it is determined that an installation record of the software package has already been stored in the installation database, the relationship between the version information of the software package stored in the installation database and the version information of the software package currently to be installed can be further determined; if it is determined that the software package currently to be installed is a new version software package, the current software package can be installed in the electronic device, and the old version software package can be cleared, and the installation information of the software package currently to be installed can be updated in the installation database, and the permission information of the software package currently to be installed can be updated in the permission database.
[0126] Of course, if it is determined that the version information of the software package to be installed is the same as the version information of the stored software package, the relevant information of the software package to be installed under the control directory may be cleared.
[0127] like Figure 7The dashed box in the upper left corner shows the software package query process. Here, a software package query involves searching the installation database for content, matching the provided query criteria against the installation database. If no criteria are provided, all packages will be returned. After the package information is retrieved, the permissions of the queryer and the queried package are matched against the permissions database. If successful, the query result is returned; otherwise, information about packages that the queryer does not have permission to access will not be returned to the queryer.
[0128] In an embodiment of the present application, when a software package is uninstalled, the relevant information of the software package may be recorded in the deprecation database, and the records of the software package in the installation database and the permission database may be cleared, and finally the software package files written to the manager directory may be cleared.
[0129] In addition, package management in the sandbox involves content synchronization between the two systems. To meet this requirement, function extensions are implemented in the package manager, and plug-ins can be provided to the module to implement more customized functions.
[0130] In some embodiments, a plug-in port may be reserved on the software package manager. By installing multiple plug-ins in the software package manager, the corresponding functions of the plug-ins can be realized after the installation of the relevant software packages. For example, the functional plug-in can be a content synchronization plug-in, a backup plug-in, etc.
[0131] You can see that each package manager operation triggers the corresponding function of the functional plug-in after execution. For example, based on this function, the sandbox can provide a "content synchronization" plug-in to the package manager. At the end of each package installation, update, and uninstallation operation of the package manager, the sandbox can synchronize the package with the other operating system to ensure that the two have the same content.
[0132] In some embodiments, the dependencies of the software package may be optimized to process customized dependency resolution strategies or specific types of dependencies.
[0133] The embodiment of the present application provides a lightweight software package manager that can be easily ported to any scenario requiring software package management. The software package manager does not rely on tools and libraries provided by a specific operating system and has good portability.
[0134] In the embodiment of the present application, a permission management mechanism for the software package is also added to the software package manager, which can perform more fine-grained permission management on the software package.
[0135] In an embodiment of the present application, a new functional plug-in is added to the software package manager. By providing a customized functional plug-in to the software package manager, the functions corresponding to the plug-in can be utilized to adapt to richer application scenarios.
[0136] Implementing the software package management method provided in the embodiments of this application can effectively reduce the resource usage of the software package manager, enabling the software package manager to operate effectively even in resource-constrained environments. Furthermore, the software package manager provided in the embodiments of this application reduces learning and usage costs, making it easier to maintain and update the software package manager. Users can also provide personalized plug-in implementations to the manager based on their specific needs, meeting a wider range of usage scenarios and improving work efficiency.
[0137] It should be understood that, although the steps in the above-mentioned flowcharts are shown in sequence according to the instructions of the arrows, these steps are not necessarily performed in sequence in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be performed in other orders. Moreover, at least a portion of the steps in the above-mentioned flowcharts may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily performed at the same time, but can be performed at different times, and the execution order of these sub-steps or stages is not necessarily to be performed in sequence, but can be performed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0138] Based on the aforementioned embodiments, embodiments of the present application provide a software package management device, which includes the modules included therein and the units included in each module, and can be implemented by a processor; of course, it can also be implemented by a specific logic circuit; during implementation, the processor can be a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP), or a field programmable gate array (FPGA), etc.
[0139] Figure 8 A schematic diagram of the structure of the software package management device provided in the embodiment of the present application is shown as follows: Figure 8 As shown, the apparatus 800 includes an acquisition module 801 and a processing module 802, wherein:
[0140] An acquisition module 801 acquires a processing request for a first software package;
[0141] The processing module 802 is configured to, in response to the processing request, perform a processing operation corresponding to the processing request on the first software package through a software package manager and a target database in a sandbox running on the electronic device, wherein the processing request includes one of software package installation, software package update, software package query, or software package uninstallation, and the target database is configured to store software package information of software installed in the sandbox.
[0142] In some embodiments, the processing request is a software package installation request, the target database includes an installation database, and the installation database is used to store installation information of the installed software package; the processing module 802 further includes a determination module and a processing submodule;
[0143] the determining module is configured to, in response to the software package installation request, write the first software package into a management directory of the software package manager, parse and verify the received first software package to obtain a verification result; and if the verification result indicates that the first software package is a valid software package, determine whether an installation record of the first software package is stored in the installation database;
[0144] The processing submodule is configured to install the first software package and store the installation record of the first software package in the installation database if the installation record of the first software package is not stored in the installation database.
[0145] In some embodiments, the target database further includes a permission database, which is used to store permission information of installed software packages. The processing submodule is further used to store the permission information of the first software package in the permission database.
[0146] In some embodiments, the apparatus further includes a clearing module, configured to clear the first software package from the management directory if the verification result indicates that the first software package is an illegal software package.
[0147] In some embodiments, the processing request is a software package update request;
[0148] The determining module is configured to determine, in response to the software package update request, whether an installation record of a second software package is stored in the installation database, the second software package being of the same type as the first software package;
[0149] The processing submodule is further configured to update the installation information of the second software package stored in the installation database to the installation information of the first software package when an installation record of the second software package is stored in the installation database and the installation information of the second software package is different from the installation information of the first software package.
[0150] In some embodiments, the processing request is a software package query request, and the processing request includes identity information of a query object that initiates the software package query request;
[0151] The determining module is configured to determine, in response to the software package query request, whether an installation record of a first software package corresponding to the query object is stored in the installation database;
[0152] The processing submodule is further configured to determine whether the query subject has query authority based on the authority information of the first software package stored in the authority database and the identity information of the query subject, if the installation record of the first software package is stored in the installation database;
[0153] When it is determined that the query object has the query authority, the query result is fed back to the query object.
[0154] In some embodiments, the processing request is a software package uninstallation request, and the target database further includes an abandoned database, wherein the abandoned database is used to store information of uninstalled software packages;
[0155] The processing submodule is further configured to, in response to the software package uninstallation request, uninstall the first software package, store the uninstallation information of the first software package in the deprecation database, clear the installation information of the first software package in the installation database, and clear the permission information of the first software package in the permission database.
[0156] In some embodiments, the software package manager further includes at least one functional plug-in, and the apparatus further includes a calling module;
[0157] The calling module is configured to call a target plug-in to perform a functional operation corresponding to the target plug-in on the first software package, wherein the target plug-in is determined based on a mapping relationship between a preset processing operation and a functional plug-in, and the target plug-in is one of the at least one functional plug-in.
[0158] In some embodiments, the electronic device also includes an operating system, the operating system and the sandbox are independent systems, the functional plug-in includes a content synchronization plug-in or a backup plug-in, the content synchronization plug-in is used to synchronize the operation results of the first software package to the operating system, and the backup plug-in is used to back up the operation results of the first software package.
[0159] In some embodiments, the processing submodule is specifically configured to determine a third software package that has a dependency on the first software package; and install the third software package when the first software package is installed.
[0160] The description of the above device embodiment is similar to the description of the above method embodiment and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of this application, please refer to the description of the method embodiment of this application for understanding.
[0161] It should be noted that in the embodiments of this application Figure 8The module division of the software package management device shown is schematic and represents only one logical functional division; actual implementations may employ different division methods. Furthermore, the functional units in the various embodiments of this application may be integrated into a single processing unit, physically exist separately, or two or more units may be integrated into a single unit. These integrated units may be implemented as hardware or software functional units, or as a combination of software and hardware.
[0162] It should be noted that, in the embodiment of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling an electronic device to execute all or part of the method described in each embodiment of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a magnetic disk or an optical disk. In this way, the embodiment of the present application is not limited to any specific combination of hardware and software.
[0163] The embodiment of the present application provides a computer device, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown. The computer device includes a processor, a memory, and a network interface connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and computer program in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, the above method is implemented.
[0164] An embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the steps of the method provided in the above embodiment are implemented.
[0165] An embodiment of the present application provides a computer program product containing instructions, which, when executed on a computer, enables the computer to execute the steps of the method provided in the above method embodiment.
[0166] Those skilled in the art will understand that Figure 9The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.
[0167] In one embodiment, the software package management device provided by the present application can be implemented in the form of a computer program. Figure 9 The computer device is operated on the computer device shown. The memory of the computer device can store various program modules that constitute the above-mentioned device. The computer program composed of various program modules enables the processor to execute the steps of the method of each embodiment of the present application described in this specification.
[0168] It should be noted that the description of the above storage medium and device embodiments is similar to the description of the above method embodiments and has similar beneficial effects as the method embodiments. For technical details not disclosed in the storage medium, storage medium, and device embodiments of this application, please refer to the description of the method embodiments of this application for understanding.
[0169] It should be understood that "one embodiment" or "an embodiment" or "some embodiments" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, "in one embodiment" or "in an embodiment" or "in some embodiments" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. It should be understood that in the various embodiments of the present application, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application. The above-mentioned serial numbers of the embodiments of the present application are for description only and do not represent the advantages and disadvantages of the embodiments. The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other. For the sake of brevity, they will not be repeated here.
[0170] The term "and / or" in this article is only a description of the association relationship between associated objects, indicating that there can be three relationships. For example, object A and / or object B can mean: object A exists alone, object A and object B exist at the same time, and object B exists alone.
[0171] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0172] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of the modules is merely a logical function division. In actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the components shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or modules can be electrical, mechanical or other forms.
[0173] The modules described above as separate components may or may not be physically separated, and the components displayed as modules may or may not be physical modules; they may be located in one place or distributed across multiple network units; some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0174] In addition, all functional modules in the embodiments of the present application can be integrated into one processing unit, or each module can be a separate unit, or two or more modules can be integrated into one unit; the above-mentioned integrated modules can be implemented in the form of hardware or in the form of hardware plus software functional units.
[0175] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM), magnetic disks or optical disks, and other media that can store program codes.
[0176] Alternatively, if the above-mentioned integrated unit of the present application is implemented in the form of a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application, or the part that contributes to the relevant technology, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling an electronic device to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROMs, magnetic disks or optical disks.
[0177] The methods disclosed in the several method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.
[0178] The features disclosed in the several product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0179] The features disclosed in the several method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.
[0180] The above is merely an embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A software package management method, characterized in that: Applied to an electronic device, the electronic device runs a sandbox, the sandbox includes a software package manager and a target database, the target database is used to store software package information of software installed in the sandbox, the method includes: Obtaining a processing request for a first software package; In response to the processing request, a processing operation corresponding to the processing request is performed on the first software package through the software package manager and the target database, and the processing request includes one of software package installation, software package update, software package query or software package uninstallation.
2. The method according to claim 1, characterized in that The processing request is a software package installation request, the target database includes an installation database, and the installation database is used to store installation information of an installed software package. In response to the processing request, performing a processing operation corresponding to the processing request on the first software package through the software package manager and the target database includes: In response to the software package installation request, write the first software package into a management directory of the software package manager, and parse and verify the received first software package to obtain a verification result; In a case where the verification result is used to indicate that the first software package is a legitimate software package, determining whether an installation record of the first software package is stored in the installation database; In the case that the installation record of the first software package is not stored in the installation database, the first software package is installed, and the installation record of the first software package is stored in the installation database.
3. The method according to claim 2, characterized in that The target database further includes a permission database, and the permission database is used to store permission information of the installed software packages. After installing the first software package, the method further includes: The permission information of the first software package is stored in the permission database.
4. The method according to claim 3, characterized in that The method further comprises: When the verification result indicates that the first software package is an illegal software package, the first software package in the management directory is deleted.
5. The method according to claim 2, characterized in that: The processing request is a software package update request, and in response to the processing request, performing a processing operation corresponding to the processing request on the first software package through the software package manager and the target database includes: In response to the software package update request, determining whether an installation record of a second software package is stored in the installation database, the second software package being a software package of the same type as the first software package; If the installation database stores an installation record of a second software package and the installation information of the second software package is different from the installation information of the first software package, the installation information of the second software package stored in the installation database is updated to the installation information of the first software package.
6. The method according to claim 3, characterized in that The processing request is a software package query request, the processing request includes identity information of a query object that initiates the software package query request, and the response to the processing request includes executing a processing operation corresponding to the processing request on the first software package through the software package manager and the target database, including: In response to the software package query request, determining whether the installation database stores an installation record of a first software package corresponding to the query object; In a case where the installation record of the first software package is stored in the installation database, determining whether the query object has the query authority according to the authority information of the first software package stored in the authority database and the identity information of the query object; When it is determined that the query object has the query authority, the query result is fed back to the query object.
7. The method according to claim 3, characterized in that The processing request is a software package uninstallation request, the target database further includes an abandoned database, the abandoned database is used to store information of uninstalled software packages, and in response to the processing request, performing a processing operation corresponding to the processing request on the first software package through the software package manager and the target database includes: In response to the software package uninstallation request, the first software package is uninstalled, and the uninstallation information of the first software package is stored in the deprecation database, the installation information of the first software package in the installation database is cleared, and the permission information of the first software package in the permission database is cleared.
8. The method according to any one of claims 1 to 5, characterized in that: The software package manager also includes at least one functional plug-in, and the method further includes: A target plug-in is called to perform a functional operation corresponding to the target plug-in on the first software package, wherein the target plug-in is determined according to a mapping relationship between a preset processing operation and a functional plug-in, and the target plug-in is one of the at least one functional plug-in.
9. The method according to claim 8, characterized in that The electronic device also includes an operating system, and the operating system and the sandbox are independent systems. The functional plug-in includes a content synchronization plug-in or a backup plug-in, and the content synchronization plug-in is used to synchronize the operation results of the first software package to the operating system, and the backup plug-in is used to back up the operation results of the first software package.
10. The method according to claim 2, characterized in that The installing the first software package includes: Determining a third software package that has a dependency relationship with the first software package; When the first software package is installed, the third software package is installed.
11. A software package management device, characterized in that: include: An acquisition module is used to acquire a processing request for a first software package; A processing module is used to respond to the processing request and perform a processing operation corresponding to the processing request on the first software package through a software package manager and a target database in a sandbox running on the electronic device, wherein the processing request includes one of software package installation, software package update, software package query or software package uninstallation, and the target database is used to store software package information of the software installed in the sandbox.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program executable on the processor, wherein: When the processor executes the program, the steps of the method according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.
Citation Information
Cited By
Method and device for realizing trusted installation on open source operating system based on certificate management mechanism in offline environment
CN120408598A
A method and device for realizing trusted installation on an open source operating system based on a certificate management mechanism in an offline environment
CN120408598B