Patch data generation method and device, and electronic device

CN122733335APending Publication Date: 2026-09-11GUANGZHOU BOGUAN TELECOMM TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202610741332.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-05-26
Publication Date
2026-09-11

AI Technical Summary

Technical Problem

这使得服务器必须向终端分发完整的全量文件数据,导致补丁包体积显著膨胀,不仅占用了大量的网络传输资源和服务器存储资源,还增加了终端侧的数据下载与本地写入开销

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122733335A_ABST
    Figure CN122733335A_ABST
Patent Text Reader

Abstract

The application provides a patch data generation method and device and electronic equipment. In response to a game client generating a specified game event, a target event parameter corresponding to the specified game event is determined. For a target second file that does not form a first correspondence relationship, a target file corresponding to the target second file and a second correspondence relationship are determined based on file differences between a first file in first version data and the target second file. Target patch data is generated based on the first correspondence relationship, the second correspondence relationship, the first version data and second version data. The target patch data is used to control the target software running on a terminal device to update from the first version to the second version. This way ensures the integrity and correctness of the update process while maximizing the data volume of the generated patch data, improving user experience and reducing network costs for software service providers.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of software update technology, and more specifically, to a method, apparatus, and electronic device for generating patch data. Background Technology

[0002] In related technologies, when a server performs a software update, it typically establishes a correspondence between files in the old and new versions based on file identification information. For two files with identical file identifiers, the server calculates their differences and generates differential patch data. For files that exist in the new version but are missing in the old version, the server treats them as newly added files and packages their full data. For files that exist in the old version but are missing in the new version, they are treated as deleted files. Then, the server packages the differential patch data and the full data of the newly added files for the terminal device to download and complete the update.

[0003] Because the above matching method mainly relies on file identifiers, when the file name or storage path changes, even if the file content is highly similar, the server cannot establish a valid correspondence between the old and new versions, thus treating the file as a new file. This forces the server to distribute the complete full file data to the terminal, resulting in a significant increase in the size of the patch package. This not only consumes a large amount of network transmission and server storage resources but also increases the data download and local write overhead on the terminal side. Summary of the Invention

[0004] In view of this, the purpose of the present invention is to provide a method, apparatus and electronic device for generating patch data, so as to minimize the amount of generated patch data while ensuring the integrity and correctness of the update process, thereby improving user experience and reducing network costs for software service providers.

[0005] In a first aspect, embodiments of the present invention provide a method for generating patch data; the method includes: acquiring first version data and second version data of target software; the first version data includes multiple first files; the second version data includes multiple second files; determining a first correspondence based on the first version data and the second version data; the first correspondence indicates: a first file and a second file with the same file identifier; for a target second file that does not form a first correspondence, determining a target file corresponding to the target second file and a second correspondence based on the file differences between the first file in the first version data and the target second file; generating target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data; the target patch data is used to: update the target software running on a terminal device from the first version to the second version.

[0006] Secondly, embodiments of the present invention provide a patch data generation apparatus; the apparatus includes: a data acquisition module, configured to acquire first version data and second version data of target software; the first version data includes a plurality of first files; the second version data includes a plurality of second files; a first correspondence determination module, configured to determine a first correspondence based on the first version data and the second version data; the first correspondence indicates: a first file and a second file with the same file identifier; a second correspondence determination module, configured to, for a target second file for which no first correspondence has been formed, determine the target file corresponding to the target second file and the second correspondence based on the file differences between the first file in the first version data and the target second file; and a patch data generation module, configured to generate target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data; the target patch data is used to: update the target software running on the control terminal device from the first version to the second version.

[0007] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the above-described method for generating patch data.

[0008] Fourthly, embodiments of the present invention provide a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are invoked and executed by a processor, the machine-executable instructions cause the processor to implement the above-described method for generating patch data.

[0009] The embodiments of the present invention bring the following beneficial effects: The aforementioned method, apparatus, and electronic device for generating patch data acquire first version data and second version data of target software. The first version data includes multiple first files; the second version data includes multiple second files. Based on the first version data and the second version data, a first correspondence is determined. The first correspondence indicates a first file and a second file with the same file identifier. For target second files that do not form a first correspondence, based on the file differences between the first file in the first version data and the target second file, the target file corresponding to the target second file is determined, as well as a second correspondence. Based on the first correspondence, the second correspondence, the first version data, and the second version data, target patch data is generated. The target patch data is used to update the target software running on the terminal device from the first version to the second version. This method ensures the integrity and correctness of the update process while minimizing the amount of patch data generated, improving user experience, and reducing network costs for software service providers.

[0010] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention are realized and obtained in accordance with the structures particularly pointed out in the description, claims and drawings.

