A method, system, device, and storage medium for generating a patch

By automating patch generation, the problems of limited patch functionality and version compatibility in existing technologies are solved. This approach enables support for multiple formats and the setting of dependencies between patches, ensuring the correctness of upgrades and reducing costs.

CN115202701BActive Publication Date: 2026-11-06INSPUR GENERSOFT CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211041576.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-29
Publication Date
2026-11-06
Estimated Expiration
2042-08-29

AI Technical Summary

Technical Problem

Existing technologies generate patches with limited functionality, poor version compatibility, and a lack of dependencies and relationships between multiple patches, leading to errors during installation and increased delivery costs.

Method used

By automating patch generation, multiple formats are supported, accommodating program upgrades across different versions, and dependency relationships between patches are set to ensure correct installation.

Benefits of technology

It automates the artifact-to-patch process, supports various deployment and upgrade methods, ensures upgrade accuracy, and reduces the risk and cost of installation errors.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115202701B_ABST
    Figure CN115202701B_ABST
Patent Text Reader

Abstract

The application provides a method, system, device and storage medium for generating a patch, the method comprising: in response to receiving a request for publishing a new patch, determining a format corresponding to the new patch according to the request; determining a start version and an end version of source code according to the request, comparing the start version and the end version to determine modification content; determining a storage location of the modification content according to configuration of a file directory; and generating the new patch according to the format, the modification content and the storage location. The patch generated by the application supports multiple forms, meets the needs of deployment and upgrading in different scenarios, takes into account various versions of programs, directly upgrades, and sets an association relationship for multiple patches, thereby ensuring the correctness of the final upgrade.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computers, and more specifically, to a method, system, apparatus, and storage medium for generating patches. Background Technology

[0002] A patch is a set of files released to address problems exposed during the use of a software system or operating system. The industry commonly generates artifacts directly by compiling code, and then creates patches manually or using tools. While the compilation process can be automated, patch generation is not. Furthermore, patches generated by current technologies often have limited functionality, poor version compatibility, and a lack of dependencies and relationships between multiple patches, leading to various errors during installation and significantly increasing delivery costs. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide a method, system, computer device, and computer-readable storage medium for generating patches. This invention can automate the process from artifact to patch, solving the tediousness and risks of manual generation. Furthermore, the patches generated by this method and system support multiple formats to meet the deployment and upgrade needs of different scenarios. It accommodates various versions of the program, enabling direct upgrades. Additionally, it supports setting association relationships for multiple patches to ensure the correctness of the final upgrade.

[0004] To achieve the above objectives, one aspect of the present invention provides a method for generating a patch, comprising the following steps: in response to receiving a request to release a new patch, determining the format corresponding to the new patch according to the request; determining the start version and end version of the source code according to the request, comparing the start version and the end version to determine the modified content; determining the storage location of the modified content according to the configuration of the file directory; and generating a new patch according to the format, modified content, and storage location.

[0005] In some implementations, the method further includes: in response to the existence of multiple new patches, setting the dependencies of the multiple new patches based on dependencies and versions in the source code.

[0006] In some implementations, comparing the starting version and the ending version to determine the modifications includes: marking the modifications as new in response to the ending version adding files relative to the starting version; marking the modifications as modified in response to the ending version having files identical to the starting version and having been modified; and marking the modifications as deleted in response to the ending version reducing files relative to the starting version.

[0007] In some implementations, determining the storage location of the modified content based on the configuration of the file directory includes: renaming the directory so that the same file in the starting version and the ending version has the same directory configuration in the starting version and the ending version, in response to the inconsistency between the directories configured for the same file.

[0008] In another aspect of this invention, a system for generating patches is provided, comprising: a format module configured to, in response to receiving a request to release a new patch, determine the format corresponding to the new patch according to the request; a comparison module configured to, according to the request, determine a start version and an end version of the source code, and compare the start version and the end version to determine the modified content; a location module configured to, according to the configuration of a file directory, determine the storage location of the modified content; and an execution module configured to, according to the format, the modified content, and the storage location, generate a new patch.

[0009] In some implementations, the system also includes a relationship module configured to: in response to the existence of multiple new patches, set the dependencies of multiple new patches based on dependencies and versions in the source code.

[0010] In some implementations, the comparison module is configured to: mark the modified content as newly added in response to the end version having added files relative to the start version; mark the modified content as modified in response to the end version having files identical to the start version and having been modified; and mark the modified content as deleted in response to the end version having fewer files relative to the start version.

