Multi-version installation package upgrading method and system based on file comparison
Through the multi-version installation package upgrade method based on file comparison, the time and traffic problems of traditional upgrade methods when the network bandwidth is limited or the installation package is large is solved, and a more efficient upgrade process is achieved, reducing costs and improving user experience.
Patent Information
- Application Number
- CN202411971020.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-30
- Publication Date
- 2025-05-09
AI Technical Summary
When the network bandwidth is slow or unstable, or when the installation package itself is large, the upgrade time will be too long and the network traffic consumes too much, affecting the user experience and increasing costs.
The multi-version installation package upgrade method based on file comparison is adopted. By submitting the upgrade version number and product identification number to the server, a hash value correspondence table is generated, and the upgrade package file is uploaded to the OSS file server to download only the changed files.
Reduces unnecessary file downloads, reduces network traffic consumption and upgrade time, improves user experience, and reduces network traffic usage costs for companies and users.
Smart Images

Figure CN119960790A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information technology application technology, and more specifically, to a multi-version installation package upgrade method and system based on file comparison. Background Art
[0002] With the continuous iteration and update of the PC client software version, the number and size of files in the local client installation package will gradually increase. At the same time, the PC client also needs to be customized for different regions or products, resulting in large differences in the content of each version. At this time, the client upgrade becomes a troublesome problem. In the traditional PC client upgrade process, when the client upgrades the version, it usually downloads the latest version of the client installation package online, and directly performs the overwriting installation of the installation package after the installation package is downloaded. In this way, the client version is upgraded. Although this upgrade method can ensure that the client is upgraded to the latest version, when the network bandwidth is slow or unstable or the client installation package itself is large, it will take more time to download the installation package, and it will also bring more network traffic consumption, affecting the user's upgrade experience and increasing the network traffic usage cost of the company and users.
[0003] Therefore, a technology is needed to implement multi-version installation package upgrade based on file comparison. Summary of the invention
[0004] The technical solution of the present invention provides a method and system for upgrading multi-version installation packages based on file comparison, so as to solve the problem of how to upgrade multi-version installation packages based on file comparison.
[0005] In order to solve the above problems, the present invention provides a method for upgrading a multi-version installation package based on file comparison, the method comprising:
[0006] Submitting the upgrade version number and product identification number of the upgrade program to the server, wherein the submitted upgrade version number is greater than the existing upgrade version number of the upgrade program;
[0007] Binding the upgrade version number with the product identification number;
[0008] Upload the upgrade package compressed file of the upgrade program upgrade package to the server;
[0009] Decompressing the received compressed upgrade package file through the server on the service end, and creating a corresponding upgrade version number directory in the OSS file server for the decompressed decompressed upgrade package file;
[0010] Traverse all the decompressed upgrade package files corresponding to the upgrade version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgrade package file;
[0011] Combine the hash value, file name, and relative path of each decompressed upgrade package file in the upgrade package compressed file to generate a json-formatted content string.
[0012] Bind the generated json format content string to the upgrade version number;
[0013] The decompressed upgrade package file is uploaded to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file.
[0014] Preferably, it also includes:
[0015] Starting the upgrade program through the client, obtaining the current local program version number and product identification number of the upgrade program recorded by the client;
[0016] The client assembles the current local program version number and the product identification number to generate a request message, and submits the request message to the server;
[0017] The server parses the received request message to obtain the current local program version number and the product identification number, and obtains the upgrade version number bound to the product identification number;
[0018] Based on the current local program version number and the upgrade version number, it is determined whether the program to be upgraded needs to be upgraded.
[0019] Preferably, when it is determined that the program to be upgraded needs to be upgraded, the server queries the hash value corresponding to the upgrade version number, the json format content string and the download address corresponding to the upgrade version number of the OSS file server to assemble them into a return message and send it to the upgrade program of the client.
[0020] Preferably, the content of the returned message is parsed and downloaded by the upgrade program of the client:
[0021] Parsing each file in the upgrade package in the returned message and its corresponding hash value;
[0022] Obtaining a hash value of the local upgrade program, and determining whether the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program;
[0023] When it is determined that the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program, the hash value of the exception list file in the local installation directory is obtained, and the hash value thereof is determined to be consistent with the hash value of the exception list file in the upgrade package;
[0024] When it is determined that the hash value of the exception list file in the local installation directory is consistent with the hash value of the upgrade exception list file in the upgrade package, read the identification information table file that locally records the compressed files in the decompressed upgrade package;
[0025] The hash value correspondence table of each file in the upgrade package is screened through the upgrade exception list file and the identification information table file of the compressed files in the decompressed upgrade package to exclude the files that do not need to be downloaded;
[0026] Based on the hash value correspondence table of each file in the filtered upgrade package, assemble the download URL of each file to download the file.
[0027] Preferably, the method further includes: when saving the downloaded file in a temporary directory, performing a hash value comparison between the downloaded file and a hash value correspondence table of each file in the upgrade package; when the comparison result is inconsistent, determining that the file download has failed, and retrying the download.
[0028] Preferably, the method further comprises: when all files are downloaded successfully, reading an information table file in a temporary directory recording information of compressed package files to be decompressed, and obtaining a list of compressed package file names to be decompressed;
[0029] Traverse the temporary directory, determine whether each file in the temporary directory is in the compressed package file name list, and copy the files that are not in the compressed package file name list to the client directory;
[0030] Decompress the compressed files in the download directory according to the compressed file name list;
[0031] Update the client to record the identification information table file of the compressed files in the decompressed upgrade package, delete all files in the temporary directory, and change the current version number in the registry to the upgraded version number.
[0032] Preferably, it also includes:
[0033] When it is determined that the hash value of the upgrade program in the upgrade package is inconsistent with the hash value of the local upgrade program, assemble the download address URL of the upgrade program and complete the download of the file, and download the file to a temporary directory;
[0034] The downloaded file is compared with the hash value of the upgrade program in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0035] Preferably, it also includes: when it is determined that the hash value of the exception list file in the local installation directory is inconsistent with the hash value of the upgrade exception list file in the upgrade package, assembling the download address URL of the exception list file list and completing the download of the file, and downloading the file to a temporary directory;
[0036] The downloaded file is compared with the hash value correspondence table of each file in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0037] According to another aspect of the present invention, the present invention provides a multi-version installation package upgrade system based on file comparison, the system comprising:
[0038] A submitting unit, used to submit an upgrade version number and a product identification number of the upgrade program to the server, wherein the submitted upgrade version number is greater than an existing upgrade version number of the upgrade program;
[0039] An uploading unit, used to bind the upgrade version number with the product identification number; and upload the upgrade package compressed file of the upgrade program upgrade package to the server;
[0040] The first processing unit is used to decompress the received upgraded package compressed file through the server of the service end, and establish a corresponding upgraded version number directory in the OSS file server for the decompressed upgraded package file; traverse all the decompressed upgraded package files corresponding to the upgraded version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgraded package file; combine the hash value, file name and relative path of each decompressed upgraded package file in the upgraded package compressed file to generate a json format content string; bind the generated json format content string with the upgraded version number; upload the decompressed upgraded package file to the upgraded version number directory of the OSS file server based on the relative path in the upgraded package compressed file.
[0041] Preferably, the method further comprises a second processing unit, configured to:
[0042] Starting the upgrade program through the client, obtaining the current local program version number and product identification number of the upgrade program recorded by the client;
[0043] The client assembles the current local program version number and the product identification number to generate a request message, and submits the request message to the server;
[0044] The server parses the received request message to obtain the current local program version number and the product identification number, and obtains the upgrade version number bound to the product identification number;
[0045] Based on the current local program version number and the upgrade version number, it is determined whether the program to be upgraded needs to be upgraded.
[0046] Preferably, the second processing unit is also used to, when it is determined that the program to be upgraded needs to be upgraded, query the hash value corresponding to the upgrade version number, the json format content string and the download address corresponding to the upgrade version number of the OSS file server through the server, assemble them into a return message and send it to the upgrade program of the client.
[0047] Preferably, the second processing unit is further configured to parse the content of the returned message through the upgrade program of the client and download it:
[0048] Parsing each file in the upgrade package in the returned message and its corresponding hash value;
[0049] Obtaining a hash value of the local upgrade program, and determining whether the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program;
[0050] When it is determined that the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program, the hash value of the exception list file in the local installation directory is obtained, and the hash value thereof is determined to be consistent with the hash value of the exception list file in the upgrade package;
[0051] When it is determined that the hash value of the exception list file in the local installation directory is consistent with the hash value of the upgrade exception list file in the upgrade package, read the identification information table file that locally records the compressed files in the decompressed upgrade package;
[0052] The hash value correspondence table of each file in the upgrade package is screened through the upgrade exception list file and the identification information table file of the compressed files in the decompressed upgrade package to exclude the files that do not need to be downloaded;
[0053] Based on the hash value correspondence table of each file in the filtered upgrade package, assemble the download URL of each file to download the file.
[0054] Preferably, the second processing unit is also used to save the downloaded file in a temporary directory, and compare the hash values of the downloaded file with the hash value correspondence table of each file in the upgrade package. When the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0055] Preferably, the second processing unit is further used for
[0056] When all the files are downloaded successfully, read the information table file in the temporary directory that records the compressed package file information to be decompressed, and obtain the compressed package file name list that needs to be decompressed;
[0057] Traverse the temporary directory, determine whether each file in the temporary directory is in the compressed package file name list, and copy the files that are not in the compressed package file name list to the client directory;
[0058] Decompress the compressed files in the download directory according to the compressed file name list;
[0059] Update the client to record the identification information table file of the compressed files in the decompressed upgrade package, delete all files in the temporary directory, and change the current version number in the registry to the upgraded version number.
[0060] Preferably, the second processing unit is further configured to assemble the download address URL of the upgrade program and complete the download of the file, and download the file to a temporary directory when it is determined that the hash value of the upgrade program in the upgrade package is inconsistent with the hash value of the local upgrade program;
[0061] The downloaded file is compared with the hash value of the upgrade program in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0062] Preferably, the second processing unit is further configured to assemble the download address URL of the exception list file list and complete the download of the file, and download the file to a temporary directory when it is determined that the hash value of the exception list file in the local installation directory is inconsistent with the hash value of the upgrade exception list file in the upgrade package;
[0063] The downloaded file is compared with the hash value correspondence table of each file in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0064] The technical solution of the present invention provides a multi-version installation package upgrade method and system based on file comparison, wherein the method comprises: submitting an upgrade version number and a product identification number of an upgrade program to a server, wherein the submitted upgrade version number is greater than an existing upgrade version number of the upgrade program; binding the upgrade version number with the product identification number; uploading an upgrade package compressed file of the upgrade program upgrade package to the server; decompressing the received upgrade package compressed file through a server at the server end, and establishing a corresponding upgrade version number directory in an OSS file server for the decompressed decompressed upgrade package file; traversing all decompressed upgrade package files corresponding to the upgrade version number directory, and generating a hash value corresponding to each file based on the content of each decompressed upgrade package file; combining the hash value, file name and relative path of each decompressed upgrade package file in the upgrade package compressed file to generate a json format content string; binding the generated json format content string with the upgrade version number; uploading the decompressed upgrade package file to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file. The flexible version control mechanism provided by the technical solution of the present invention can more conveniently associate different products and different versions with each other. At the same time, the uniqueness of the hash value can ensure that when downloading files, only when the file content changes (produces differences), these changed files will be downloaded, including new files or modified files. It ensures that when upgrading across products or across major versions, it can still be upgraded stably, reducing the traffic waste caused by downloading existing local files. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] A more complete understanding of exemplary embodiments of the present invention may be obtained by referring to the following drawings:
[0066] Figure 1 A flowchart of a method for upgrading a multi-version installation package based on file comparison according to a preferred embodiment of the present invention;
[0067] Figure 2 A flowchart of an upgrade server according to a preferred embodiment of the present invention;
[0068] Figure 3 A flowchart of client upgrade according to a preferred embodiment of the present invention; and
[0069] Figure 4 The figure is a structural diagram of a multi-version installation package upgrade system based on file comparison according to a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0070] Now, exemplary embodiments of the present invention are described with reference to the accompanying drawings. However, the present invention can be implemented in many different forms and is not limited to the embodiments described herein. These embodiments are provided to disclose the present invention in detail and completely and to fully convey the scope of the present invention to those skilled in the art. The terms used in the exemplary embodiments shown in the accompanying drawings are not intended to limit the present invention. In the accompanying drawings, the same units / elements are marked with the same reference numerals.
[0071] Unless otherwise specified, the terms (including technical terms) used herein have the commonly understood meanings to those skilled in the art. In addition, it is understood that the terms defined in commonly used dictionaries should be understood to have the same meanings as those in the context of the relevant fields, and should not be understood as idealized or overly formal meanings.
[0072] Figure 1 The present invention is a flowchart of a method for upgrading a multi-version installation package based on file comparison according to a preferred embodiment of the present invention.
[0073] The present invention is applicable to two scenarios of supporting local deployment and cloud co-construction. One is enterprise privatization deployment, where the server is deployed on the enterprise's internal private server and all data is stored locally in the enterprise; the other is that the enterprise uses the public cloud platform to build its own version management platform, and the upgrade package data is stored in the cloud, ensuring data security. For the first scenario, the steps of the present invention are as follows:
[0074] like Figure 1 As shown, the present invention provides a multi-version installation package upgrade method based on file comparison, the method comprising:
[0075] Step 101: Submitting the upgrade version number and product identification number of the upgrade program to the server, where the submitted upgrade version number is greater than the existing upgrade version number of the upgrade program;
[0076] Step 102: Bind the upgrade version number with the product identification number;
[0077] Step 103: Upload the upgrade package compressed file of the upgrade program upgrade package to the server;
[0078] Step 104: decompress the received compressed file of the upgrade package through the server at the service end, and create a corresponding upgrade version number directory in the OSS file server for the decompressed decompressed upgrade package file;
[0079] Step 105: traverse all decompressed upgrade package files corresponding to the upgrade version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgrade package file;
[0080] Step 106: Combine the hash value of each file, the file name, and the relative path of each decompressed upgrade package file in the upgrade package compressed file to generate a json format content string;
[0081] Step 107: Bind the generated json format content string to the upgrade version number;
[0082] Step 108: Upload the decompressed upgrade package file to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file.
[0083] Figure 2 The main process of the upgrade server is demonstrated, which is mainly divided into the correspondence between the upgrade package version number and the product identification code, the upload of the upgrade package, the establishment of the correspondence between the hash values of the files in the upgrade package, the establishment of the relationship between the hash value correspondence table of each file in the upgrade package and the upgrade version number, and the upload of the files in the upgrade package to the OSS file server.
[0084] The service-side process of the present invention includes:
[0085] Submit the version number of the upgrade package and the corresponding product identification number: Submit the new software upgrade version number and product identification number, and check that the upgrade version number is greater than the existing upgrade version number;
[0086] Bind the upgrade package version number and product identification number: An upgrade software version may support multiple products at the same time, or it may only support one product, so the upgrade version number needs to be bound to the product identification number and stored in the database;
[0087] Upload the compressed package file (zip format) corresponding to the upgrade package to the server;
[0088] Process the compressed package file corresponding to the upgrade package:
[0089] After receiving the complete upgrade package compressed file, the server completely decompresses the compressed file and creates a corresponding upgrade version number directory on the OSS file server;
[0090] Traverse all the files in the compressed directory, read the content of each file and generate the hash value (sha256) corresponding to each file based on the content;
[0091] Combine the file name and the relative path of the file in the compressed package based on the generated hash value to generate a json format content string;
[0092] Bind the generated json string containing the correspondence between all files in the upgrade package compressed package and the upgrade version number and store it in the server database;
[0093] Upload the decompressed contents of the upgrade package to the corresponding version number directory on the OSS server according to the relative path in the compressed package.
[0094] Preferably, the method further comprises:
[0095] Start the upgrade program through the client, and obtain the current local program version number and product identification number of the upgrade program recorded by the client;
[0096] The client assembles the current local program version number and product identification number, generates a request message, and submits the request message to the server;
[0097] The server parses the received request message to obtain the current local program version number and product identification number, and obtains the upgrade version number bound to the product identification number;
[0098] Based on the current local program version number and the upgrade version number, determine whether the program to be upgraded needs to be upgraded.
[0099] Preferably, when it is determined that the program to be upgraded needs to be upgraded, the server queries the hash value corresponding to the upgrade version number, the json format content string and the download address corresponding to the upgrade version number of the OSS file server to assemble them into a return message and send it to the client's upgrade program.
[0100] Figure 3 The client upgrade process is shown. After the client main program starts the upgrade program, the upgrade program obtains the current version number and product identification number to assemble a message and send a request to the upgrade server. After the upgrade program obtains the corresponding version of the hash value and file correspondence table, it performs self-upgrade of the upgrade program, screening of the upgrade exception list, screening of files to be downloaded, file download, non-compressed file copying, compressed file screening and decompression, pre-operation processing before the upgrade is completed, and starts the client main process.
[0101] The client process of the present invention includes:
[0102] The client starts the upgrade program, which obtains the local program software version number and product identification number recorded locally, assembles an upgrade request message, and sends it to the upgrade server;
[0103] The upgrade server parses the upgrade request message, obtains the local software version number and product identification number, first uses the product identification number to obtain the latest software upgrade version number corresponding to the current product identification number recorded in the database, and then uses the upgrade software version number to compare with the local software version number. If the server software version number is greater than the local client version number, it means that there is no latest version and no upgrade is required. The client message returned has no specific content. Otherwise, the table is looked up to obtain the hash value corresponding to the upgrade version number. The corresponding table json string data is assembled together with the file download address corresponding to the version number in the OSS file server into a return message and sent to the client upgrade program;
[0104] Preferably, the content of the returned message is parsed and downloaded by the client's upgrade program:
[0105] Parsing each file in the upgrade package in the returned message and its corresponding hash value;
[0106] Obtaining a hash value of the local upgrade program, and determining whether the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program;
[0107] When it is determined that the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program, the hash value of the exception list file in the local installation directory is obtained, and the hash value thereof is determined to be consistent with the hash value of the exception list file in the upgrade package;
[0108] When it is determined that the hash value of the exception list file in the local installation directory is consistent with the hash value of the upgrade exception list file in the upgrade package, read the identification information table file that locally records the compressed files in the decompressed upgrade package;
[0109] The hash value correspondence table of each file in the upgrade package is screened through the upgrade exception list file and the identification information table file of the compressed files in the decompressed upgrade package to exclude the files that do not need to be downloaded;
[0110] Based on the hash value correspondence table of each file in the filtered upgrade package, assemble the download URL of each file to download the file.
[0111] Preferably, the method further comprises: when it is determined that the hash value of the upgrade program in the upgrade package is inconsistent with the hash value of the local upgrade program, assembling the download address URL of the upgrade program and completing the download of the file, and downloading the file to a temporary directory;
[0112] The downloaded file is compared with the hash value of the upgrade program in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0113] Preferably, it also includes: when it is determined that the hash value of the exception list file in the local installation directory is inconsistent with the hash value of the upgrade exception list file in the upgrade package, assembling the download address URL of the exception list file list and completing the download of the file, and downloading the file to a temporary directory;
[0114] The downloaded file is compared with the hash value correspondence table of each file in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0115] After the client upgrade program of the present invention obtains the return message, it parses the message content. If there is no content, it exits the upgrade process. If there is content, it parses and downloads it:
[0116] Parse the message to generate a corresponding relationship table between the hash value of the upgrade package and the hash value of the upgrade file;
[0117] Get the hash value corresponding to the local upgrade program and compare it with the hash value corresponding to the upgrade program in the upgrade package. If there is no difference, continue to perform 3.3 operation. If there is a difference:
[0118] Assemble the download address URL of the upgrade program and complete the file download. The file is downloaded to a temporary directory. After downloading, check whether the hash value of the file is consistent with the hash value of the upgrade program in the upgrade package. If it is inconsistent, it means that the download failed. Retry the download. When the number of retries reaches 3, the entire upgrade process ends.
[0119] Start the third-party replacement program, complete the replacement operation of the old and new upgrade programs and the restart operation of the new upgrade program after the upgrade program exits, and the third-party replacement program automatically exits after the new upgrade program starts.
[0120] Obtain the hash value of the local upgrade exception list file and compare it with the hash value of the upgrade exception list file in the upgrade package. If there is no difference, continue to 3.4. If there is a difference:
[0121] Assemble the download address URL of the upgrade exception list file and complete the file download. The file is downloaded to a temporary directory. After downloading, check whether the hash value of the file is consistent with the hash value of the upgrade package. If it is inconsistent, it means that the download failed. Retry the download. When the number of retries reaches 3, the entire upgrade process ends;
[0122] Preferably, the method further includes: when saving the downloaded file in a temporary directory, performing a hash value comparison between the downloaded file and a hash value correspondence table of each file in the upgrade package; when the comparison result is inconsistent, determining that the file download has failed, and retrying the download.
[0123] The present invention reads the upgrade exception list;
[0124] Read the local decompressed compressed package identification information table file;
[0125] Traverse the upgrade package hash correspondence table, and query the file name in each item with the upgrade exception list and the decompressed compressed package identification information table. If the file name is found to exist in either list, remove it;
[0126] Use the filtered upgrade package hash correspondence table to assemble the download URLs of each file and download the file. The files are saved in a temporary directory. After the file is downloaded, the hash value is compared with the hash value correspondence table of each file in the upgrade package. If it is inconsistent, it means the download has failed and the download is retried. When the number of retries reaches 3, the entire upgrade process ends.
[0127] Preferably, it also includes:
[0128] When all the files are downloaded successfully, read the information table file in the temporary directory that records the compressed package file information to be decompressed, and obtain the compressed package file name list that needs to be decompressed;
[0129] Traverse the temporary directory, determine whether each file in the temporary directory is in the compressed package file name list, and copy the files that are not in the compressed package file name list to the client directory;
[0130] Decompress the compressed files in the download directory according to the compressed file name list;
[0131] Update the client to record the identification information table file of the compressed files in the decompressed upgrade package, delete all files in the temporary directory, and change the current version number in the registry to the upgraded version number.
[0132] After all the files of the present invention are downloaded successfully, the compressed package identification list directory under the temporary download directory is read to record the compressed package files that need to be decompressed
[0133] Close the client main process to prevent replacement failure during the next replacement.
[0134] Traverse the temporary download directory to determine whether each file is in the compressed package identification list. If not, copy it to the client directory to overwrite the file;
[0135] Get the compressed package file name in the decompressed compressed package identification list, and decompress the compressed package file in the temporary download record;
[0136] Update the local unzipped compressed package identification information table file;
[0137] Delete all files in the temporary download directory;
[0138] Modify the current version number in the registry to the new version number after the upgrade;
[0139] Complete specific pre-operations;
[0140] Start the client main process and end the upgrade program process.
[0141] The present invention utilizes a flexible version configuration method to bind the association between the upgrade version number and the product identification number, thereby expanding the usable scope of the server-side system;
[0142] Utilize the self-upgrade feature of the upgrade program to provide guarantee for the pre-upgrade operation of the client;
[0143] The uniqueness of the hash value is used to ensure the uniqueness of the files in each upgrade package, which enhances the reliability of preventing duplicate file downloads and also provides protection for upgrades across multiple versions;
[0144] Use a pre-set and variable exception list system to reduce the security of local files being overwritten by mistake;
[0145] Use the local end to dynamically generate the compressed package decompression mark to reduce the repeated downloading of the decompressed compressed package;
[0146] Utilize the dynamically configurable compression file decompression mechanism to flexibly control the number and size of files during the upgrade process;
[0147] Utilizing the integration feature of compressed files, some readable text files with abnormal hash value verification caused by changes in file content format after the internal content is transmitted over the network are compressed and integrated;
[0148] By taking advantage of the divisibility feature of compressed files, a single large file can be divided into multiple small compressed files.
[0149] The upgrade method provided by the present invention has the following advantages:
[0150] Flexible version control mechanism, different products and different versions can be more easily associated with each other, and the uniqueness of the hash value can ensure that when downloading files, only when the file content changes (produces differences), these changed files will be downloaded, including new files or modified files. Ensure that cross-product or cross-version upgrades can still be stable, reducing the traffic waste caused by downloading local existing files;
[0151] The self-upgrade mechanism of the upgrade program can complete the update of the upgrade program before downloading the main file of the upgrade package, and at the same time start the new upgrade program to process some necessary pre-operations before starting the new client, and then upgrade the main client;
[0152] The built-in exception list mechanism in the upgrade package can more flexibly configure the files to be downloaded to prevent data loss or file exceptions caused by the current upgrade package version overwriting the files with the same name as the existing local versions;
[0153] The upgrade package comes with a compression package sub-packaging configuration mode to reduce the extra traffic consumption caused by some large files due to network anomalies;
[0154] The built-in compression package configuration mode in the upgrade package avoids the problem of abnormal file hash values caused by text format reformatting during the transmission of some text files during file download, thus improving the upgrade success rate;
[0155] Finally, this solution can reduce traffic consumption, shorten the time for downloading and installing the upgrade, and increase the flexibility of client pre-startup configuration, while ensuring that the client is upgraded normally and does not affect usage.
[0156] Figure 4 The figure is a structural diagram of a multi-version installation package upgrade system based on file comparison according to a preferred embodiment of the present invention.
[0157] like Figure 4 As shown, the present invention provides a multi-version installation package upgrade system based on file comparison, the system comprising:
[0158] A submitting unit 401 is used to submit an upgrade version number and a product identification number of the upgrade program to the server, wherein the submitted upgrade version number is greater than the existing upgrade version number of the upgrade program;
[0159] The upload unit 402 is used to bind the upgrade version number with the product identification number; upload the upgrade package compressed file of the upgrade program upgrade package to the server;
[0160] The first processing unit 403 is used to decompress the received upgrade package compressed file through the server at the service end, and establish a corresponding upgrade version number directory in the OSS file server for the decompressed decompressed upgrade package file; traverse all decompressed upgrade package files corresponding to the upgrade version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgrade package file; combine the hash value, file name and relative path of each decompressed upgrade package file in the upgrade package compressed file to generate a json format content string; bind the generated json format content string with the upgrade version number; upload the decompressed upgrade package file to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file.
[0161] Preferably, the system further comprises a second processing unit, configured to:
[0162] Start the upgrade program through the client, and obtain the current local program version number and product identification number of the upgrade program recorded by the client;
[0163] The client assembles the current local program version number and product identification number, generates a request message, and submits the request message to the server;
[0164] The server parses the received request message to obtain the current local program version number and product identification number, and obtains the upgrade version number bound to the product identification number;
[0165] Based on the current local program version number and the upgrade version number, determine whether the local client needs to be upgraded.
[0166] Preferably, the second processing unit is also used to assemble the hash value corresponding to the upgrade version number, the json format content string and the download address corresponding to the upgrade version number of the OSS file server into a return message and send it to the client's upgrade program when it is determined that the local client needs to be upgraded.
[0167] Preferably, the second processing unit is further configured to parse the content of the returned message through the upgrade program of the client and download it:
[0168] Parsing each file in the upgrade package in the returned message and its corresponding hash value;
[0169] Obtaining a hash value of the local upgrade program, and determining whether the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program;
[0170] When it is determined that the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program, the hash value of the exception list file in the local installation directory is obtained, and the hash value thereof is determined to be consistent with the hash value of the exception list file in the upgrade package;
[0171] When it is determined that the hash value of the exception list file in the local installation directory is consistent with the hash value of the upgrade exception list file in the upgrade package, read the identification information table file that locally records the compressed files in the decompressed upgrade package;
[0172] The hash value correspondence table of each file in the upgrade package is screened through the upgrade exception list file and the identification information table file of the compressed files in the decompressed upgrade package to exclude the files that do not need to be downloaded;
[0173] Based on the hash value correspondence table of each file in the filtered upgrade package, assemble the download URL of each file to download the file.
[0174] Preferably, the second processing unit is also used to save the downloaded file in a temporary directory, and compare the hash values of the downloaded file with the hash value correspondence table of each file in the upgrade package. When the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0175] Preferably, the second processing unit is further used to read the information table file recording the compressed package file information to be decompressed in the temporary directory after all the files are downloaded successfully, and obtain the compressed package file name list to be decompressed;
[0176] Traverse the temporary directory, determine whether each file in the temporary directory is in the compressed package file name list, and copy the files that are not in the compressed package file name list to the client directory;
[0177] Decompress the compressed files in the download directory according to the compressed file name list;
[0178] Update the client to record the identification information table file of the compressed files in the decompressed upgrade package, delete all files in the temporary directory, and change the current version number in the registry to the upgraded version number.
[0179] Preferably, the second processing unit is further configured to assemble the download address URL of the upgrade program and complete the download of the file, and download the file to a temporary directory when it is determined that the hash value of the upgrade program in the upgrade package is inconsistent with the hash value of the local upgrade program;
[0180] The downloaded file is compared with the hash value of the upgrade program in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0181] Preferably, the second processing unit is further used to assemble the download address URL of the exception list file list and complete the download of the file, and download the file to a temporary directory when it is determined that the hash value of the exception list file in the local installation directory is inconsistent with the hash value of the upgrade exception list file in the upgrade package;
[0182] The downloaded file is compared with the hash value correspondence table of each file in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
[0183] A multi-version installation package upgrade system based on file comparison in a preferred embodiment of the present invention corresponds to a multi-version installation package upgrade method based on file comparison in another preferred embodiment of the present invention, which will not be described in detail here.
[0184] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product 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 codes. The schemes in the embodiments of the present invention may be implemented in various computer languages, for example, object-oriented programming language Java and literal scripting language JavaScript, etc.
[0185] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0186] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0187] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0188] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0189] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0190] The invention has been described above with reference to a few embodiments. However, it is readily apparent to a person skilled in the art that other embodiments than the ones disclosed above are equally within the scope of the invention, as defined by the appended patent claims.
[0191] Generally, all terms used in the claims are to be interpreted according to their ordinary meaning in the technical field, unless explicitly defined otherwise herein. All references to "a / said / the [means, components, etc.]" are to be openly interpreted as at least one instance of said means, components, etc., unless explicitly stated otherwise. The steps of any method disclosed herein do not necessarily have to be performed in the exact order disclosed, unless explicitly stated otherwise.
Claims
1. A method for upgrading a multi-version installation package based on file comparison, the method comprising: Submitting the upgrade version number and product identification number of the upgrade program to the server, wherein the submitted upgrade version number is greater than the existing upgrade version number of the upgrade program; Binding the upgrade version number with the product identification number; Upload the upgrade package compressed file of the upgrade program upgrade package to the server; Decompressing the received compressed upgrade package file through the server on the service end, and creating a corresponding upgrade version number directory in the OSS file server for the decompressed decompressed upgrade package file; Traverse all the decompressed upgrade package files corresponding to the upgrade version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgrade package file; Combine the hash value, file name, and relative path of each decompressed upgrade package file in the upgrade package compressed file to generate a json-formatted content string. Bind the generated json format content string to the upgraded version number; The decompressed upgrade package file is uploaded to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file.
2. The method according to claim 1, further comprising: Starting the upgrade program through the client, obtaining the current local program version number and product identification number of the upgrade program recorded by the client; The client assembles the current local program version number and the product identification number to generate a request message, and submits the request message to the server; The server parses the received request message to obtain the current local program version number and the product identification number, and obtains the upgrade version number bound to the product identification number; Based on the current local program version number and the upgrade version number, it is determined whether the program to be upgraded needs to be upgraded.
3. According to the method described in claim 2, when it is determined that the program to be upgraded needs to be upgraded, the server queries the hash value corresponding to the upgrade version number, the json format content string and the download address corresponding to the upgrade version number of the OSS file server, and assembles them into a return message to send to the upgrade program of the client.
4. According to the method of claim 3, the content of the returned message is parsed and downloaded by the upgrade program of the client: Parsing each file in the upgrade package in the returned message and its corresponding hash value; Obtaining a hash value of the local upgrade program, and determining whether the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program; When it is determined that the hash value of the upgrade program in the upgrade package is consistent with the hash value of the local upgrade program, the hash value of the exception list file in the local installation directory is obtained, and the hash value thereof is determined to be consistent with the hash value of the exception list file in the upgrade package; When it is determined that the hash value of the exception list file in the local installation directory is consistent with the hash value of the upgrade exception list file in the upgrade package, read the identification information table file that locally records the compressed files in the decompressed upgrade package; The hash value correspondence table of each file in the upgrade package is screened through the upgrade exception list file and the identification information table file of the compressed files in the decompressed upgrade package to exclude the files that do not need to be downloaded; Based on the hash value correspondence table of each file in the filtered upgrade package, assemble the download URL of each file to download the file.
5. The method according to claim 4, further comprising: When the downloaded file is saved in a temporary directory, the hash value of the downloaded file is compared with the hash value correspondence table of each file in the upgrade package. When the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
6. The method according to claim 5, further comprising: When all the files are downloaded successfully, read the information table file in the temporary directory that records the compressed package file information to be decompressed, and obtain the compressed package file name list that needs to be decompressed; Traverse the temporary directory, determine whether each file in the temporary directory is in the compressed package file name list, and copy the files that are not in the compressed package file name list to the client directory; Decompress the compressed files in the download directory according to the compressed file name list; Update the client to record the identification information table file of the compressed files in the decompressed upgrade package, delete all files in the temporary directory, and change the current version number in the registry to the upgraded version number.
7. The method according to claim 4, further comprising: When it is determined that the hash value of the upgrade program in the upgrade package is inconsistent with the hash value of the local upgrade program, assemble the download address URL of the upgrade program and complete the download of the file, and download the file to a temporary directory; The downloaded file is compared with the hash value of the upgrade program in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
8. The method according to claim 4, further comprising: When it is determined that the hash value of the exception list file in the local installation directory is inconsistent with the hash value of the upgrade exception list file in the upgrade package, assemble the download address URL of the exception list file list and complete the download of the file, and download the file to a temporary directory; The downloaded file is compared with the hash value correspondence table of each file in the upgrade package. If the comparison result is inconsistent, it is determined that the file download has failed and the download is retried.
9. A multi-version installation package upgrade system based on file comparison, the system comprising: A submitting unit, used to submit an upgrade version number and a product identification number of the upgrade program to the server, wherein the submitted upgrade version number is greater than an existing upgrade version number of the upgrade program; An uploading unit, used to bind the upgrade version number with the product identification number; Upload the upgrade package compressed file of the upgrade program upgrade package to the server; The first processing unit is used to decompress the received compressed upgrade package file through the server of the service end, and establish a corresponding upgrade version number directory for the decompressed decompressed upgrade package file in the OSS file server; traverse all decompressed upgrade package files corresponding to the upgrade version number directory, and generate a hash value corresponding to each file based on the content of each decompressed upgrade package file; Combine the hash value, file name and relative path of each decompressed upgrade package file in the upgrade package compressed file of each file to generate a json format content string; bind the generated json format content string to the upgrade version number; The decompressed upgrade package file is uploaded to the upgrade version number directory of the OSS file server based on the relative path in the upgrade package compressed file.
10. The system according to claim 9, further comprising a second processing unit, configured to: Starting the upgrade program through the client, obtaining the current local program version number and product identification number of the upgrade program recorded by the client; The client assembles the current local program version number and the product identification number to generate a request message, and submits the request message to the server; The server parses the received request message to obtain the current local program version number and the product identification number, and obtains the upgrade version number bound to the product identification number; Based on the current local program version number and the upgrade version number, it is determined whether the program to be upgraded needs to be upgraded.
Citation Information
Cited By
Remote file differential transmission and iteration method and device
CN120849355A