[0011] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0012] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0013] Figure 1 A flowchart illustrating a method for generating patch data according to an embodiment of the present invention; Figure 2 This is a schematic diagram of a patch data generation device provided in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0014] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0015] With the development of software technology, software is becoming increasingly large. For example, large software such as game clients and enterprise applications can reach GB to tens of GB in size and are usually updated frequently. If users need to download the complete new version data for each update, it will not only consume a lot of network bandwidth but also seriously affect the user experience. Therefore, incremental update technology has emerged.

[0016] The basic principle of incremental updates is to compare the file differences between the old and new versions of the software and only package the changed parts for users to download. After downloading this smaller "patch package," users can update their local old version to the new version, thus significantly reducing the amount of downloads.

[0017] In related technologies, incremental update schemes typically employ an "exact filename matching" approach. First, the old version data is scanned, and a file list A is created based on the storage paths and filenames of files in the old version data. Then, the new version data is scanned, and a file list B is created based on the storage paths and filenames of files in the new version data. Next, the filenames in lists A and B are compared one by one. For files with identical filenames, an incremental update algorithm for binary files (such as the bsdiff algorithm) is used to calculate the binary differences between the files, generating patch data. Files present in the new version but not in the old version are marked as "new files," and users need to download them in their entirety. Files present in the old version but not in the new version are marked as "deleted files." Finally, all patch data and new files need to be packaged together to form the final patch package.

[0018] This approach considers files as different versions of the same file if their filenames and paths are identical; otherwise, they are considered completely unrelated files. However, in actual software development, file renaming and directory reconfiguration are common operations. For example, a development team might rename the "modules" folder to "plugins," or move a dynamic link library from the "lib" directory to the "bin" directory. While such refactoring aids code organization and project management, it presents technical challenges for incremental updates.

[0019] The above method cannot identify file renaming or path adjustment, which usually leads to the following problems: 1. The renamed file was mistakenly identified as a newly created file, and the corresponding old version of the renamed file was mistakenly identified as a deleted file.

[0020] For example, when modules / game.dll is renamed to plugins / game.dll, the above method will assume that the old version of modules / game.dll has been deleted and the new version has added plugins / game.dll. This method forces users to download the complete plugins / game.dll, even if its contents are almost identical to those of modules / game.dll.

[0021] 2. The patch package size is much larger than the patch package generated based on the actual modified data.

[0022] In large projects, a single refactoring can involve adjusting the paths of dozens of files. If each moved file is treated as a "new file," the patch size can grow from a few MB to hundreds of MB, severely impacting the user experience. 3. Wasted bandwidth costs.

[0023] For software service providers, an increase in the amount of data downloaded by users means a significant rise in content delivery network (CDN) and bandwidth costs, especially with a large user base. Based on this, embodiments of the present invention provide a method, apparatus, and electronic device for generating patch data, which can be applied to display scenarios of interactive effects in graphical user interfaces.

[0024] See Figure 1 First, a method for generating patch data according to an embodiment of the present invention will be introduced. This method includes the following steps: Step S102: Obtain the first version data and the second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files.

[0025] The target software mentioned above can be social media software, game software, office software, system software, etc., without limitation. The first version data mentioned above is usually an older version of the target software, and the second version data mentioned above is usually a newer version of the target software. In this case, the target data generated by this method can update the target software to the newer version corresponding to the second version data. Alternatively, the first version data can be a newer version of the target software, and the second version data can be an older version of the target software. In this case, the target data generated by this method can restore the target software to the older version corresponding to the second version data.

[0026] The first version of the data typically includes multiple files. To distinguish it from the multiple files included in the second version of the data, the files in the first version of the data are referred to as the "first file," and the files in the second version of the data are referred to as the "second file."

[0027] When the second version of data corresponds to a new version, the second file can be identical to one of the multiple first files, or it can be generated by relevant staff or a pre-generated script that modifies a first file, or it can be newly created by relevant staff or a pre-generated script. Modifications to the first file typically include changing the filename, modifying the file content, and changing the storage path, etc., and are not restricted here.

[0028] When the second version of the data corresponds to the old version, the method for generating the first file is similar to the method for generating the second file included when the second version of the data corresponds to the new version, and will not be elaborated here.

[0029] Step S104: Based on the first version data and the second version data, determine the first correspondence; the first correspondence indicates: a first file and a second file with the same file identifier.

[0030] The first and second files indicated by the first correspondence are usually the same file, or they are either older versions of the file and newer versions obtained by modifying the older versions. These modifications typically do not include renaming the file (also known as "renaming"). When the version data includes multiple storage paths, these modifications also typically do not include changing the file storage paths.