[0011] In some implementations, the location module is configured to: rename the directory so that the directories configured for the same file in the starting version and the ending version are consistent, in response to inconsistencies in the directories of the same file in the starting version and the ending version.

[0012] In another aspect of the present invention, a computer device is provided, comprising: at least one processor; and a memory storing computer instructions executable on the processor, the instructions, when executed by the processor, implementing the steps of the method described above.

[0013] In another aspect, the present invention provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described method steps.

[0014] This invention offers the following beneficial technical effects: it automates the process from artifact to patch, eliminating the tediousness and risks of manual generation. Furthermore, the patches generated by this method and system support multiple formats, meeting the deployment and upgrade needs of different scenarios. It accommodates various program versions, enabling direct upgrades. Additionally, it supports setting association relationships for multiple patches, ensuring the correctness of the final upgrade. Attached Figure Description

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

[0016] Figure 1 A schematic diagram illustrating an embodiment of the patch generation method provided by the present invention;

[0017] Figure 2 A schematic diagram of an embodiment of the patch generation system provided by the present invention;

[0018] Figure 3 A schematic diagram of the hardware structure of an embodiment of the computer device for generating patches provided by the present invention;

[0019] Figure 4 This is a schematic diagram of an embodiment of a computer storage medium for generating patches provided by the present invention. Detailed Implementation

[0020] To make the objectives, technical solutions, and advantages of the present invention clearer, the embodiments of the present invention will be further described in detail below with reference to specific examples and the accompanying drawings.

[0021] It should be noted that all uses of "first" and "second" in the embodiments of the present invention are for the purpose of distinguishing two entities or parameters with the same name but different names. It is clear that "first" and "second" are only for the convenience of expression and should not be construed as limiting the embodiments of the present invention. Subsequent embodiments will not explain this in detail.

[0022] In a first aspect, an embodiment of a method for generating patches is proposed. Figure 1 The diagram shown is an embodiment of the patch generation method provided by the present invention. Figure 1 As shown, the embodiments of the present invention include the following steps:

[0023] S1. In response to receiving a request to release a new patch, determine the format corresponding to the new patch based on the request;

[0024] S2. Determine the starting and ending versions of the source code according to the request, and compare the starting and ending versions to determine the modifications.

[0025] S3. Determine the storage location of the modified content based on the file directory configuration; and

[0026] S4. Generate a new patch based on the format, modified content, and storage location.

[0027] In response to receiving a request to release a new patch, the format corresponding to the new patch is determined based on the request.

[0028] This invention supports generating multiple patch formats. Currently, most companies in the industry directly compress the files that need updating into zip packages. This method only supports a limited format and cannot meet all deployment modes. For example, on domestic dedicated machines, RPM packages are required for installation; in container environments, images are required for deployment. This invention allows configuration of automatically generated patch formats, supporting zip, RPM, Docker images, etc., to meet various deployment methods.

[0029] The starting and ending versions of the source code are determined according to the request, and the starting and ending versions are compared to determine the modifications.

[0030] This invention supports version control. During software system development, source code is submitted, compiled using a DevOps pipeline, packaged, and pushed to a repository. During code submission, a version is upgraded for any changes made, such as a JAR file in Java, a NuGet package in C#, or an npm package in JavaScript. Each source code submission is marked as a version. Depending on the needs of different projects, two submission versions can be selected arbitrarily. The system will automatically compare the two versions, identify the modified files, and generate patches from the modified files.

[0031] In some implementations, comparing the starting version and the ending version to determine the modifications includes: marking the modifications as new in response to the ending version adding files relative to the starting version; marking the modifications as modified in response to the ending version having files identical to the starting version and having been modified; and marking the modifications as deleted in response to the ending version reducing files relative to the starting version.

[0032] The location where the modified content is stored is determined based on the configuration of the file directory.

[0033] This invention supports setting internal directory structures and orchestrating execution actions within patches. Software systems typically have specific directory structures, and patches generated using conventional methods often have flat, linear files, making them difficult to manipulate. This invention allows setting the storage directory for files within the patch, directly matching the software system directory for a clearer hierarchical structure. It also supports orchestrating execution actions, such as renaming a directory or deleting a file during a software system update. Patches generated using conventional methods can only add or modify files, not rename or overwrite them. This invention allows setting a storage path for each file and orchestrating path and file actions to solve the renaming and deletion problems.

[0034] In some implementations, determining the storage location of the modified content based on the configuration of the file directory includes: renaming the directory so that the same file in the starting version and the ending version has the same directory configuration in the starting version and the ending version, in response to the inconsistency between the directories configured for the same file.

[0035] A new patch will be generated based on the specified format, modified content, and storage location.

