CN108664255B - Software upgrading method and device - Google Patents

Software upgrading method and device Download PDF

Info

Publication number
CN108664255B
CN108664255B CN201710187257.6A CN201710187257A CN108664255B CN 108664255 B CN108664255 B CN 108664255B CN 201710187257 A CN201710187257 A CN 201710187257A CN 108664255 B CN108664255 B CN 108664255B
Authority
CN
China
Prior art keywords
file
patch
backup
model
changed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710187257.6A
Other languages
Chinese (zh)
Other versions
CN108664255A (en
Inventor
冯浩展
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Zte Technical Service Co ltd
Original Assignee
Shenzhen Zte Technical Service Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Zte Technical Service Co ltd filed Critical Shenzhen Zte Technical Service Co ltd
Priority to CN201710187257.6A priority Critical patent/CN108664255B/en
Priority to PCT/CN2018/080043 priority patent/WO2018177193A1/en
Publication of CN108664255A publication Critical patent/CN108664255A/en
Application granted granted Critical
Publication of CN108664255B publication Critical patent/CN108664255B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a software upgrading method and device. The method comprises the following steps: if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software; establishing a backup file model of the patch according to the changed files corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed files corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backup files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.

Description

Software upgrading method and device
Technical Field
The invention relates to the technical field of computers, in particular to a software upgrading method and device.
Background
After the software version is released, in order to correct a bug (bug) or add a new function, the software version is often upgraded in a patch set manner. The patch set of the software generally comprises a plurality of patches, and the patch set is firstly patched one by one according to the sequence when being upgraded. If the backup of the software version is not carried out before the patch set is upgraded, once one patch is upgraded, the software can only be reinstalled, so the backup of the version during the patch set upgrading is very important. The modified files cannot be known in advance before the patch set is upgraded, and only the backup of the whole software version can be carried out, so that the time consumption for upgrading the patch set is greatly increased because the number of the files becomes huge after the software is operated on site for a period of time.
In the prior art, an effective solution is not provided at present aiming at the problem that the time consumption of full version backup is long when a software version patch is upgraded, so that the efficiency is low when the software version patch is upgraded.
Disclosure of Invention
The embodiment of the invention aims to provide a software upgrading method and device, and solves the problem that the time consumption of full-version backup is long when a software version patch is upgraded, so that the upgrading efficiency is low.
In order to achieve the above object, an embodiment of the present invention provides a software upgrading method. The method comprises the following steps:
if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software;
establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch;
performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file;
and executing upgrading operation based on the patch.
The embodiment of the invention also provides a software upgrading device. The device includes:
the determining module is used for determining a change file corresponding to the patch according to the file in the patch and the file in the target software if the upgrading instruction is received;
the establishing module is used for establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch;
the first backup module is used for carrying out file backup according to the nodes corresponding to the changed files in the backup file model to obtain backup files;
and the upgrading module is used for executing upgrading operation based on the patch.
An embodiment of the present invention further provides a computer storage medium, where one or more programs executable by a computer are stored in the computer storage medium, and when the one or more programs are executed by the computer, the computer executes a software upgrading method as provided above.
One of the above technical solutions has the following advantages or beneficial effects:
if an upgrading instruction is received, determining a change file corresponding to a patch according to a file in the patch and a file in target software; establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backed-up files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.
Drawings
Fig. 1 is a flowchart of a software upgrading method according to an embodiment of the present invention;
FIG. 2 is a flowchart of a software upgrading method according to another embodiment of the present invention;
FIG. 3 is a flowchart of a software upgrading method according to another embodiment of the present invention;
FIG. 4 is a diagram of a file backup model according to an embodiment of the present invention;
fig. 5 is a schematic diagram of a software upgrading apparatus according to an embodiment of the present invention.
Detailed Description
In order to make the technical problems, technical solutions and advantages of the present invention more apparent, the following detailed description is given with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, an embodiment of the present invention provides a software upgrading method, including the following steps:
step S101, if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software.
In the embodiment of the present invention, the upgrade instruction is used to indicate that software upgrade operation needs to be performed, the target software may be any software that needs to be upgraded, and the change file may be a delete file and/or a modify file, where the delete file may include a file that does not exist in the patch and exists in the target software. The modified files may include files that are present in the patch file and that are not present in the target software. Optionally, the embodiment of the present invention may search, based on the file in the patch, whether a file with the same name and the same directory hierarchy as the file in the patch exists in the file in the target software.
Step S102, establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch.
In the embodiment of the present invention, the backup file model is a tree structure generated according to the directory hierarchy of the changed files, and specifically, a tree node may be generated based on the directory hierarchy of each changed file. After the tree nodes corresponding to the changed files are obtained, the tree nodes corresponding to the changed files can be combined to obtain a backup file model.
And step S103, carrying out file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file.
In the embodiment of the invention, the file backup is carried out according to the node corresponding to the changed file, so that only the changed file is backed up, and the number of backup files can be reduced.
And step S104, executing upgrading operation based on the patch.
If an upgrading instruction is received, determining a change file corresponding to a patch according to a file in the patch and a file in target software; establishing a backup file model of the patch according to the changed files corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed files corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backup files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.
As shown in fig. 2, an embodiment of the present invention further provides a software upgrading method, including the following steps:
step S201, if an upgrade instruction is received, determining a newly added file and a modified file corresponding to the patch according to the file in the patch and the file in the target software.
In the embodiment of the present invention, the newly added file may include a file that exists in the patch and does not exist in the target software.
Step S202, establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch.
In the embodiment of the invention, the backup file model is a tree structure generated according to the directory hierarchy of the newly added files and the changed files. Specifically, the embodiments of the present invention may generate tree nodes according to the directory hierarchy of each newly added file and each changed file, and perform attribute identification on each tree node, for example, for a newly added file, a node corresponding to the newly added file may be identified as a new addition, and for a deleted file, a node corresponding to the deleted file may be identified as a deletion, and the like. And combining the tree nodes to obtain a backup file model.
Step S203, carrying out file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file.
In the embodiment of the invention, the file backup is carried out according to the node corresponding to the changed file, so that only the changed file is backed up, and the number of the backed-up files can be reduced.
And step S204, executing upgrading operation based on the patch.
Optionally, after performing an upgrade operation based on the patch, the method further includes: and if a rollback instruction is received, executing rollback operation according to the backup file model and the backup file.
Optionally, in the embodiment of the present invention, files corresponding to each node of the backup file model may be directly deleted from the upgraded target software, and the backup files are added to the target software, so that the target software is quickly rolled back to the version before upgrading.
Optionally, the determining, by the patch, a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch comprises the following steps: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model;
the performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file includes: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
In the embodiment of the invention, when the number of the patches is multiple, the backup file model of each patch is established according to the newly added file and the changed file corresponding to each patch, nodes in the backup file model of each patch are merged, and the file backup is carried out based on the merged backup file model. The following embodiments of the present invention will be described with reference to the first patch and the second patch as examples.
In the embodiment of the invention, the first backup file model is a tree structure established according to the directory hierarchy of each newly added file and each changed file of the first patch, the second backup file model is a tree structure established according to the directory hierarchy of each newly added file and each changed file of the second patch, and as the same newly added file and changed file may exist in the first patch and the second patch, in order to avoid redundancy of backup files, each node in the first backup file model and each node in the second backup file model are merged, wherein only one node is reserved after merging. Specifically, in the embodiment of the present invention, each node of the backup file model of the second patch may be traversed based on the backup file model of the first patch, and a node of the backup file model of the second patch, which is different from the backup file model of the first patch, is added to the backup file model of the first patch, so as to obtain the merged backup file model. Therefore, when the file backup is carried out on the basis of the node corresponding to the changed file in the merged backup file model, the redundancy of the backup file caused by the fact that the same file among different patches is backed up for multiple times can be avoided.
Optionally, after the upgrading order of the first patch is located before the second patch, and after a first backup file model of the first patch is established according to the newly added file and the changed file corresponding to the first patch, and a second backup file model of the second patch is established according to the newly added file and the changed file corresponding to the second patch, the method further includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; deleting the same node in the second backup file model as the first backup file model to obtain an updated second backup file model, and performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch.
In practical cases, when the number of patches is multiple, the upgrade is usually performed sequentially according to each patch of the multiple patches. In an embodiment of the invention, the first patch is upgraded before the second patch. After the first backup file model is obtained, the file backup is carried out based on the first backup file model, and the backup file corresponding to the first patch is obtained. Specifically, the backup file corresponding to the first patch is a file that needs to be changed based on the target software when the first patch is upgraded. After the second backup file model is obtained, the node in the second backup file model, which is the same as the node in the first backup file model, may be deleted to obtain an updated second backup file model, so as to perform file backup according to the updated second backup file model to obtain a backup file corresponding to the second patch, where the backup file corresponding to the second patch is a file that needs to be changed based on the target software when the second patch is upgraded.
Optionally, in the embodiment of the present invention, a corresponding relationship may be respectively established between each restore point and each backup file model and each backup file, so that the target software may be quickly rolled back to the restore point according to the backup file model and the backup file corresponding to a certain restore point.
Optionally, the determining, by the file in the patch and the file in the target software, a new file and a changed file corresponding to the patch according to the upgrading order of the first patch being before the second patch includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch;
the file backup according to the node corresponding to the changed file in the backup file model includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch;
the executing of the upgrade operation based on the patch includes: performing an upgrade operation based on the first patch;
after performing an upgrade operation based on the first patch, the method further comprises: if the first patch is upgraded successfully, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
In the embodiment of the invention, file backup and upgrade of each patch are executed in series, specifically, a newly added file and a changed file corresponding to a first patch are determined according to a file in the first patch and a file in the target software; establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; and performing an upgrade operation based on the first patch. If the first patch is upgraded successfully, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
Optionally, in the embodiment of the present invention, after the second backup file model is obtained, the second backup file model may be merged with the first backup file model to obtain a merged backup file model.
Optionally, in the embodiment of the present invention, a corresponding relationship may be respectively established between each restore point and each backup file model and each backup file, so that the target software may be quickly rolled back to the restore point according to the backup file model and the backup file corresponding to a certain restore point.
Optionally, after performing an upgrade operation based on the patch, the method further includes: if a rollback instruction is received, acquiring a backup file model and a backup file corresponding to a target restoration point according to the target restoration point in the rollback instruction; and performing rollback operation on the upgraded target software according to the backup file model and the backup file corresponding to the target restoring point.
In the embodiment of the present invention, the rollback instruction is used to indicate that a rollback operation needs to be performed, for example, when upgrading fails through a certain patch. Optionally, the user may be prompted through a pop-up window whether to perform a rollback operation and input a target restore point, and after receiving the target restore point input by the user, a backup file model and a backup file corresponding to the target restore point are obtained.
Optionally, the performing a rollback operation on the upgraded target software according to the backup file model and the backup file corresponding to the target restoring point includes: and deleting files corresponding to each node in the backup file model corresponding to the target restoring point from the upgraded target software, and adding the backup files corresponding to the target restoring point into the target software.
Optionally, if the file in the patch includes an empty directory, before the backup file model of the patch is established according to the newly added file, the deleted file, and the modified file corresponding to the patch, the method further includes: and adding a description file in the empty directory.
The description file may be any format file, such as a WORD file, a TXT file, and the like. After the description file is added into the empty directory, the tree node can be established according to the directory hierarchy of the description file. The whole backup file model can be simplified by converting the empty directory into an instruction file contained under the empty directory, and the whole backup file model is finally classified into the operation of a plurality of independent files, so that the files are used as the minimum operation unit, and the condition that the files are newly added to the recorded empty directory can not occur when a plurality of patches are upgraded successively.
If an upgrading instruction is received, determining a newly added file and a modified file corresponding to a patch according to a file in the patch and a file in target software; establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch. Compared with the prior art in which full-software version backup is carried out, the number of backup files is reduced, time consumption in software patch upgrade is saved, and upgrade efficiency is improved. Moreover, the target software can be conveniently and quickly rolled back to the version before upgrading on the basis of the backup file model and the backup file.
As shown in fig. 3, an embodiment of the present invention provides a software upgrading method, including the following steps:
step S301, with the files in the patch as reference, scanning files with the same name in the target software one by one, and setting corresponding identification bits.
Specifically, for a file in the patch, if the file exists in the target software, the file is identified as modified; if the file does not exist in the target software, the file is marked as new; if the file needs to be deleted, the file is identified as deleted.
And step S302, establishing a backup file model of the patch.
Specifically, referring to fig. 4, the backup file model building process is as follows:
if the file is a new file (namely, a new file), a tree node is established according to the directory hierarchy of the file and is marked as new, wherein if the new file is an empty directory, an instruction file, such as ignore.
The embodiment of the invention can simplify the whole backup file model by converting the new increase of the empty directory into the new increase of one instruction file in the empty directory, and finally belongs to the operation of a plurality of independent files, so that the files are used as the minimum operation unit, and the situation that the files are newly added to the recorded empty directory when a plurality of patches are upgraded successively can be avoided.
If the file is deleted (namely, the file is deleted), a tree node is established according to the directory hierarchy of the file, and the node is marked as deleted, wherein if the deleted file is an empty directory, a description, for example, ignore.
If the file is a modified file (i.e., a modified file), the modification can be a combination of deletion and addition. By the method, the types of file operations can be further simplified, and all the operations on the files are simplified into addition and deletion. And converting the modified file into a combination of the deleted file and the newly added file, and establishing tree nodes according to the directory hierarchy of the deleted file and the newly added file respectively.
And merging the tree nodes established according to the rules into the same tree structure to obtain a backup file model.
And step S303, carrying out file backup according to the backup file model of the patch, and executing upgrading operation based on the patch.
In the embodiment of the invention, the nodes marked as deleted in the backup file model are sequentially backed up to a fixed directory during file backup, and only the nodes marked as newly added are recorded and not processed.
The current backup file model can also be saved before the patch upgrade, so that when a certain patch upgrade fails or manual rollback is carried out, the rollback can be selected to reach the restoring point.
And step S304, judging whether the upgrade is successful.
If the upgrade is successful, go to step S305, and if the upgrade is unsuccessful, go to step S309.
Step S305, judging whether other patches exist.
In the embodiment of the present invention, the other patches refer to patches that need to be upgraded currently, except for the upgraded patches. If there is another patch, step S306 is executed, and if there is no other patch, step S308 is executed.
And S306, continuing to establish a backup file model for the subsequent patch, and merging the backup file model of the patch into the previous backup file model to obtain a merged backup file model.
In the embodiment of the invention, the subsequent patch refers to a patch with the upgrading sequence being positioned after the current upgraded patch, and the previous backup file model refers to the backup file model of the patch upgraded before.
In the embodiment of the invention, the process of establishing the backup file model of the subsequent patch is as follows:
if the file is a newly added file, establishing new files according to the directory hierarchy of the file to obtain the tree node of the merged backup file model, if the node exists in the previous backup file model, not processing the node, and if the node does not exist, adding the node into the previous backup file model and marking the node as newly added.
If the file is deleted, establishing a new tree node according to the directory hierarchy of the file, and if the node exists in the previous backup file model, not processing the node; if the node does not exist, the node is added to the previous backup file model and identified as deleted.
The embodiment of the invention firstly judges the existence of the newly added and deleted tree nodes, aims to record the first operation for the same file, and does not process any operation or operation for a plurality of times no matter what kind of operation is carried out on the file during the subsequent patch upgrading, thereby reducing the complexity of the software upgrading method of the embodiment of the invention.
And step S307, carrying out backup again according to the merged backup file model, and then carrying out patch upgrading.
After the patch upgrade, the execution returns to step S305. Specifically, the embodiment of the present invention may repeatedly execute steps S305 to S307 until all patches are upgraded.
It should be noted that, in the embodiment of the present invention, step S304 to step S307 may be repeatedly executed until all patches are upgraded.
Step S308, whether a rollback version is needed.
If the rollback (i.e., rollback) version is required, step S309 is executed, and if the rollback version is not required, the process is terminated. In practical situations, if some patch upgrade fails or is successful but the service is abnormal, the upgraded target software generally needs to be backed to the version before the upgrade.
And step S309, performing software rollback according to the backup file model.
Specifically, the software rollback flow may be as follows: traversing nodes in the merged backup file model, and deleting files corresponding to each node in the merged backup file model from the target software; the backup file is overwritten into the target software.
It should be noted that deletion here refers to deletion of all nodes, and includes not only the node identified as being newly added, but also the node identified as being deleted, because the node identified as being deleted is recorded when the node is operated for the first time, the node may be newly created, modified during subsequent operations, or even other files are placed under the directory, and deletion will thoroughly clean up these files, so that it is ensured that the state of the software version after the backup file is overlaid into the target and the current state are completely consistent.
Compared with the existing full-version backup scheme during software upgrading, the software upgrading method provided by the embodiment of the invention has the advantages that the number of backed-up files is greatly reduced; meanwhile, redundant backup of the same files among the patches is removed, the number of files needing to be backed up is further reduced, time consumption during software patch upgrading is saved, and upgrading efficiency is improved.
The following examples illustrate embodiments of the invention:
the patch set patch includes patch1 and patch2. Patch1 includes: adding a file FileAdd1, adding an empty directory DirAdd1, deleting a file FileDel1, deleting an empty directory DirDE 2, deleting a directory DirDE 3 and modifying a file FileModify; patch2 includes: deleting files FileAdd1 and FileDel4, and adding FileAdd2 and DirDE 2.
Step a, with a file in the patch1 as a reference, scanning files with the same name in target software one by one, and setting corresponding identifiers, wherein specifically, fileAdd1 and DirAdd1 do not exist in a software version and are set as new; fileDel1, dirDE 2 and DirDE 3 exist in target software but need to be deleted, and are set as deletion; fileModify exists in both the software version and patch1, set as modified.
And b, establishing a patch1 backup file model.
Specifically, tree nodes are established according to the directory hierarchy of the FileAdd1 and marked as new. Because DirAdd1 is a newly added empty directory, an instruction file, for example, ignore.txt, is newly added in DirAdd1, and a tree node is established according to the directory hierarchy of the ignore.txt and is marked as being newly added.
The tree nodes are built according to the directory hierarchy of FileDel1 and marked as deleted. Since DirDel2 is an empty directory to be deleted, a description file, for example, ignore.txt, is newly added to DirDel2, and a tree node is established according to the directory hierarchy of the ignore.txt and is marked as deleted.
Since DirDE 3 is a deleted non-empty directory, tree nodes are created according to the directory hierarchy of each file in DirDE 3 and identified as deleted. FileModify is a modified file, and a tree node is established according to the directory hierarchy of FileModify and is marked as deleted.
And c, performing file backup according to the backup file model of the patch1, and then upgrading based on the patch 1.
When the files are backed up, only the files marked as deletion are backed up, such as all leaf node files under FileDel1, dirDE 2/erasure.txt and DirDE 3, and FileModify.
And d, establishing a patch2 backup file model, and merging the patch backup file model into the previous backup file model.
FileAdd1 and DirDel2 are recorded in patch1, and only FileDel4 and FileAdd2 need to be merged without being merged into the previous backup file model.
And e, performing file backup according to the backup file model of the merged patch, and then upgrading the patch2.
Specifically, only FileDel4 and FileAdd2 in the backup file model need to be backed up.
Step f, if the patch1 and the patch2 fail to be upgraded or need to rollback the version after the patch is successfully upgraded, executing the following operations: deleting all nodes in the merged backup file model in the upgraded target software; all backed up files are overwritten into the target software.
The rollback of the full version of the target software can be realized through the operation, namely the target software returns to the version before the target software is upgraded.
As shown in fig. 5, an embodiment of the present invention provides a software upgrading apparatus, where the software upgrading apparatus 50 includes:
a determining module 51, configured to determine, if an upgrade instruction is received, a change file corresponding to a patch according to a file in the patch and a file in target software;
an establishing module 52, configured to establish a backup file model of the patch according to the changed file corresponding to the patch, where the backup file model is a tree structure generated according to a directory hierarchy of the changed file corresponding to the patch;
the first backup module 53 is configured to perform file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file;
and an upgrade module 54 configured to perform an upgrade operation based on the patch.
Optionally, the determining module 51 is further configured to: if an upgrading instruction is received, determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software; the establishing module is specifically configured to: and establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch.
Optionally, the patches include a first patch and a second patch, and the determining module 51 is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software; the establishing module 52 is specifically configured to: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model; the first backup module is specifically configured to: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
Optionally, the upgrade order of the first patch is before the second patch, and the apparatus further includes: the second backup module is used for establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and performing file backup according to a node corresponding to the changed file in the first backup file model after establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch to obtain a backup file corresponding to the first patch; and the third backup module is used for deleting the nodes in the second backup file model, which are the same as the nodes in the first backup file model, to obtain an updated second backup file model, and performing file backup according to the nodes corresponding to the changed files in the updated second backup file model to obtain the backup files corresponding to the second patch.
Optionally, the patches include a first patch and a second patch, an upgrade order of the first patch is located before the second patch, and the determining module 51 is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software; the establishing module 52 has means for: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; the backup module 53 is specifically configured to: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; the upgrade module 54 is specifically configured to: performing an upgrade operation based on the first patch;
the determining module 51 is further configured to: after the upgrading operation is executed based on the first patch, if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; the establishing module 52 is further configured to: establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; the backup module 53 is further configured to: performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; the upgrade module 54 is further configured to: performing an upgrade operation based on the second patch.
Optionally, the apparatus further comprises: and the rollback module is used for executing rollback operation according to the backup file model and the backup file if a rollback instruction is received after the upgrade operation is executed based on the patch.
In the embodiment of the present invention, if the determining module 51 receives the upgrade instruction, the change file corresponding to the patch is determined according to the file in the patch and the file in the target software; the establishing module 52 establishes a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to a directory hierarchy of the changed file corresponding to the patch; the first backup module 53 performs file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; upgrade module 54 performs an upgrade operation based on the patch. According to the embodiment of the invention, only the changed files are backed up based on the backup file model during software upgrading, compared with the prior art that full software version backup is carried out, the number of the backed-up files is reduced, the time consumption during software patch upgrading is saved, and the upgrading efficiency is improved.
It should be noted that, the software upgrading apparatus in the embodiment of the present invention may be a user terminal in any implementation manner in the method embodiment of the present invention, and any implementation manner of the user terminal in the method embodiment of the present invention may be implemented by the software upgrading apparatus in this embodiment, and the same beneficial effects are achieved, and details are not described here.
Those skilled in the art will appreciate that all or part of the steps of the method of the above embodiments may be implemented by hardware associated with program instructions, and the program may be stored in a computer readable medium, and when executed, the program includes the following steps: if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software; establishing a backup file model of the patch according to the changed files corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed files corresponding to the patch; performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file; and executing upgrading operation based on the patch.
Optionally, if an upgrade instruction is received, the program further includes, when executed: determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software; the establishing of the backup file model of the patch according to the changed file corresponding to the patch comprises: and establishing a backup file model of the patch according to the newly-added file and the changed file corresponding to the patch.
Optionally, the determining, by the patch including a first patch and a second patch, a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software; the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch comprises the following steps: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model; the performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file includes: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
Optionally, the determining, by the file in the patch and the file in the target software, a new file and a changed file corresponding to the patch according to the upgrading order of the first patch being before the second patch includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software; the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch; the file backup according to the node corresponding to the changed file in the backup file model includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch; the executing of the upgrade operation based on the patch includes: performing an upgrade operation based on the first patch; after performing an upgrade operation based on the first patch, the program, when executed, further includes the steps of: if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software; establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model; performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch; performing an upgrade operation based on the second patch.
Optionally, after performing the upgrade operation based on the patch, the program further includes, when executed: and if a rollback instruction is received, executing rollback operation according to the backup file model and the backup file.
The storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
While the foregoing is directed to the preferred embodiment of the present invention, it will be understood by those skilled in the art that various changes and modifications may be made without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method of upgrading software, comprising:
if an upgrading instruction is received, determining a change file corresponding to the patch according to a file in the patch and a file in the target software;
establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch;
performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file;
performing an upgrade operation based on the patch, wherein,
the establishing of the backup file model of the patch according to the changed file corresponding to the patch comprises:
generating tree nodes based on the directory hierarchy of each change file, and performing attribute identification on each tree node;
and after the tree node corresponding to each changed file is obtained, combining the tree nodes corresponding to each changed file to obtain the backup file model.
2. The method of claim 1, wherein if an upgrade instruction is received, the method further comprises: determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software;
in the step of generating tree nodes based on the directory hierarchy of each changed file and performing attribute identification on each tree node, for newly added files, corresponding attribute identification is newly added;
and after the tree nodes corresponding to the changed files are obtained, combining the tree nodes corresponding to the changed files to obtain the backup file model, and establishing the backup file model of the patch according to the newly added files and the changed files corresponding to the patch.
3. The method of claim 2, wherein the patch comprises a first patch and a second patch, and determining a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software comprises: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining the newly added file and the changed file corresponding to the second patch according to the file in the second patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model;
the performing file backup according to the node corresponding to the changed file in the backup file model to obtain a backup file includes: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
4. The method of claim 2, wherein the patch includes a first patch and a second patch, and an upgrade order of the first patch is located before the second patch, and determining a new file and a changed file corresponding to the patch according to a file in the patch and a file in the target software includes: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software;
the establishing of the backup file model of the patch according to the newly added file and the changed file corresponding to the patch includes: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch;
the file backup according to the node corresponding to the changed file in the backup file model includes: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch;
the executing of the upgrade operation based on the patch includes: performing an upgrade operation based on the first patch;
after performing an upgrade operation based on the first patch, the method further comprises: if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software;
establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch;
deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model;
performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch;
performing an upgrade operation based on the second patch.
5. The method of claim 2, wherein after performing an upgrade operation based on the patch, the method further comprises:
and if a rollback instruction is received, executing rollback operation according to the backup file model and the backup file.
6. A software upgrading apparatus, comprising:
the determining module is used for determining a change file corresponding to the patch according to the file in the patch and the file in the target software if the upgrading instruction is received;
the establishing module is used for establishing a backup file model of the patch according to the changed file corresponding to the patch, wherein the backup file model is a tree structure generated according to the directory hierarchy of the changed file corresponding to the patch;
the first backup module is used for carrying out file backup according to the nodes corresponding to the changed files in the backup file model to obtain backup files;
an upgrade module to perform an upgrade operation based on the patch,
wherein the content of the first and second substances,
the establishing of the backup file model of the patch according to the changed file corresponding to the patch comprises:
generating tree nodes based on the directory hierarchy of each change file, and performing attribute identification on each tree node;
and after the tree node corresponding to each changed file is obtained, combining the tree nodes corresponding to each changed file to obtain the backup file model.
7. The apparatus of claim 6, wherein the determining module is further configured to: if an upgrading instruction is received, determining a newly added file corresponding to the patch according to the file in the patch and the file in the target software, wherein for the newly added file, the corresponding attribute mark is newly added;
the establishing module is specifically configured to: and establishing a backup file model of the patch according to the newly added file and the changed file corresponding to the patch.
8. The apparatus of claim 7, wherein the patch comprises a first patch and a second patch, and wherein the determining module is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software, and determining a newly added file and a changed file corresponding to the second patch according to the file in the second patch and the file in the target software;
the establishing module is specifically configured to: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch, and establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; merging each node in the first backup file model and the second backup file model to obtain a merged backup file model;
the first backup module is specifically configured to: and carrying out file backup according to the node corresponding to the changed file in the merged backup file model to obtain the backup file.
9. The apparatus of claim 7, wherein the patch comprises a first patch and a second patch, wherein an upgrade order of the first patch precedes the second patch, and wherein the determining module is specifically configured to: determining a newly added file and a changed file corresponding to the first patch according to the file in the first patch and the file in the target software;
the setup module has means for: establishing a first backup file model of the first patch according to the newly added file and the changed file corresponding to the first patch;
the backup module is specifically configured to: performing file backup according to the node corresponding to the changed file in the first backup file model to obtain a backup file corresponding to the first patch;
the upgrade module is specifically configured to: performing an upgrade operation based on the first patch;
the determination module is further to: after the upgrading operation is executed based on the first patch, if the upgrading is successful according to the first patch, determining a newly added file and a changed file corresponding to the second patch according to a file in the second patch and a file in the target software;
the establishing module is further configured to: establishing a second backup file model of the second patch according to the newly added file and the changed file corresponding to the second patch; deleting the nodes in the second backup file model, which are the same as the backup file model of the first patch, to obtain an updated second backup file model;
the backup module is further configured to: performing file backup according to the node corresponding to the changed file in the updated second backup file model to obtain a backup file corresponding to the second patch;
the upgrade module is further configured to: performing an upgrade operation based on the second patch.
10. The apparatus of claim 7, further comprising:
and the rollback module is used for executing rollback operation according to the backup file model and the backup file if a rollback instruction is received after the upgrade operation is executed based on the patch.
CN201710187257.6A 2017-03-27 2017-03-27 Software upgrading method and device Active CN108664255B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201710187257.6A CN108664255B (en) 2017-03-27 2017-03-27 Software upgrading method and device
PCT/CN2018/080043 WO2018177193A1 (en) 2017-03-27 2018-03-22 Software upgrade method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710187257.6A CN108664255B (en) 2017-03-27 2017-03-27 Software upgrading method and device

Publications (2)

Publication Number Publication Date
CN108664255A CN108664255A (en) 2018-10-16
CN108664255B true CN108664255B (en) 2023-04-11

Family

ID=63674189

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710187257.6A Active CN108664255B (en) 2017-03-27 2017-03-27 Software upgrading method and device

Country Status (2)

Country Link
CN (1) CN108664255B (en)
WO (1) WO2018177193A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109446161B (en) * 2018-10-18 2021-12-28 网易(杭州)网络有限公司 Information monitoring method and device, electronic equipment and storage medium
CN110874237A (en) * 2019-12-30 2020-03-10 深圳市英博超算科技有限公司 Software upgrading method, device, terminal and readable storage medium
CN113094861B (en) * 2021-05-08 2022-06-03 国网河北省电力有限公司经济技术研究院 Data storage method, device, equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7251749B1 (en) * 2004-02-12 2007-07-31 Network Appliance, Inc. Efficient true image recovery of data from full, differential, and incremental backups
CN102193805A (en) * 2010-03-11 2011-09-21 华为技术有限公司 Device and method for upgrading software patches
JP2013033334A (en) * 2011-08-01 2013-02-14 Nippon Telegr & Teleph Corp <Ntt> Backup device, and failure recovery method
CN103136013A (en) * 2011-12-01 2013-06-05 腾讯科技(深圳)有限公司 Method and system of software upgrade
CN104156244A (en) * 2014-08-06 2014-11-19 北京奇虎科技有限公司 Method and device for software upgrading
CN105117263A (en) * 2015-09-14 2015-12-02 北京空间飞行器总体设计部 UNIX environment software system upgrading method
CN105468396A (en) * 2014-09-11 2016-04-06 深圳Tcl数字技术有限公司 Generating method for differential package, upgrading method, generating apparatus, and Linux terminal
CN105550060A (en) * 2014-10-31 2016-05-04 Tcl集团股份有限公司 Increment upgrade backup method and device

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7774772B2 (en) * 2001-09-28 2010-08-10 Siebel Systems, Inc. Method and apparatus to perform an application software migration
CN103699410B (en) * 2013-12-20 2017-05-24 北京奇虎科技有限公司 Method and device for updating application programs
CN103955363B (en) * 2014-04-08 2017-03-15 国云科技股份有限公司 A kind of manufacture method of program upgrade installation package

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7251749B1 (en) * 2004-02-12 2007-07-31 Network Appliance, Inc. Efficient true image recovery of data from full, differential, and incremental backups
CN102193805A (en) * 2010-03-11 2011-09-21 华为技术有限公司 Device and method for upgrading software patches
JP2013033334A (en) * 2011-08-01 2013-02-14 Nippon Telegr & Teleph Corp <Ntt> Backup device, and failure recovery method
CN103136013A (en) * 2011-12-01 2013-06-05 腾讯科技(深圳)有限公司 Method and system of software upgrade
CN104156244A (en) * 2014-08-06 2014-11-19 北京奇虎科技有限公司 Method and device for software upgrading
CN105468396A (en) * 2014-09-11 2016-04-06 深圳Tcl数字技术有限公司 Generating method for differential package, upgrading method, generating apparatus, and Linux terminal
CN105550060A (en) * 2014-10-31 2016-05-04 Tcl集团股份有限公司 Increment upgrade backup method and device
CN105117263A (en) * 2015-09-14 2015-12-02 北京空间飞行器总体设计部 UNIX environment software system upgrading method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"系统升级 Android用户的必修课";曹操;《电脑爱好者》;20130801(第15期);全文 *

Also Published As

Publication number Publication date
WO2018177193A1 (en) 2018-10-04
CN108664255A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
US9804933B2 (en) System differential upgrade method, apparatus, and mobile terminal
US10423585B2 (en) Method and device for making differential upgrade package, and method and device for system differential upgrading
CN110543386B (en) Data storage method, device, equipment and storage medium
KR20070034239A (en) Method and system for updating software and computer readable recording medium recording the method
CN108205560B (en) Data synchronization method and device
CN108664255B (en) Software upgrading method and device
US20190227710A1 (en) Incremental data restoration method and apparatus
CN104484240A (en) Method and device for storing terminal data
CN105867962A (en) System upgrading method and device
CN108037932B (en) SPI-NAND configuration file acquisition method and device
CN111737227A (en) Data modification method and system
US20130086572A1 (en) Generation apparatus, generation method and computer readable information recording medium
CN106603289B (en) LMT configuration file smooth upgrading method
WO2019041891A1 (en) Method and device for generating upgrade package
CN113254045A (en) Software initialization method, system and computer readable storage medium
CN110928727A (en) Method for rapidly restoring factory settings of operating system
CN111857740A (en) Software upgrading method and device
CN106547756B (en) Database creation method and device
CN114237976A (en) Data acquisition method and device
CN114064674A (en) Data synchronization method, device, computer equipment, storage medium and product
CN106681914B (en) Television picture quality debugging method and device
CN114968963A (en) File overwriting method and device and electronic equipment
CN109996262B (en) AC starting method and device
US10860533B1 (en) File size as an indicator of file properties
CN112000354A (en) Version information updating method, version information updating device, version information updating equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200617

Address after: 518057 Zhongxing building, A3-01, A3-02, Nanshan District hi tech Industrial Park, Shenzhen, Guangdong

Applicant after: Shenzhen ZTE Technical Service Co.,Ltd.

Address before: 518057 Nanshan District science and Technology Industrial Park, Guangdong high tech Industrial Park, ZTE building

Applicant before: ZTE Corp.

GR01 Patent grant
GR01 Patent grant