[0031] When all file storage paths are identical in the version data, the aforementioned file identifier can include only the filename. Normally, the file identifier includes both the filename and the file storage path. The filename is an identifier of the file's existence, primarily composed of the filename and extension. The file storage path is a string used to locate the file's specific location on the storage device; it consists of the root directory, subdirectories at each level, and the filename, connected by specific separators. In this method, the storage path used as the file identifier is typically the storage path of each file relative to the storage path of the folder containing the version data, i.e., excluding the storage path of the folder containing the version data. By configuring the file identifier as a combination of the filename and the file storage path, or simplifying it to using only the filename based on the directory structure, it can flexibly adapt to different organization forms of version data. In scenarios with complex directory hierarchies, path information can effectively distinguish files with the same name in different directories, avoiding incorrect matching. In scenarios with flat directory hierarchies, using only the filename reduces identifier redundancy and matching computation, thus balancing matching accuracy and processing efficiency.

[0032] When generating new version data for the target software, old version files that do not require modification are typically reused, while old version files that require modification are modified. Therefore, two files with the same file identifier in two versions of the data are usually identical, or one file is a modification of the other. For each second file, its file identifier can be determined, and a first file with the same file identifier can be searched among multiple first files. Thus, a first correspondence can be established between the found first file and the second file.

[0033] Step S106: For the target second file that does not form a first correspondence, based on the file differences between the first file in the first version data and the target second file, determine the target file corresponding to the target second file and the second correspondence.

[0034] The second file data may include second files that do not form a first correspondence; that is, the first version data does not include a first file whose file identifier is the same as that of the second file. For convenience, the second file that does not form a first correspondence can be referred to as the target second file. The target second file may be generated when a first file is modified, and / or its storage path is modified; the target second file may also be newly created, without restriction.

[0035] If the first file data does not include first files that do not form a first correspondence, then all target second files can be identified as new files and added to the patch data. If the first file data includes first files that do not form a first correspondence, then the file differences between each first file and the target second file can be further determined, thereby identifying the target file corresponding to the target second file. Furthermore, it is determined that the target second file and its corresponding target file form a second correspondence.

[0036] When determining the file differences between the target second file and each first file that does not have a first correspondence, one can first identify the first files in each category that have the same file type as the target second file. File types can be Word documents, Excel documents, etc. Different file types have corresponding file difference comparison methods. For example, for Word documents, Word's built-in "Review & Compare" function can be used; for code and text files, file comparison tools such as Git diff, WinMerge, or Beyond Compare can be used to determine file differences. Furthermore, based on the file type of the target second file, one can determine the file differences between the corresponding target second file and the first files of the same type.

[0037] If there are multiple first files of the same type as the target second file among the first files that do not form a first correspondence, in one embodiment, the first file with the smallest file difference from the target second file can be determined as the target file corresponding to the target second file. In another embodiment, a similarity score based on content feature fingerprints can be generated for each target first file and target second file, for example, by using a locality-sensitive hashing algorithm to calculate the Hamming distance between the files, and the first file with the highest similarity score can be determined as the target file corresponding to the target second file. If there is only one first file of the same type as the target second file among the first files that do not form a first correspondence, then that first file can be determined as the target file corresponding to the target second file.

[0038] When different target second files correspond to the same target file, the file differences between each target second file and the target file can be compared, and the target second file with the smallest file difference can be determined to have a corresponding relationship with the target file, thereby ensuring that the correspondence between the first file and the second file is one-to-one.

[0039] Step S108: Based on the first correspondence, the second correspondence, the first version data, and the second version data, generate target patch data; the target patch data is used to update the target software running on the control terminal device from the first version to the second version.

[0040] In practical applications, it is necessary to generate patch data for the two files in each first correspondence and for the two files in each second correspondence. When the second version data includes a second file that does not form a first or second correspondence, this second file can be added as a new file, and corresponding patch data can be generated. Furthermore, the above-mentioned patch data can be packaged to generate the target patch data.

[0041] After the user control terminal device obtains the target patch data, it can update the version data of the target software running on the terminal device using the target patch data. The local version data of the target software on the terminal device is usually consistent with the first version data. By using the target patch data, the local version data can be updated to the second version data, thereby updating the target software running on the terminal device from the original first version to the second version.

[0042] The above-described method for generating patch data involves obtaining first version data and second version data of the target software. The first version data includes multiple first files, and the second version data includes multiple second files. Based on the first and second version data, a first correspondence is determined. The first correspondence indicates a first file and a second file with the same file identifier. For target second files that do not form a first correspondence, the target file corresponding to the target second file and a second correspondence are determined based on the file differences between the first file in the first version data and the target second file. Based on the first and second correspondences, the first and second version data, target patch data is generated. The target patch data is used to update the target software running on the terminal device from the first version to the second version. This method ensures the integrity and correctness of the update process while minimizing the amount of patch data generated, improving user experience, and reducing network costs for software service providers.

