Software package adaptation method and apparatus, electronic device, and storage medium
By setting a pre-defined, highly compatible software package on the proxy side, the problem of goproxy frequently adapting to different software package versions is solved, improving the efficiency of the client in obtaining software packages, reducing the workload on the proxy side, and meeting the user's needs.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-16
- Publication Date
- 2026-03-17
AI Technical Summary
goproxy needs to frequently adapt to different versions of software packages, resulting in low efficiency for clients to obtain software packages and inconvenience for users.
By setting a preset package with a high compatibility version on the proxy side, the package is obtained from the server according to the client request and the version number is set to be compatible, ensuring that the package runs normally in the client environment.
It improves the efficiency of the client in obtaining software packages, reduces the workload of the agent, and meets the user's needs.
Smart Images

Figure CN116107620B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and in particular to a software package adaptation method, a software package adaptation device, an electronic device, and a storage medium. Background Technology
[0002] Currently, the open-source proxy server (goproxy) is an official Go language tool that provides package download services to users through an intermediary proxy. It supports forward proxy, reverse proxy, transparent proxy, intranet penetration, and other powerful functions.
[0003] Typically, goproxy retrieves multiple versions of software packages from the network to respond to different download requests from clients.
[0004] The existing technology has at least the following problems: goproxy needs to frequently adapt to different versions of software packages, which is a lot of work, and the client often has low efficiency in obtaining software packages, causing inconvenience to users. Summary of the Invention
[0005] In view of the above problems, embodiments of the present invention are proposed to provide a software package adaptation method that overcomes or at least partially solves the above problems, so as to improve the efficiency of the client in obtaining software packages.
[0006] Accordingly, embodiments of the present invention also provide a software package adapter, an electronic device, and a storage medium to ensure the implementation and application of the above methods.
[0007] To address the aforementioned problems, this invention discloses a software package adaptation method applied to a proxy terminal, wherein the proxy terminal is communicatively connected to both a server and a client. The method includes:
[0008] Receive request instructions sent by the client;
[0009] Based on the version characteristics of the target software in the request instruction, obtain the preset software package corresponding to the target software from the server;
[0010] The preset software package is configured with a version number compatibility setting so that it can run in the client's runtime environment;
[0011] The preset software package, after completing the compatibility settings, is sent to the client for installation and operation.
[0012] Optionally, the request instruction includes a target version number, and the preset software package includes a feature file and source code, wherein the feature file contains a compatible version number of the preset software package;
[0013] The compatibility settings for the preset software package include:
[0014] Modify the compatible version number in the feature file of the preset software package to the target version number;
[0015] Based on the client's runtime environment, the source code of the preset software package undergoes compatibility processing to ensure that the source code can run in the client's runtime environment.
[0016] Optionally, the compatibility processing of the source code of the preset software package includes:
[0017] If the first architecture of the source code is incompatible with the second architecture of the client's runtime environment, the preset configuration data corresponding to the second architecture will be written into the source code.
[0018] The preset configuration data is generated based on the second architecture and is used to make the source code compatible with the second architecture of the client.
[0019] Optionally, the preset software package includes source code, and after sending the preset software package with completed compatibility settings to the client, it further includes:
[0020] A verification value is generated based on the preset software package, and the verification value corresponds to the source code of the preset software package;
[0021] The verification value is sent to the client, which is configured to verify the source code of the preset software package based on the verification value after receiving it, so as to ensure the integrity of the preset software package.
[0022] Optionally, after receiving the request instruction sent by the client, the method further includes:
[0023] If the target version number is not present in the request instruction, the highest version corresponding to the preset software package is obtained from the server based on the identification information of the preset software package.
[0024] Optionally, obtaining the preset software package from the server includes:
[0025] A retrieval instruction is sent to the server, the retrieval instruction including the compatible version number, and the server is configured to send the corresponding preset software package to the agent according to the compatible version number after receiving the retrieval instruction.
[0026] Optionally, the request instruction includes a target version number, and after the request instruction sent by the receiving client, it includes:
[0027] If the target version number is lower than or equal to the first version number, in response to the request instruction, the software package corresponding to the first version number is obtained from the server;
[0028] If the target version number is greater than the first version number, in response to the request instruction, the software package corresponding to the second version number is obtained from the server;
[0029] Wherein, the first version number is less than the second version number.
[0030] This invention also discloses a software package adaptation device applied to a proxy terminal, wherein the proxy terminal is communicatively connected to both a server and a client. The device includes:
[0031] The receiving module is used to receive request instructions sent by the client;
[0032] The acquisition module is used to acquire a preset software package corresponding to the target software from the server based on the version characteristics of the target software in the request instruction;
[0033] A compatibility setting module is used to set the version number compatibility of the preset software package so that the preset software package can run in the client's runtime environment;
[0034] The sending module is used to send the preset software package, after the compatibility settings have been completed, to the client for the client to install and run.
[0035] Optionally, the request instruction includes a target version number, and the preset software package includes a feature file and source code, wherein the feature file contains a compatible version number of the preset software package;
[0036] The compatibility setting module includes:
[0037] The modification submodule is used to change the compatible version number in the feature file of the preset software package to the target version number;
[0038] The compatibility processing submodule is used to perform compatibility processing on the source code of the preset software package according to the client's runtime environment, so that the source code can run in the client's runtime environment.
[0039] Optionally, the compatibility processing submodule includes:
[0040] An architecture configuration unit is used to write preset configuration data corresponding to the second architecture into the source code when the first architecture of the source code is incompatible with the second architecture of the client's runtime environment.
[0041] The preset configuration data is generated based on the second architecture and is used to make the source code compatible with the second architecture of the client.
[0042] Optionally, the preset software package includes source code, and the device further includes:
[0043] A generation module is used to generate a verification value based on the preset software package, wherein the verification value corresponds to the source code of the preset software package;
[0044] The sending module is further configured to send the verification value to the client, which is configured to verify the source code of the preset software package based on the verification value after receiving the verification value, so as to ensure the integrity of the preset software package.
[0045] Optionally, the acquisition module is further configured to, if the target version number is not present in the request instruction, obtain the highest version corresponding to the preset software package from the server based on the identification information of the preset software package.
[0046] Optionally, the acquisition module includes:
[0047] A sending submodule is used to send a retrieval instruction to the server. The retrieval instruction includes the compatible version number. The server is configured to send a corresponding preset software package to the agent according to the compatible version number after receiving the retrieval instruction.
[0048] Optionally, the request instruction includes a target version number;
[0049] The acquisition module is further configured to, in response to the request instruction, acquire the software package corresponding to the first version number from the server when the target version number is lower than or equal to the first version number; and in response to the request instruction, acquire the software package corresponding to the second version number from the server when the target version number is greater than the first version number.
[0050] Wherein, the first version number is less than the second version number.
[0051] This invention also discloses an electronic device, including a memory and one or more programs, wherein one or more programs are stored in the memory and configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0052] Receive request instructions sent by the client;
[0053] In response to the request instruction, a preset software package is obtained from the server;
[0054] The preset software package is configured for compatibility so that it can run in the client's operating environment;
[0055] The preset software package, after completing the compatibility settings, is sent to the client.
[0056] This invention also discloses a readable storage medium, wherein when the instructions in the storage medium are executed by the processor of an electronic device, the electronic device is able to execute one or more of the software package adaptation methods described in this invention.
[0057] The embodiments of the present invention have the following advantages: by setting a preset software package with a corresponding highly compatible version, the proxy can respond to different client requests based on the preset software package, avoiding the need to frequently request software packages from the server, enabling the client to obtain software packages more quickly, effectively improving the efficiency of the client obtaining software packages, and effectively reducing the workload of the proxy, improving the efficiency of the proxy in adapting to cached software packages, and timely meeting the user's usage needs. Attached Figure Description
[0058] Figure 1 This is a flowchart illustrating the steps of an embodiment of the software package adaptation method of the present invention;
[0059] Figure 2 This is a flowchart illustrating the steps of another embodiment of the software package adaptation method of the present invention;
[0060] Figure 3 This is a structural block diagram of an embodiment of a software package adapter device according to the present invention;
[0061] Figure 4 This is a structural block diagram of a terminal for a software package adaptation method, according to an exemplary embodiment. Detailed Implementation
[0062] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0063] The core concept of this invention is that by setting a preset software package with a corresponding highly compatible version, the proxy can respond to different client requests based on the preset software package, thereby improving the efficiency of the proxy in adapting to cached software packages, thus improving the efficiency of the client in obtaining software packages and improving the client's user experience.
[0064] Reference Figure 1 The diagram illustrates a flowchart of an embodiment of a software package adaptation method according to the present invention, applied to a proxy terminal. The proxy terminal is communicatively connected to both a server and a client, and may specifically include the following steps:
[0065] Step 101: Receive the request instruction sent by the client.
[0066] goproxy can provide clients with faster package download speeds and solve the problem of package incompatibility with the client's architecture. Clients can effectively improve the efficiency of obtaining packages through the proxy and can use some packages with incompatible architectures, making the choices more diverse and improving the experience.
[0067] For example, when a client needs software, the client can send a request to the proxy, and the proxy can then retrieve the corresponding software package from the network for the client based on the client's request.
[0068] Step 102: Based on the version characteristics of the target software in the request instruction, obtain the preset software package corresponding to the target software from the server.
[0069] For example, after receiving a request instruction from a client, the proxy will retrieve a preset software package corresponding to the target software from the server based on the version characteristics of the target software in the request instruction. This preset software package can be used to make the target software compatible on the client, and the preset software package can be compatible with multiple versions. When the client requests these software packages, the proxy can provide the client with the preset software package. In this way, the proxy can respond to different client requests based on the preset software package, avoiding the proxy frequently retrieving various versions of software packages from the network. This can effectively improve the efficiency of the client obtaining software packages and reduce the workload of the proxy.
[0070] Step 103: Configure the version number of the preset software package to ensure compatibility, so that the preset software package can run in the client's operating environment.
[0071] For example, after obtaining the preset software package, the agent needs to set the version number of the preset software package to ensure that the preset software package can run normally in the client's runtime environment. Since the preset software package is a software version compatible with the client's request, the agent needs to not only enable the preset software package to run on the client, but also enable the client to accept the preset software package.
[0072] Step 104: Send the preset software package, after completing the compatibility settings, to the client for installation and operation.
[0073] For example, after the agent completes the compatibility settings for the preset software package, the preset software package can be used normally by the client. At this time, the agent can send the preset software package to the client for normal installation and operation, ensuring the client's user experience of the target software while meeting the user's needs in a timely manner.
[0074] In summary, this application embodiment describes and illustrates the entire process of the software package adaptation method through a specific example:
[0075] First, in a Go environment, the client can send a request command to the proxy. The data format of the request command in Go is: `go get golang.org / x / sys@0.0.2`. The data format of this request command after conversion using the Hypertext Transfer Protocol (HTTP) is as follows:
[0076] `http: / / goproxy.loongnix.cn?pkg=golang.org / x / sys&version=0.0.2`
[0077] Where pkg represents the package name (identification information of the target software) of the software package requested by the client, and version represents the target version number (0.0.2) of the software package requested by the client.
[0078] After receiving the request command, the proxy parses it to obtain the `pkg` and `version` parameters. At this point, the proxy calls a fake decision module. This module can retrieve a pre-defined software package from its local pre-defined storage area (or obtain it from a server that specifically maintains these packages) and configure the pre-defined package's version number to ensure compatibility with the client's runtime environment. Specifically, the fake decision module uses a pre-defined matching rule (which includes a mapping between the target version number and the compatible version number) to match the client's requested package's target version number (0.0.2) with a pre-defined package that has a corresponding compatible version number (0.0.4). Once a match is successful, it retrieves the pre-defined package with the compatible version number (0.0.4) from the local cache space that specifically maintains pre-defined packages for the loongarch64 architecture, using the package name: `pkg=golang.org / x / sys`. The proxy then packages the source code of the preset software package into source.tar.gz, and subsequently changes the compatibility version number (0.0.4) in the preset software package's feature file to the target version number (0.0.2), thereby generating a mod file with the content `golang.org / x / sys 0.0.21667876190000`. This means the actual source code of the preset software package is version 0.0.4, but the version number is marked as 0.0.2. If the architecture of the preset software package's source code is incompatible with the client's runtime environment architecture, then, based on the client's runtime environment architecture, preset configuration data translated into binary format for the loongarch64 architecture can be added to the source code of the preset software package, allowing clients on x86 and other architectures to call and run the preset software package's source code normally.
[0079] Finally, the proxy packages the source code files and mod files as preset package data and sends it to the client. After receiving it, the client parses it and proceeds with the subsequent process. At this point, because the package version number matches its expectation and has the architecture support of loongarch64, the subsequent compilation will proceed normally, effectively improving the efficiency of the client obtaining the package and effectively reducing the workload of the proxy, thus meeting the user's needs in a timely manner.
[0080] In summary, the technical solution proposed in this application, by setting a preset software package with corresponding high compatibility version, enables the proxy to respond to different client requests based on the preset software package, avoiding the need to frequently request software packages from the server. This allows the client to obtain software packages more quickly, effectively improving the efficiency of the client obtaining software packages, and effectively reducing the workload of the proxy, improving the efficiency of the proxy in adapting to cached software packages, and timely meeting the user's needs.
[0081] Optionally, refer to Figure 2 The diagram illustrates a flowchart of another embodiment of the software package adaptation method of the present invention, applied to a proxy end, wherein the proxy end is communicatively connected to both the server end and the client end, and may specifically include the following steps:
[0082] Step 201: Receive the request instruction sent by the client.
[0083] For details of this step, please refer to step 101 above, which will not be repeated here.
[0084] Step 202: Based on the version characteristics of the target software in the request instruction, obtain the preset software package corresponding to the target software from the server.
[0085] For details of this step, please refer to step 102 above, which will not be repeated here.
[0086] Step 203: Configure the version number of the preset software package to ensure compatibility, so that the preset software package can run in the client's operating environment.
[0087] For details of this step, please refer to step 103 above, which will not be repeated here.
[0088] Step 204: Send the preset software package, after completing the compatibility settings, to the client for installation and operation.
[0089] For details of this step, please refer to step 104 above, which will not be repeated here.
[0090] Optionally, the request instruction includes a target version number, the preset software package includes a feature file and source code, and the feature file contains a compatible version number of the preset software package; step 203 may include the following steps:
[0091] Step 2031: Modify the compatible version number in the feature file of the preset software package to the target version number.
[0092] For example, when a client requests a software package, it can attach a target version number to the request command based on the version number it requires, so that the agent can retrieve the corresponding software package for it based on the target version number. A software package typically includes source code and a feature file. The source code is the program that the client will ultimately run, and the feature file is used to identify the version information of the software package, which contains the version number of the software package.
[0093] After the proxy obtains the preset software package, in order for the client to accept the preset software package, the compatible version number in the preset software package can be modified to the target version number requested by the client. In this way, after the client receives the preset software package, it will recognize the preset software package as the software package corresponding to the target version number it requested, ensuring that the preset software package can be used by the client.
[0094] Step 2032: Perform compatibility processing on the source code of the preset software package according to the client's operating environment, so that the source code can run in the client's operating environment.
[0095] For example, when the client requests a software package that is not compatible with its operating environment (such as a foreign software package), directly sending the obtained pre-defined software package to the client and having the client run it directly may result in runtime errors or malfunctions, affecting the client's user experience. Therefore, after obtaining the pre-defined software package, the proxy can perform compatibility processing on the source code within the pre-defined software package to ensure that the source code can run in the client's operating environment, avoiding runtime errors due to compatibility issues and improving the client's user experience.
[0096] Optionally, step 2032 may include the following steps:
[0097] Step 20321: If the first architecture of the source code is incompatible with the second architecture of the client's runtime environment, write the preset configuration data corresponding to the second architecture into the source code.
[0098] The preset configuration data is generated based on the second architecture and is used to make the source code compatible with the second architecture of the client.
[0099] For example, generally speaking, whether a software package can run correctly on a client depends on the architecture of both the package and the client. Architecture, also known as software architecture, is the basic structure of a software system, defining the components of the system and the rules governing their operation and collaboration. For a software package to run correctly on a client, its architecture must be compatible with the client's architecture. Therefore, after the proxy obtains a preset software package, if the preset package's architecture is incompatible with the client's architecture, the proxy needs to inject corresponding preset configuration data for the second architecture into the preset package. After adding this preset configuration data, the preset package becomes compatible with the client's architecture and can thus run correctly on the client.
[0100] Optionally, the preset software package includes source code. After step 204, the software package adaptation method of this application embodiment may further include the following steps:
[0101] Step 205: Generate a verification value based on the preset software package, wherein the verification value corresponds to the source code of the preset software package.
[0102] For example, when the proxy sends a software package to the client, it also sends a checksum to the client. The client can verify the received software package based on the checksum to ensure that the received software package is the one it needs. After obtaining the preset software package, the proxy can generate a checksum based on the preset software package. This checksum corresponds to the source code of the preset software package. In this way, after receiving the preset software package and the checksum, the client verifies the preset software package using the checksum to ensure that the preset software package is the one it needs, thereby enabling the client to accept the preset software package.
[0103] For example, the verification value can be a SHA256 verification value. SHA256 is a hash function that outputs a 64-character hexadecimal string, i.e., the SHA256 verification value. The proxy can perform a hash operation on the source code of the preset software package to obtain a SHA256 verification value and send it to the client. The client can then verify the preset software package based on the SHA256 verification value. Optionally, the verification value can also be obtained using SHA224, SHA384, SHA512, or other operation methods, which are not limited here.
[0104] Step 206: Send the verification value to the client. The client is configured to verify the source code of the preset software package based on the verification value after receiving the verification value, so as to ensure the integrity of the preset software package.
[0105] For example, after generating the verification value, the proxy can send the verification value to the client. Then, after receiving the preset software package and the verification value, the client can verify the preset software package using the verification value, thereby enabling the client to accept the preset software package sent by the proxy.
[0106] For example, after receiving the preset software package and the checksum, the client can perform calculations based on the source code of the preset software package to obtain a checksum. By comparing the checksum with the checksum, the client can determine that the preset software package is complete during transmission and that no data loss has occurred.
[0107] Optionally, the proxy terminal is provided with a memory area for storing the preset software package; after step 201, the software package adaptation method of this application embodiment may further include the following steps:
[0108] Step 207: If the preset software package is stored in the memory segment, retrieve the preset software package from the memory segment.
[0109] For example, the proxy configuration in this application embodiment responds to client requests for multiple different versions of software packages simultaneously using a preset software package. That is, for these software packages, the proxy provides the same preset software package to the client. This preset software package is compatible with these software packages. For example, a matching rule can be preset on the proxy to match the corresponding preset software package based on the version of the software package requested by the client. Each preset software package corresponds to at least one software package requested by the client. This effectively reduces the workload of the proxy and allows the client to obtain the software package more quickly. For these different versions of software packages, the proxy only needs to provide the same preset software package. To avoid the proxy frequently fetching the same preset software package from the network, increasing workload, a memory area can be set on the proxy. After the preset software package is fetched for the first time, it is stored in the memory area. When the client requests a software package that corresponds to the preset software package already stored in the memory area, the proxy can directly obtain the preset software package from the memory area without fetching it from the network again, further reducing the workload of the proxy and effectively reducing the time for the client to obtain the software package.
[0110] Step 208: If the preset software package does not exist in the memory segment, obtain the preset software package from the server and store the preset software package in the memory segment.
[0111] For example, after receiving a request from a client, the proxy can first check if there is a preset software package corresponding to the software package requested by the client in the memory area. If there is, it can be obtained directly from the memory area; if not, the proxy needs to fetch the preset software package from the network, i.e., the server. After fetching, the proxy can store the preset software package in the memory area so that it can be obtained directly from the memory area the next time the preset software package is needed, reducing the workload and improving the efficiency of the client in obtaining software packages.
[0112] Optionally, after step 201, the software package adaptation method of this application embodiment may further include the following steps:
[0113] Step 209: If the target version number is not present in the request instruction, obtain the highest version corresponding to the preset software package from the server based on the identification information of the preset software package.
[0114] For example, when the request command sent by the client does not contain the target version number, the proxy can assume that the client needs the software package with the highest current version number. In this case, the proxy can retrieve the software package with the highest current version number from the server and then send it to the client after compatibility settings.
[0115] The proxy can also store the software package with the highest current version number in a memory segment. This way, when a client's request command does not contain a target version number, it can directly retrieve the software package with the highest current version number from the memory segment.
[0116] Considering the frequency of software package updates, the proxy can choose not to store the software package with the highest current version number, but instead fetch it from the server each time to avoid providing a software package with a different version number. Alternatively, the proxy can check the version of the software package on the server each time the client's request command does not contain the target version number. If the software package with the highest version number stored in the memory area matches the software package with the highest version number on the server, it can be retrieved directly from the memory area. If they do not match, the proxy can retrieve the software package with the highest current version number from the server and store it in the memory area.
[0117] Optionally, step 202 may include the following steps:
[0118] Step 2021: Send an acquisition instruction to the server. The acquisition instruction includes the compatible version number. The server is configured to send the corresponding preset software package to the agent according to the compatible version number after receiving the acquisition instruction.
[0119] For example, the proxy obtains a preset software package from the server by first sending a retrieval command to the server and setting a compatibility version number in the retrieval command. After receiving the retrieval command, the server sends the corresponding preset software package to the proxy according to the compatibility version number. In this way, the proxy obtains the preset software package, and can further configure its compatibility and send it to the client.
[0120] Optionally, the request instruction includes a target version number. After step 201, the software package adaptation method of this application embodiment may further include the following steps:
[0121] Step 210: If the target version number is lower than or equal to the first version number, in response to the request instruction, obtain the software package corresponding to the first version number from the server.
[0122] For example, generally, higher-version software packages are compatible with lower-version software packages. In this embodiment, preset software packages can be set based on version numbers. Specifically, a preset software package with a higher version number is set. When a client requests a software package with a version number lower than this preset package, the preset package can be provided to the client. Furthermore, considering potential compatibility issues arising from large version differences, a rule can be set on the proxy side to set two preset software packages with different version numbers. These two preset packages divide the client-requested software package into two parts: the lower-version package and the higher-version package correspond to the two preset packages respectively. This avoids compatibility issues caused by excessive differences between the client-requested version and the version provided by the proxy. One implementation for determining whether the version difference is large is to determine if the difference between the two version numbers is greater than or equal to a preset difference threshold. If the difference is greater than or equal to the preset difference threshold, the version difference is considered large; if the difference is less than the preset difference threshold, the version difference is considered small. For example, assuming the preset difference threshold is 2, if one version number is 2 and the other version number is 5, then the difference between these two version numbers is 3, which is greater than the preset difference threshold of 2, and the two versions are considered to have a large difference.
[0123] Specifically, when the target version number is lower than or equal to the first version number, the agent can provide the client with the software package corresponding to the first version number. When the target version number is higher than the first version number, it can provide another preset software package with a higher version number. This can effectively avoid large version differences.
[0124] Step 211: If the target version number is greater than the first version number, in response to the request instruction, obtain the software package corresponding to the second version number from the server.
[0125] Wherein, the first version number is less than the second version number.
[0126] For example, when the target version number is greater than the first version number, the agent can provide the client with a software package corresponding to a second version number, which is higher than the first version number.
[0127] For example, the second version number can be the highest version number at present, that is, the version of the software package is divided into two parts for adaptation, while the first version number can be the version number that is closer to the middle part among all versions, to ensure the uniformity of the two parts and avoid large differences between versions in one part.
[0128] Alternatively, all versions can be divided into three parts, or other numbers of parts, which can further reduce the maximum version difference of the preset packages provided to the client, which will not be elaborated here.
[0129] Optionally, the proxy terminal is provided with a memory area for storing the preset software package; after step 201, the software package adaptation method of this application embodiment may further include the following steps:
[0130] Step 212: If at least two preset software packages are stored in the memory area, send a selection list to the client, the selection list including the version numbers of the at least two preset software packages.
[0131] For example, in one embodiment of this application, the agent may not modify the compatible version number of the preset software package, and may not directly send the preset software package to the client. Instead, it may generate a selection list based on at least two preset software packages in the memory segment. The selection list contains the version numbers of the at least two preset software packages. The agent then sends the selection list to the client. The client can select a version number from the selection list and generate a selection command to send to the agent to obtain the preset software package corresponding to the version number in the selection command.
[0132] Step 213: Based on the selection instruction sent by the client, retrieve the preset software package corresponding to the version number in the selection instruction from the memory area.
[0133] For example, after receiving the selection instruction, the agent retrieves the preset software package corresponding to the version number from the memory area, performs architectural compatibility settings, and then sends it to the client. This avoids the need to fetch the new version of the software package again, reduces the workload of the agent, and improves the client's user experience by responding to the client's needs.
[0134] Optionally, when the request instruction contains a target version number, the agent can first send a selection list for the client to choose from. If the client makes a selection, there is no need to fetch the software package corresponding to the target version number from the server. If the client refuses to select from the selection list, the agent can then fetch the software package corresponding to the target version number from the server. This can reduce the workload of the agent to some extent.
[0135] Optionally, when the target version number of the software package requested by the client is higher than the version number of the preset software package already stored in the proxy's memory area, the proxy can first send a selection list to the client to provide the corresponding software package according to the client's selection; or, the proxy can first send a preset software package with a higher version in the memory area to the client, and simultaneously send an update confirmation instruction. After the update confirmation instruction reaches the client, it will prompt the client whether it needs to update to the version corresponding to the target version number. If the client refuses, the client can continue to use the preset software package. If the client confirms the update, the proxy can then obtain the software package corresponding to the target version number from the server and send it to the client so that the client can update the version. In this way, while satisfying the client's user experience, the workload of the proxy can be reduced to a certain extent. For example, suppose a client requests a version 0.0.8 software package, and the default software package version in the proxy is 0.0.6. When the proxy receives the request, it can first send the version 0.0.6 software package to the client, along with an update confirmation message stating, "The currently provided package is a version 0.0.6 compatible package. To continue upgrading, please click 'Update'." If the client is satisfied with using the version 0.0.6 software package, the process ends. If the client is not satisfied with using the version 0.0.6 software package and chooses to update, the proxy can then obtain the version 0.0.8 software package from the server maintaining the software packages and send it to the client so that the client can update to the new version.
[0136] It should be noted that, for the sake of simplicity, the method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments of the present invention are not limited to the described order of actions, because according to the embodiments of the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions involved are not necessarily essential to the embodiments of the present invention.
[0137] Reference Figure 3 The diagram illustrates a structural block diagram of an embodiment of a software package adaptation device according to the present invention. This device is applied to a proxy terminal, which is communicatively connected to both a server and a client. Specifically, it may include the following modules:
[0138] The receiving module 301 is used to receive request instructions sent by the client;
[0139] The acquisition module 302 is used to acquire a preset software package corresponding to the target software from the server according to the version characteristics of the target software in the request instruction;
[0140] The compatibility setting module 303 is used to set the version number compatibility of the preset software package so that the preset software package can run in the client's runtime environment;
[0141] The sending module 304 is used to send the preset software package after the compatibility settings are completed to the client for the client to install and run.
[0142] Optionally,
[0143] The request instruction includes a target version number, and the preset software package includes a feature file and source code, wherein the feature file contains a compatible version number of the preset software package;
[0144] The compatibility setting module includes:
[0145] The modification submodule is used to change the compatible version number in the feature file of the preset software package to the target version number;
[0146] The compatibility processing submodule is used to perform compatibility processing on the source code of the preset software package according to the client's runtime environment, so that the source code can run in the client's runtime environment.
[0147] Optionally, the compatibility processing submodule includes:
[0148] An architecture configuration unit is used to write preset configuration data corresponding to the second architecture into the source code when the first architecture of the source code is incompatible with the second architecture of the client's runtime environment.
[0149] The preset configuration data is generated based on the second architecture and is used to make the source code compatible with the second architecture of the client.
[0150] Optionally, the preset software package includes source code, and the device further includes:
[0151] A generation module is used to generate a verification value based on the preset software package, wherein the verification value corresponds to the source code of the preset software package;
[0152] The sending module is further configured to send the verification value to the client, which is configured to verify the source code of the preset software package based on the verification value after receiving the verification value, so as to ensure the integrity of the preset software package.
[0153] Optionally, the acquisition module is further configured to, if the target version number is not present in the request instruction, obtain the highest version corresponding to the preset software package from the server based on the identification information of the preset software package.
[0154] Optionally, the acquisition module includes:
[0155] A sending submodule is used to send a retrieval instruction to the server. The retrieval instruction includes the compatible version number. The server is configured to send a corresponding preset software package to the agent according to the compatible version number after receiving the retrieval instruction.
[0156] Optionally, the proxy terminal is provided with a memory area for storing the preset software package; the acquisition module 302 is further configured to acquire the preset software package from the memory area when the preset software package is stored in the memory area; and to acquire the preset software package from the server and store the preset software package in the memory area when the preset software package is not stored in the memory area.
[0157] Optionally, the request instruction includes a target version number;
[0158] The acquisition module is further configured to, in response to the request instruction, acquire the software package corresponding to the first version number from the server when the target version number is lower than or equal to the first version number; and in response to the request instruction, acquire the software package corresponding to the second version number from the server when the target version number is greater than the first version number.
[0159] Wherein, the first version number is less than the second version number.
[0160] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0161] Figure 4 This is a structural block diagram illustrating an electronic device 400 for software package adaptation according to an exemplary embodiment. For example, the electronic device 400 may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness equipment, personal digital assistant, etc.
[0162] Reference Figure 4 The electronic device 400 may include one or more of the following components: processing component 402, memory 404, power supply component 406, multimedia component 408, audio component 410, input / output (I / O) interface 412, sensor component 414, and communication component 416.
[0163] Processing component 402 typically controls the overall operation of electronic device 400, such as operations associated with display, telephone calls, data communication, camera operation, and recording operations. Processing component 402 may include one or more processors 420 to execute instructions to perform all or part of the steps of the methods described above. Furthermore, processing component 402 may include one or more modules to facilitate interaction between processing component 402 and other components. For example, processing component 402 may include a multimedia module to facilitate interaction between multimedia component 408 and processing component 402.
[0164] Memory 404 is configured to store various types of data to support the operation of device 400. Examples of this data include instructions for any application or method operating on electronic device 400, contact data, phonebook data, messages, pictures, videos, etc. Memory 404 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0165] Power supply component 406 provides power to various components of electronic device 400. Power supply component 406 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to electronic device 400.
[0166] Multimedia component 408 includes a screen that provides an output interface between the electronic device 400 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 408 includes a front-facing camera and / or a rear-facing camera. When the electronic device 400 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0167] Audio component 410 is configured to output and / or input audio signals. For example, audio component 410 includes a microphone (MIC) configured to receive external audio signals when electronic device 400 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 404 or transmitted via communication component 416. In some embodiments, audio component 410 also includes a speaker for outputting audio signals.
[0168] I / O interface 412 provides an interface between processing component 402 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, home buttons, volume buttons, power buttons, and lock buttons.
[0169] Sensor assembly 414 includes one or more sensors for providing state assessments of various aspects of electronic device 400. For example, sensor assembly 414 may detect the on / off state of device 400, the relative positioning of components such as the display and keypad of electronic device 400, changes in position of electronic device 400 or a component of electronic device 400, the presence or absence of user contact with electronic device 400, orientation or acceleration / deceleration of electronic device 400, and temperature changes of electronic device 400. Sensor assembly 414 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. Sensor assembly 414 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, sensor assembly 414 may also include an accelerometer, gyroscope, magnetometer, pressure sensor, or temperature sensor.
[0170] Communication component 416 is configured to facilitate wired or wireless communication between electronic device 400 and other devices. Electronic device 400 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 416 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 416 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on radio frequency identification (RFID) technology, Infrared Data Association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
[0171] In an exemplary embodiment, the electronic device 400 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field-programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the methods described above.
[0172] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 404 including instructions, which can be executed by a processor 420 of an electronic device 400 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0173] A non-transitory computer-readable storage medium, wherein instructions in the storage medium, when executed by a terminal's processor, enable the terminal to perform a software package adaptation method.
[0174] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0175] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0176] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0177] These computer program instructions may also be stored in a computer-readable storage medium capable of directing a computer or other programmable data processing terminal device to operate in a predictive manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0179] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.
[0180] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0181] The above provides a detailed description of a software package adaptation method and apparatus, an electronic device, and a storage medium provided by the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A software package adaptation method, characterized by, Applied to the agent end, the method comprises: receiving a request instruction sent by a client; obtaining a preset software package corresponding to the target software from a server according to the version characteristics of the target software in the request instruction; performing compatibility setting on the version number of the preset software package, including: modifying the version number of the preset software package, and performing compatibility processing on the source code of the preset software package, so that the preset software package can run in the running environment of the client; sending the preset software package after completing the compatibility setting to the client for installation and running.
2. The method of claim 1, wherein, The request instruction includes a target version number, and the preset software package includes a feature file and source code, and the feature file contains a compatible version number of the preset software package; The compatibility setting on the version number of the preset software package comprises: modifying the compatible version number in the feature file of the preset software package to the target version number; performing compatibility processing on the source code of the preset software package according to the running environment of the client, so that the source code can run in the running environment of the client.
3. The method of claim 2, wherein, The compatibility processing on the source code of the preset software package according to the running environment of the client comprises: in the case that the first architecture of the source code is incompatible with the second architecture of the running environment of the client, write preset configuration data corresponding to the second architecture into the source code; wherein the preset configuration data is generated based on the second architecture, for making the source code compatible with the second architecture of the client.
4. The method of claim 1, wherein, The preset software package includes source code, and after sending the preset software package after completing the compatibility setting to the client, it further comprises: generating a check value based on the preset software package, the check value corresponding to the source code of the preset software package; sending the check value to the client, and the client is configured to, after receiving the check value, based on the check value, check the source code of the preset software package to ensure the integrity of the preset software package.
5. The method of claim 2, wherein, After receiving the request instruction sent by the client, it further comprises: in the case that the target version number does not exist in the request instruction, obtaining the highest version corresponding to the preset software package from the server according to the identification information of the preset software package.
6. The method of claim 2, wherein, The preset software package corresponding to the target software is obtained from the server, comprising: sending an acquisition instruction to the server, the acquisition instruction including the compatible version number, and the server is configured to, after receiving the acquisition instruction, send the corresponding preset software package to the agent end according to the compatible version number.
7. The method of claim 1, wherein, The request instruction includes a target version number, and after receiving the request instruction sent by the client, it comprises: in the case that the target version number is lower than or equal to a first version number, obtaining the software package corresponding to the first version number from the server in response to the request instruction; in the case that the target version number is greater than the first version number, obtaining the software package corresponding to a second version number from the server in response to the request instruction; wherein the first version number is less than the second version number.
8. A software package adaptation apparatus characterized by comprising: The application is applied to an agent end which is in communication connection with a server end and a client end respectively, and the device comprises: A receiving module is configured to receive a request instruction sent by the client end; An obtaining module is configured to obtain a preset software package corresponding to the target software from the server end according to the version characteristics of the target software in the request instruction; A compatible setting module is configured to perform compatible setting on the version number of the preset software package, including modifying the version number of the preset software package and performing compatible processing on the source code of the preset software package, so that the preset software package can run in the running environment of the client end; A sending module is configured to send the preset software package after the compatible setting to the client end for installation and running.
9. The apparatus of claim 8, wherein, The request instruction comprises a target version number, and the preset software package comprises a feature file and a source code, and the feature file contains a compatible version number of the preset software package; The compatible setting module comprises: A modifying submodule is configured to modify the compatible version number in the feature file of the preset software package to the target version number; A compatible processing submodule is configured to perform compatible processing on the source code of the preset software package according to the running environment of the client end, so that the source code can run in the running environment of the client end.
10. The apparatus of claim 9, wherein, The compatible processing submodule comprises: An architecture configuration unit is configured to write preset configuration data corresponding to a second architecture of the running environment of the client end into the source code in the case that a first architecture of the source code is incompatible with the second architecture of the running environment of the client end; The preset configuration data is generated based on the second architecture, and the preset configuration data is used to make the source code compatible with the second architecture of the client end.
11. The apparatus of claim 8, wherein, The preset software package comprises a source code, and the device further comprises: A generating module is configured to generate a check value based on the preset software package, and the check value corresponds to the source code of the preset software package; The sending module is further configured to send the check value to the client end, and the client end is configured to perform check on the source code of the preset software package based on the check value after receiving the check value, so as to ensure the integrity of the preset software package.
12. The apparatus of claim 9, wherein, The obtaining module is further configured to obtain the preset software package corresponding to the highest version from the server end according to the identification information of the preset software package in the case that the target version number does not exist in the request instruction.
13. The apparatus of claim 9, wherein, The obtaining module comprises: A sending submodule is configured to send an obtaining instruction to the server end, and the obtaining instruction comprises the compatible version number, and the server end is configured to send the corresponding preset software package to the agent end according to the compatible version number after receiving the obtaining instruction.
14. The apparatus of claim 8, wherein, The request instruction comprises a target version number; The obtaining module is further configured to obtain a software package corresponding to a first version number from the server end in response to the request instruction in the case that the target version number is lower than or equal to the first version number; And obtain a software package corresponding to a second version number from the server end in response to the request instruction in the case that the target version number is greater than the first version number; The first version number is less than the second version number.
15. An electronic device, comprising: The computer program product includes a memory and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by one or more processors, and the one or more programs include instructions for performing the following operations: receiving a request instruction sent by a client; obtaining a preset software package corresponding to the target software from a server according to a version characteristic of the target software in the request instruction; performing a version number compatibility setting on the preset software package, including a modification operation on the version number of the preset software package and a compatibility processing on source code of the preset software package, so that the preset software package can run in a running environment of the client; sending the preset software package after the compatibility setting to the client for installation and running.
16. A readable storage medium, characterized by, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can perform the software package adaptation method as claimed in one or more of claims 1-7.
Citation Information
Patent Citations
Software package management method and device, equipment and medium
CN113741952A