Embodiment
Comprise in the software installation kit of each software product assembly function in the mount message file, this file comprises the erection sequence dependency information of unique identification information He this software installation kit of this software installation kit.The erection sequence dependency information is for installing the identification information of other software installation kit that must install earlier before this software installation kit.
According to comprising the mount message file in each software installation kit, installation procedure calculates correct erection sequence as follows:
1, the identification information of the installation kit of all erection sequences to be determined is all put into an interim array undetermined, create an interim stack and preserve intermediate result, create a net result of array preservation as a result;
2, from interim array undetermined, shift out the identification information of the installation kit of an order to be determined at random;
3, the identification information that this is shifted out enters step 4 as the identification information of current installation kit to be determined;
If got the identification information less than the installation kit of order to be determined, then execution in step 7;
4, detect the erection sequence dependency information of current installation kit to be determined; Judging whether not have erection sequence relies on information or erection sequence and relies on information all in array as a result; In this way, enter step 6; As not, enter step 5;
5, from the erection sequence dependency information, take out the installation kit identification information of a dependence, the installation kit identification information of this dependence is shifted out from interim array undetermined;
Whether the installation kit identification information that detects this dependence is in interim stack; In this way, install and rely on existence unusually, empty array as a result, return failure;
As denying, the identification information of current installation kit to be determined is deposited in interim stack,, get back to step 4 the identification information of the installation kit identification information of this dependence as current installation kit to be determined, in the erection sequence dependency information, the installation kit identification information of all dependences is removed;
6, the identification information with current installation kit information to be determined deposits array as a result in, and from interim stack by first-in last-out order, shift out identification information, get back to step 3; All identification informations are moved out of in interim stack, get back to step 2;
7, ordering finishes, and returns the array as a result that sequences order.
Array as a result according to returning obtains erection sequence, thereby realizes the self-adaptation installation.
Embodiment 1
In the functional module software installation kit set of a software product, all comprise a mount message file install.txt in each software installation kit, this file comprises the erection sequence dependency information (DependOn) of unique identification information (ID) and this software installation kit of this software installation kit.Dependency information is the identification information of necessary first installed software installation kit before installing.
With a cover software installation component is example, comprises 5 software installation kits, is designated A installation kit, B installation kit, C installation kit, D installation kit, E installation kit respectively; Its dependence is as follows:
ID=A;
ID=B;DependOn=A;
ID=C;DependOn=A,B;
ID=D;DependOn=A,B,C;
ID=E;DependOn=A,B,C,D。
A, B, C, D, E are all put into an interim array undetermined, create an interim stack and preserve intermediate result, create a net result of array preservation as a result;
Interim array undetermined |
Interim stack |
Array as a result |
A |
|
|
B |
|
|
C |
|
|
D |
|
|
E |
|
|
At random, the identification information of C, from interim array undetermined, shift out C as current installation kit to be determined;
Detect the erection sequence dependency information of C installation kit, be A, B;
Take out the installation kit identification information B of a dependence, B is shifted out from interim array undetermined;
Detect, B is not in interim stack; C is deposited in interim stack; With the identification information of B as current installation kit to be determined;
Interim array undetermined |
Interim stack |
Array as a result |
A |
C |
|
Detect the erection sequence dependency information of current installation kit B to be determined, be A;
Take out the installation kit identification information A of this dependence, A is shifted out from interim array undetermined;
Detect, A is not in interim stack; B is deposited in interim stack; With the identification information of A as current installation kit to be determined;
Interim array undetermined |
Interim stack |
Array as a result |
A |
C |
|
D |
B |
|
E |
|
|
Detect the erection sequence dependency information of the identification information A of current installation kit to be determined, no erection sequence dependence;
With identification information A, deposit array as a result in;
Interim array undetermined |
Interim stack |
Array as a result |
D |
C |
A |
E |
B |
|
Shift out identification information B from interim stack;
With the identification information of B as current installation kit to be determined;
Detect the erection sequence dependency information of B, be A;
A preserves B in array as a result in array as a result;
Interim array undetermined |
Interim stack |
Array as a result |
D |
C |
A |
E |
|
B |
Shift out identification information C from interim stack; With the identification information of C as current installation kit to be determined; Detect the erection sequence dependency information of C, be A, B;
A, B preserve C in array as a result in array as a result;
Interim array undetermined |
Interim stack |
Array as a result |
D |
|
?A |
E |
|
?B |
|
|
?C |
At random, the identification information of D, from interim array undetermined, shift out D as current installation kit to be determined;
Detect the erection sequence dependency information of D, be A, B, C;
A, B, C preserve D in array as a result in array as a result;
Interim array undetermined |
Interim stack |
Array as a result |
E |
|
?A |
|
|
?B |
|
|
?C |
|
|
?D |
The identification information of E, from interim array undetermined, shift out E as current installation kit to be determined; Detect the erection sequence dependency information of E, be A, B, C, D;
A, B, C, D preserve E in array as a result in array as a result;
Interim array undetermined |
Interim stack |
Array as a result |
|
|
A |
|
|
B |
|
|
C |
|
|
D |
|
|
E |
Got the identification information less than the installation kit of order to be determined, ordering finishes, and returns the array as a result that sequences order;
Install software is installed this 5 installation kits according to the order of A, B, C, D, E.
Embodiment 2
With another set of software installation component is example, comprises 5 software installation kits, is designated A installation kit, B installation kit, C installation kit, D installation kit, E installation kit respectively; Its dependence is as follows:
ID=A;
ID=B;DependOn=A;
ID=C;DependOn=A,B,D;
ID=D;DependOn=A,B,C;
ID=E;DependOn=A,B,C,D;
At random, as current installation kit information to be determined, from interim array undetermined, shift out C with C; Detect the dependence of C, from the erection sequence dependence, shift out B, and from interim array undetermined, shift out this B;
Detect B whether in interim stack, do not exist, then C is deposited in the interim stack, simultaneously B as current installation kit information to be determined;
Interim array undetermined |
Interim stack |
Array as a result |
A |
C |
|
B |
|
|
D |
|
|
E |
|
|
Detect the dependence of B, from the erection sequence dependence, shift out A, and from interim array undetermined, shift out A;
Detect A whether in interim stack, do not exist, then B is deposited in the interim stack, simultaneously A as current installation kit information to be determined;
Interim array undetermined |
Interim stack |
Array as a result |
A |
?C |
|
D |
?B |
|
E |
|
|
Detect the dependence of A, no erection sequence dependence deposits A in array as a result;
Interim array undetermined |
Interim stack |
Array as a result |
D |
C |
A |
E |
B |
|
Shift out B from interim stack simultaneously, because A in array as a result, therefore deposits B in array as a result, because C relies on D, so C continues to stay in the interim stack;
Interim array undetermined |
Interim stack |
Array as a result |
D |
C |
A |
E |
|
B |
At random, D as current installation kit information to be determined, is shifted out D from interim array undetermined;
Detect the dependence of D, find C in interim stack, it is unusual to occur relying on circulation, returns failure, can not install.