[0043] The following embodiments provide an implementation method for determining a first correspondence based on first version data and second version data.

[0044] In practical applications, when the storage paths of the first files in the first version of the data are all the same, and the storage paths of the second files in the second version of the data are also the same, the file identifier mentioned above can simply be the filename. When the folder corresponding to the first version of the data includes subfolders, and / or the folder corresponding to the second version of the data includes subfolders, the file identifier is usually a combination of the filename and the file storage path.

[0045] In practical implementation, for each second file, it is necessary to search among multiple first files for a first file whose file identifier matches that of the second file. The found first file and the second file are then identified as having a first correspondence. Since only one filename can be stored under the same storage path, this method ensures a unique correspondence between the identified first and second files.

[0046] The following embodiments provide a method for determining the implementation of the target file corresponding to the target second file based on the file differences between the first file and the target second file in the first version data.

[0047] For each target second file, it is necessary to determine the file differences between this target second file and each of the first files that do not form a first correspondence. In specific implementation, for a given target second file, it is necessary to determine the file differences between this target second file and each of the target first files that do not form a first correspondence. For example, when the first files that do not form a first correspondence include A, B, and C, for the target second file D, it is necessary to determine the file differences between D and A, the file differences between D and B, and the file differences between D and C.

[0048] When determining the file differences between the target second file and the target first file, the target first file can be used as the original file to generate differential patch data between the target second file and the original file. This differential patch data is then used to define the file differences between the target second file and the target first file. In practice, the patch generation algorithm can be determined based on the file types of the target second file and the target first file. For example, for text files, the Myers algorithm or JSON difference algorithm can be used; for binary files, the BSDiff algorithm or xdelta algorithm can be used. The specific algorithm can be chosen according to requirements and is not limited here.

[0049] When the target second file is a newly added file, the differences between it and each of the target first files are usually significant, making it impractical to determine the target file corresponding to the target second file from the target first files. To avoid this, it is also necessary to determine the file differences between the target second file and an empty file. When the target second file is a newly added file, the file differences between the target second file and an empty file are usually smaller than the file differences between the target second file and the target first file. In practice, the empty file is used as the original file to generate differential patch data between the target second file and the original file, and this differential patch data is determined as the file difference between the target second file and the empty file. By introducing an empty file as a benchmark comparison object, the system establishes a lower limit reference for the content differences of newly added files, avoiding the problem of forcibly establishing incorrect associations between newly added files and old version files and generating redundant patch data when a suitable old version source file is lacking. This ensures that newly added files can be correctly identified and packaged in the most compact patch form, maintaining the accuracy and completeness of patch data generation.

[0050] Furthermore, based on the file differences between the second target file and the first target file, and the file differences between the second target file and the corresponding empty file, the target file corresponding to the second target file is determined. Typically, the file with the smallest file difference between the second target file and the first target file or the empty file is determined as the target file corresponding to the second target file.

[0051] When the difference between the target second file and the target first file is differential patch data generated using the target first file as the original file, and the difference between the target second file and the empty file is differential patch data generated using the empty file as the original file, it is usually necessary to determine the file with the smallest amount of differential patch data generated as the original file among the target first file and the empty file as the target file corresponding to the target second file.

[0052] The following embodiments provide a method for determining the implementation of the target file corresponding to the target second file based on the file differences between the first file and the target second file in the first version data.

[0053] After determining the first correspondence, for each first correspondence, the first file in the first correspondence is used as the first original file to generate the first difference patch data between the second file in the first correspondence and the first original file.

[0054] After determining the second correspondence, for each second correspondence, it is necessary to generate second differential patch data between the second file and the second original file, using the target file (excluding the second file) in the second correspondence as the second original file. If differential patch data between the second file and the target file has already been generated during the determination of the second correspondence, it is not necessary to regenerate the differential patch data.

[0055] Furthermore, target patch data needs to be generated based on the first and second differential patch data. When the second correspondence determined in the above manner may include empty files, even if the second file is a newly added file, the second file has already formed a second correspondence with the empty file. Therefore, it is not necessary to consider the patch data corresponding to the second file in the second version data, as this data is already included in the generated second differential patch data.

[0056] The following embodiments provide a specific implementation of the above-mentioned patch data generation method, taking the first version data as the old version data and the second version data as the new version data.