[0036] In some implementations, the method further includes: in response to the existence of multiple new patches, setting the dependencies of the multiple new patches based on dependencies and versions in the source code.

[0037] This invention supports dependency relationships between patches. During a typical system upgrade, more than one patch needs to be installed. Ordinary patches cannot support dependency settings, leading to incorrect installation order during the installation of multiple patches, resulting in disordered software system file updates, and in severe cases, rendering the entire software unusable after the update. Patches generated by DevOps in this invention automatically set patch dependencies based on the dependencies and versions in the source code, avoiding installation order issues.

[0038] This invention also supports extended patch actions. When DevOps automatically generates patches, additional extended actions can be set. For example, during an upgrade, a configuration file containing customized content may need to be modified. This file cannot be directly overwritten; instead, the file's content needs to be dynamically loaded before updating a specific node. If the final version has more extended modifications than the initial version, this invention will generate the extended actions into the patch.

[0039] It should be noted that the steps in each embodiment of the above-described method for generating patches can be interchanged, substituted, added, or deleted. Therefore, these reasonable permutations and combinations of the method for generating patches should also fall within the protection scope of this invention, and the protection scope of this invention should not be limited to the embodiments.

[0040] Based on the above objectives, a second aspect of this invention provides a system for generating patches. For example... Figure 2 As shown, system 200 includes the following modules: a format module, configured to determine the format corresponding to the new patch according to the request in response to receiving a request to release a new patch; a comparison module, configured to determine the start version and end version of the source code according to the request, and compare the start version and the end version to determine the modified content; a location module, configured to determine the storage location of the modified content according to the configuration of the file directory; and an execution module, configured to generate a new patch according to the format, modified content and storage location.

[0041] In some implementations, the system also includes a relationship module configured to: in response to the existence of multiple new patches, set the dependencies of multiple new patches based on dependencies and versions in the source code.

[0042] In some implementations, the comparison module is configured to: mark the modified content as newly added in response to the end version having added files relative to the start version; mark the modified content as modified in response to the end version having files identical to the start version and having been modified; and mark the modified content as deleted in response to the end version having fewer files relative to the start version.

[0043] In some implementations, the location module is configured to: rename the directory so that the directories configured for the same file in the starting version and the ending version are consistent, in response to inconsistencies in the directories of the same file in the starting version and the ending version.

[0044] Based on the above objectives, a third aspect of the present invention provides a computer device, comprising: at least one processor; and a memory storing computer instructions executable on the processor, the instructions being executed by the processor to perform the following steps: S1, in response to receiving a request to release a new patch, determining the format corresponding to the new patch according to the request; S2, determining a start version and an end version of the source code according to the request, and comparing the start version and the end version to determine the modified content; S3, determining the storage location of the modified content according to a configuration of a file directory; and S4, generating a new patch according to the format, the modified content, and the storage location.

[0045] In some implementations, the method further includes: in response to the existence of multiple new patches, setting the dependencies of the multiple new patches based on dependencies and versions in the source code.

[0046] In some implementations, comparing the starting version and the ending version to determine the modifications includes: marking the modifications as new in response to the ending version adding files relative to the starting version; marking the modifications as modified in response to the ending version having files identical to the starting version and having been modified; and marking the modifications as deleted in response to the ending version reducing files relative to the starting version.

[0047] In some implementations, determining the storage location of the modified content based on the configuration of the file directory includes: renaming the directory so that the same file in the starting version and the ending version has the same directory configuration in the starting version and the ending version, in response to the inconsistency between the directories configured for the same file.

[0048] like Figure 3 The diagram shown is a hardware structure schematic of an embodiment of the computer device for generating patches provided by the present invention.

[0049] For example Figure 3 The device shown is an example, which includes a processor 301 and a memory 302.

[0050] Processor 301 and memory 302 can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.

[0051] The memory 302, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer-executable programs, and modules, such as the program instructions / modules corresponding to the patch generation method in this embodiment. The processor 301 executes various server functions and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 302, thereby implementing the patch generation method.

[0052] Memory 302 may include a program storage area and a data storage area. The program storage area may store the operating system and applications required for at least one function; the data storage area may store data created according to the patch generation method, etc. Furthermore, memory 302 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other non-volatile solid-state storage device. In some embodiments, memory 302 may optionally include memory remotely located relative to processor 301, and these remote memories can be connected to the local module via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.

[0053] One or more methods for generating patches are stored in memory 302. When executed by processor 301, the method for generating patches in any of the above method embodiments is executed.