[0057] This process employs an intelligent matching strategy that "speaks with real data." Instead of relying on unreliable heuristics such as filenames and file sizes, it determines the similarity of different file pairs by actually calculating the size of the binary difference patch data. The smaller the patch, the more similar the two files are, and the more likely they are a renaming relationship.

[0058] Specifically, each new file needs to attempt to generate patches from all possible old files, and the optimal file mapping should be selected by comparing patch sizes. Simultaneously, a competition mechanism should be established to ensure that each old file is assigned to at most one new file, achieving global optimization.

[0059] This process, taking the file identifier as the filename and not involving the storage path (which can be considered as no path movement), is implemented as follows: 1. Locate files with identical filenames and paths in both the old and new versions, directly determine the first correspondence, and generate patch data.

[0060] For example, the file names for the old version data are as follows: config.dll, main.exe, data.pak, modules / game.dll, menu.exe, utils / helper.dll; the file names for the new version data are as follows: config.dll, main.exe, data.pak, plugins / game.dll, ui / newmenu.exe, lib / helper.dll.

[0061] The following first correspondence can then be determined: The config.dll file in the old version data corresponds to the config.dll file in the new version data; The main.exe file in the old version of the data corresponds to the main.exe file in the new version of the data; The data.pak file in the old version corresponds to the data.pak file in the new version. The modules / game.dll file in the old version data could not form a primary correspondence, becoming a lone file; The menu.exe file in the old version data could not form a primary correspondence, thus becoming an isolated file; The utils / helper.dll file in the old version data could not form a primary correspondence and became an isolated file; In the new version's data, plugins / game.dll cannot form a primary correspondence and has become an isolated file. In the new version of the data, ui / newmenu.exe cannot form a primary correspondence and becomes an isolated file. In the new version, lib / helper.dll cannot form a primary correspondence and has become an isolated file.

[0062] 2. Generate two lists of logout files: a new version logout file and an old version logout file. The new version includes the following files: plugins / game.dll, ui / newmenu.exe, and lib / helper.dll; The old version's single files included: modules / game.dll, menu.exe, and utils / helper.dll.

[0063] Instead of directly assuming that these isolated files are added or deleted, the new version attempts to generate patches from each isolated file in the old version for each isolated file.

[0064] 3. Establish candidate relationships and calculate patch size.

[0065] Create a candidate source list for each new version of the single file (equivalent to the "target second file" mentioned above). This candidate source list includes all old version single files and empty files (indicating that they are generated from scratch).

[0066] Taking plugins / game.dll as an example, its candidate sources include: modules / game.dll, menu.exe, utils / helper.dll, and an empty file.

[0067] Then, for each new version, the patch size for each combination is actually calculated.

[0068] For the file plugins / game.dll: The patch generated from modules / game.dll is 500KB; the patch generated from menu.exe is 45MB; the patch generated from utils / helper.dll is 48MB; and the patch generated from an empty file requires downloading the complete file (50MB).

[0069] For the file ui / newmenu.exe: Generating a patch from modules / game.dll results in a 35MB file; generating a patch from menu.exe results in an 800KB file; generating a patch from utils / helper.dll results in a 40MB file; generating from an empty file requires downloading the complete file, which is 42MB.

[0070] For the file lib / helper.dll: Generating a patch from modules / game.dll results in a 30MB file; generating a patch from menu.exe results in a 25MB file; generating a patch from utils / helper.dll results in a 200KB file; generating from an empty file requires downloading the complete file (2MB).

[0071] 4. Select the optimal source file (i.e., determine the target file corresponding to the second target file).

[0072] The patch size calculated for each attempt is compared, and the option with the smallest patch size is selected as the optimal source for the new file. For example, based on the data above, choosing modules / game.dll as the source file would save the most space for plugins / game.dll.

[0073] 5. Generate the final patch package.

[0074] Based on the previous calculations, the option with the smallest patch size is selected for each new file: Select modules / game.dll as the source (500KB patch) for plugins / game.dll; Select menu.exe as the source for ui / newmenu.exe (800KB patch); lib / helper.dll selects utils / helper.dll as the source (200KB patch).

[0075] Based on the selection results, determine the patch generation method for each file: plugins / game.dll: Generates a differential patch (500KB) from modules / game.dll; ui / newmenu.exe: Generates a differential patch (800KB) from menu.exe; lib / helper.dll: Generates a differential patch (200KB) from utils / helper.dll.

[0076] Comparison with existing solutions: The existing calculation method requires downloading plugins / game.dll (50MB) + ui / newmenu.exe (42MB) + lib / helper.dll (2MB) = 94MB; the above method only requires downloading 500KB + 800KB + 200KB = 1.5MB, saving 98.4% of the space.

[0077] In this process, instead of only considering files with the same name, each new file tries all possible old files to ensure that no potential renaming relationships are overlooked; and instead of relying on indirect indicators such as filename and file size, file similarity is evaluated through actual patch calculation results, which is more accurate and reliable; by comparing the actual patch size, the best source file is selected for each new file to ensure that the overall patch package reaches the minimum size.

[0078] This method allows renamed files that previously required a full download to now only require a small differential patch. In typical scenarios, patch package size can be reduced by 60%-98%. This reduction in patch package size directly translates to shorter download times and lower bandwidth consumption, especially noticeable in mobile network environments. It minimizes the amount of data that needs to be transmitted, significantly reducing CDN and bandwidth costs. Furthermore, for regular updates that do not involve renaming, the direct pairing in the first step ensures the same processing efficiency as traditional solutions, without incurring additional overhead.

[0079] For the above method embodiments, see Figure 2 A patch data generation apparatus is shown; the apparatus includes: Data acquisition module 202 is used to acquire first version data and second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files; The first correspondence determination module 204 is used to determine a first correspondence based on the first version data and the second version data; the first correspondence indicates: a first file and a second file with the same file identifier; The second correspondence determination module 206 is used to determine the target file corresponding to the target second file and the second correspondence relationship based on the file differences between the first file in the first version data and the target second file for the target second file that has not formed a first correspondence relationship; The patch data generation module 208 is used to generate target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data; the target patch data is used to update the target software running on the control terminal device from the first version to the second version.

[0080] The aforementioned patch data generation apparatus acquires first version data and second version data of the target software. The first version data includes multiple first files; the second version data includes multiple second files. Based on the first version data and the second version data, a first correspondence is determined. The first correspondence indicates a first file and a second file with the same file identifier. For target second files that do not form a first correspondence, based on the file differences between the first file in the first version data and the target second file, the target file corresponding to the target second file is determined, as well as a second correspondence. Based on the first correspondence, the second correspondence, the first version data, and the second version data, target patch data is generated. The target patch data is used to update the target software running on the terminal device from the first version to the second version. This method ensures the integrity and correctness of the update process while minimizing the amount of generated patch data, improving user experience, and reducing network costs for software service providers.

[0081] The aforementioned file identifier includes the filename and / or the file storage path; the step of determining the first correspondence based on the first version data and the second version data includes: for each second file, searching among multiple first files for a first file whose file identifier is the same as the file identifier of the second file; and determining that the found first file and the second file form a first correspondence.

[0082] The aforementioned second correspondence determination module is further configured to: for each target first file in a first file where no first correspondence has been formed, determine the file difference between the target second file and the target first file; determine the file difference between the target second file and the empty file; and, based on the file difference between the target second file and the target first file, and the file difference between the target second file and the empty file, determine the target file corresponding to the target second file.

[0083] The second correspondence determination module is further configured to: use the target first file as the original file, generate differential patch data between the target second file and the original file, and determine the differential patch data as the file difference between the target second file and the target first file.

[0084] The aforementioned second correspondence determination module is also used to: determine the file with the smallest file difference from the target second file among the target first file and the empty file as the target file corresponding to the target second file.

[0085] The file differences between the target second file and the target first file include differential patch data generated using the target first file as the original file; the file differences between the target second file and the empty file include differential patch data generated using the empty file as the original file; the second correspondence determination module is further used to: determine the file with the smallest amount of differential patch data generated as the original file among the target first file and the empty file as the target file corresponding to the target second file.

[0086] The patch data generation module described above is further configured to: for each first correspondence, using the first file in the first correspondence as the first original file, generate first differential patch data between the second file in the first correspondence and the first original file; for each second correspondence, using the target file in the second correspondence excluding the second file as the second original file, generate second differential patch data between the second file in the second correspondence and the second original file; and generate target patch data based on the first differential patch data and the second differential patch data.

[0087] This embodiment also provides an electronic device, including a processor and a memory. The memory stores machine-executable instructions that can be executed by the processor. The processor executes the machine-executable instructions to implement the above-mentioned patch data generation method, for example: Obtain first version data and second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files; based on the first version data and the second version data, determine a first correspondence; the first correspondence indicates: a first file and a second file with the same file identifier; for target second files that do not form a first correspondence, based on the file differences between the first file in the first version data and the target second file, determine the target file corresponding to the target second file, and the second correspondence; based on the first correspondence, the second correspondence, the first version data, and the second version data, generate target patch data; the target patch data is used to: update the target software running on the control terminal device from the first version to the second version.