[0054] Any embodiment of the computer device that performs the above-described method for generating patches can achieve the same or similar effects as any of the aforementioned method embodiments.

[0055] The present invention also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs a method for generating a patch.

[0056] like Figure 4 The diagram shown is a schematic representation of an embodiment of the computer storage medium for generating patches provided by the present invention. Figure 4 Taking the computer storage medium shown as an example, the computer-readable storage medium 401 stores a computer program 402 that, when executed by a processor, performs the above method.

[0057] Finally, it should be noted that those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program for generating patches can be stored in a computer-readable storage medium. When executed, the program can include the processes of the embodiments of the above methods. The storage medium for the program can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc. The above computer program embodiments can achieve the same or similar effects as any of the corresponding foregoing method embodiments.

[0058] The above are exemplary embodiments disclosed in this invention. However, it should be noted that various changes and modifications can be made without departing from the scope of the embodiments of this invention as defined by the claims. The functions, steps, and / or actions of the methods according to the disclosed embodiments described herein do not need to be performed in any particular order. Furthermore, although the elements disclosed in the embodiments of this invention may be described or claimed individually, they may be understood as multiple unless explicitly limited to a singular number.

[0059] It should be understood that, as used herein, the singular form “a” is intended to include the plural form as well, unless the context clearly supports an exception. It should also be understood that, as used herein, “and / or” refers to any and all possible combinations of one or more of the associated listed items.

[0060] The embodiment numbers disclosed in the above embodiments of the present invention are merely for description and do not represent the superiority or inferiority of the embodiments.

[0061] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0062] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention (including the claims) is limited to these examples. Within the framework of the invention, technical features of the above embodiments or different embodiments can be combined, and many other variations of different aspects of the invention exist, which are not provided in the details for the sake of brevity. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.

Claims

1. A method for generating patches, characterized in that, Includes the following steps: In response to receiving a request to release a new patch, the format corresponding to the new patch is determined based on the request; The starting and ending versions of the source code are determined according to the request, and the starting and ending versions are compared to determine the modifications. The storage location of the modified content is determined based on the configuration of the file directory; In response to the inconsistency between the directories configured for the same file in the starting version and the ending version, the directory is renamed to make the directories configured for the same file consistent in the starting version and the ending version. Generate a new patch based on the specified format, modified content, and storage location; In response to the existence of multiple new patches, the dependencies of multiple new patches are set according to the dependencies and versions in the source code; When generating the new patch, if there is an extended action configuration, a corresponding patch instruction is generated according to the extended action. The patch instruction is used to dynamically load the configuration file that needs to be modified and update the specified node when installing the new patch.

2. The method according to claim 1, characterized in that, The comparison between the initial version and the final version to determine the modifications includes: In response to the addition of files in the final version relative to the starting version, the modified content is marked as newly added; In response to the fact that the ending version is identical to the starting version file and has been modified, the modified content is marked as modified; and In response to the fact that the final version has fewer files compared to the initial version, the modifications are marked as deleted.

3. A system for generating patches, characterized in that, include: The format module is configured to determine the format of the new patch in response to a request to release a new patch. The comparison module is configured to determine the start and end versions of the source code based on the request, and compare the start and end versions to determine the modifications. The location module is configured to determine the storage location of the modified content based on the configuration of the file directory; as well as The execution module is configured to generate a new patch based on the format, modified content, and storage location. When generating the new patch, if there is an extended action configuration, a corresponding patch instruction is generated based on the extended action. The patch instruction is used to dynamically load the configuration file that needs to be modified and update the specified node when installing the new patch. The system also includes a relationship module, configured for: In response to the existence of multiple new patches, the dependencies of multiple new patches are set according to the dependencies and versions in the source code; The location module is configured to: In response to the inconsistency between the directories configured for the same file in the starting version and the ending version, the directory is renamed to make the directories configured for the same file consistent in the starting version and the ending version.

4. The system according to claim 3, characterized in that, The comparison module is configured to: In response to the addition of files in the final version relative to the starting version, the modified content is marked as newly added; In response to the fact that the ending version is identical to the starting version file and has been modified, the modified content is marked as modified; and In response to the fact that the final version has fewer files compared to the initial version, the modifications are marked as deleted.

5. A computer device, characterized in that, include: At least one processor; as well as A memory storing computer instructions executable on the processor, which, when executed by the processor, implement the steps of the method according to any one of claims 1-2.

6. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-2.

Citation Information

Patent Citations

  • Program source code slice recombination-based software dynamic update hot patch synthesis method

    CN112764788A

  • Software patch ordering

    US20200012486A1