[0088] The above method ensures the integrity and correctness of the update process while minimizing the amount of generated patch data, improving user experience, and reducing network costs for software service providers.

[0089] Optionally, the above file identifier includes the file name and / or the file storage path; the step of determining the first correspondence based on the first version data and the second version data includes: for each second file, searching among the multiple first files for a first file whose file identifier is the same as the file identifier of the second file; and determining that the found first file and the second file form a first correspondence.

[0090] Optionally, the step of determining the target file corresponding to the target second file based on the file differences between the first file and the target second file in the first version data includes: for each target first file in the first file that does not form a first correspondence, determining the file differences between the target second file and the target first file; determining the file differences between the target second file and the empty file; and determining the target file corresponding to the target second file based on the file differences between the target second file and the target first file, and the file differences between the target second file and the empty file.

[0091] Optionally, the steps for determining the file differences between the target second file and the target first file include: using the target first file as the original file, generating differential patch data between the target second file and the original file, and determining the differential patch data as the file differences between the target second file and the target first file.

[0092] Optionally, the step of determining the target file corresponding to the target second file based on the file differences between the target second file and the target first file, and the file differences between the target second file and the empty file, includes: determining the file with the smallest file difference between the target second file and the target first file and the empty file as the target file corresponding to the target second file.

[0093] Optionally, the file differences between the target second file and the target first file include differential patch data generated using the target first file as the original file; the file differences between the target second file and the empty file include differential patch data generated using the empty file as the original file; the step of determining the file with the smallest file difference between the target first file and the empty file and the target second file as the target file corresponding to the target second file includes: determining the file with the smallest amount of differential patch data generated as the original file among the target first file and the empty file as the target file corresponding to the target second file.

[0094] Optionally, the step of generating target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data includes: for each first correspondence, using the first file in the first correspondence as the first original file, generating first differential patch data between the second file in the first correspondence and the first original file; for each second correspondence, using the target file excluding the second file in the second correspondence as the second original file, generating second differential patch data between the second file in the second correspondence and the second original file; and generating target patch data based on the first differential patch data and the second differential patch data.

[0095] Furthermore, Figure 3 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 100, the communication interface 103 and the memory 101 connected via the bus 102.

[0096] The memory 101 may include high-speed random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, metropolitan area network, etc. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 3 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0097] Processor 100 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 100 or by instructions in software form. The processor 100 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams of the invention in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the method invented in conjunction with the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 101, and the processor 100 reads the information from memory 101 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0098] This embodiment also provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by the processor, the machine-executable instructions cause the processor to implement the above-described method for generating patch data.

[0099] The patch data generation method, apparatus, and electronic device provided in this invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments, for example: Obtain first version data and second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files; based on the first version data and the second version data, determine a first correspondence; the first correspondence indicates: a first file and a second file with the same file identifier; for target second files that do not form a first correspondence, based on the file differences between the first file in the first version data and the target second file, determine the target file corresponding to the target second file, and the second correspondence; based on the first correspondence, the second correspondence, the first version data, and the second version data, generate target patch data; the target patch data is used to: update the target software running on the control terminal device from the first version to the second version.

[0100] The above method ensures the integrity and correctness of the update process while minimizing the amount of generated patch data, improving user experience, and reducing network costs for software service providers.

[0101] Optionally, the above file identifier includes the file name and / or the file storage path; the step of determining the first correspondence based on the first version data and the second version data includes: for each second file, searching among the multiple first files for a first file whose file identifier is the same as the file identifier of the second file; and determining that the found first file and the second file form a first correspondence.

[0102] Optionally, the step of determining the target file corresponding to the target second file based on the file differences between the first file and the target second file in the first version data includes: for each target first file in the first file that does not form a first correspondence, determining the file differences between the target second file and the target first file; determining the file differences between the target second file and the empty file; and determining the target file corresponding to the target second file based on the file differences between the target second file and the target first file, and the file differences between the target second file and the empty file.

[0103] Optionally, the steps for determining the file differences between the target second file and the target first file include: using the target first file as the original file, generating differential patch data between the target second file and the original file, and determining the differential patch data as the file differences between the target second file and the target first file.

[0104] Optionally, the step of determining the target file corresponding to the target second file based on the file differences between the target second file and the target first file, and the file differences between the target second file and the empty file, includes: determining the file with the smallest file difference between the target second file and the target first file and the empty file as the target file corresponding to the target second file.

[0105] Optionally, the file differences between the target second file and the target first file include differential patch data generated using the target first file as the original file; the file differences between the target second file and the empty file include differential patch data generated using the empty file as the original file; the step of determining the file with the smallest file difference between the target first file and the empty file and the target second file as the target file corresponding to the target second file includes: determining the file with the smallest amount of differential patch data generated as the original file among the target first file and the empty file as the target file corresponding to the target second file.

[0106] Optionally, the step of generating target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data includes: for each first correspondence, using the first file in the first correspondence as the first original file, generating first differential patch data between the second file in the first correspondence and the first original file; for each second correspondence, using the target file excluding the second file in the second correspondence as the second original file, generating second differential patch data between the second file in the second correspondence and the second original file; and generating target patch data based on the first differential patch data and the second differential patch data.

[0107] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the system and apparatus described above can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0108] Furthermore, in the description of the embodiments of the present invention, unless otherwise explicitly specified and limited, the terms "installation," "connection," and "linking" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in the present invention based on the specific circumstances.

[0109] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0110] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are used only for the convenience of describing the invention and for simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, they should not be construed as limitations on the invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.

[0111] Finally, it should be noted that the above embodiments are merely specific implementations of the present invention, used to illustrate the technical solutions of the present invention, and not to limit it. The scope of protection of the present invention is not limited thereto. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments within the technical scope disclosed in the present invention, or make equivalent substitutions for some of the technical features; and these modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be covered within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for generating patch data, characterized in that, The method includes: Obtain first version data and second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files. Based on the first version data and the second version data, a first correspondence is determined; the first correspondence indicates that there is a first file and a second file with the same file identifier; For a target second file that does not form the first correspondence, based on the file differences between the first file in the first version data and the target second file, the target file corresponding to the target second file and the second correspondence are determined; Based on the first correspondence, the second correspondence, the first version data, and the second version data, target patch data is generated; the target patch data is used to update the target software running on the terminal device from the first version to the second version.

2. The method according to claim 1, characterized in that, The file identifier includes the file name and / or the file storage path; The step of determining the first correspondence based on the first version data and the second version data includes: For each of the second files, find the first file whose file identifier is the same as that of the second file from the plurality of first files; The first file found is determined to form a first correspondence with the second file.

3. The method according to claim 1, characterized in that, The step of determining the target file corresponding to the target second file based on the file differences between the first file that does not form the first correspondence relationship and the target second file includes: For each target first file in a first file for which the first correspondence has not been formed, determine the file differences between the target second file and the target first file; Determine the file differences between the target second file and the empty file; Based on the file differences between the target second file and the target first file, and the file differences between the target second file and the empty file, the target file corresponding to the target second file is determined.

4. The method according to claim 3, characterized in that, The step of determining the file differences between the target second file and the target first file includes: Using the target first file as the original file, differential patch data between the target second file and the original file is generated, and the differential patch data is determined as the file difference between the target second file and the target first file.

5. The method according to claim 3, characterized in that, The step of determining the target file corresponding to the target second file based on the file differences between the target second file and the target first file, and the file differences between the target second file and the corresponding empty file, includes: The file with the smallest file difference from the target second file among the target first file and the empty file is determined as the target file corresponding to the target second file.

6. The method according to claim 5, characterized in that, The file differences between the target second file and the target first file include differential patch data generated using the target first file as the original file; the file differences between the target second file and the empty file include differential patch data generated using the empty file as the original file; The step of determining the file with the smallest file difference between the target first file and the target empty file and the target second file as the target file corresponding to the target second file includes: Among the target first file and the empty file, the file with the smallest amount of differential patch data generated as the original file is determined as the target file corresponding to the target second file.

7. The method according to claim 1, characterized in that, The step of generating target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data includes: For each of the first correspondences, the first file in the first correspondence is used as the first original file to generate the first difference patch data between the second file in the first correspondence and the first original file; For each of the second correspondences, using the target file in the second correspondence excluding the second file as the second original file, generate the second differential patch data between the second file in the second correspondence and the second original file; Target patch data is generated based on the first differential patch data and the second differential patch data.

8. A patch data generation apparatus, characterized in that, The device includes: The data acquisition module is used to acquire first version data and second version data of the target software; the first version data includes multiple first files; the second version data includes multiple second files. The first correspondence determination module is used to determine a first correspondence based on the first version data and the second version data; the first correspondence indicates: a first file and a second file with the same file identifier; The second correspondence determination module is used to determine the target file corresponding to the target second file based on the file differences between the first file in the version data and the target second file for a target second file that has not formed the first correspondence relationship, and to determine the second correspondence relationship. The patch data generation module is used to generate target patch data based on the first correspondence, the second correspondence, the first version data, and the second version data; the target patch data is used to update the target software running on the terminal device from the first version to the second version.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the patch data generation method according to any one of claims 1-7.

10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the patch data generation method according to any one of claims 1-7.