Rev | Line | |
---|
[21711] | 1 | package cfgdiff;
|
---|
| 2 |
|
---|
| 3 | BEGIN {
|
---|
| 4 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
| 5 | die "GSDLOS not set\n" unless defined $ENV{'GSDLOS'};
|
---|
| 6 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
| 7 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
|
---|
| 8 | }
|
---|
| 9 |
|
---|
| 10 | use util;
|
---|
| 11 | use diffutil;
|
---|
| 12 | use Text::Diff;
|
---|
| 13 |
|
---|
| 14 | sub test_cfg
|
---|
| 15 | {
|
---|
| 16 | my ($full_modelcfg,$full_testcfg,$cfg_file) = @_;
|
---|
| 17 |
|
---|
| 18 | my $cfg_result = diff $full_modelcfg, $full_testcfg, { STYLE => "OldStyle" };
|
---|
| 19 |
|
---|
| 20 |
|
---|
| 21 | if($cfg_file eq "build.cfg")
|
---|
| 22 | {
|
---|
[36809] | 23 | my @temp_array = split (" ",$cfg_result);
|
---|
| 24 | my @r_array = grep {/\d+/} @temp_array;
|
---|
[21711] | 25 |
|
---|
[36809] | 26 | if ($cfg_result eq "")
|
---|
| 27 | {
|
---|
| 28 | return "";
|
---|
| 29 | # return "Difference Report: These two collections are identical";
|
---|
| 30 | }
|
---|
| 31 | elsif ($r_array[1] > $r_array[2] && $temp_array[2] eq "builddate" && $temp_array[6] eq "builddate")
|
---|
| 32 | {
|
---|
| 33 | return "Difference Report: Using newer collection as model collection";
|
---|
| 34 | }
|
---|
| 35 | elsif ($r_array[1] < $r_array[2] && $temp_array[2] eq "builddate" && $temp_array[6] eq "builddate")
|
---|
| 36 | {
|
---|
| 37 | return "";
|
---|
| 38 | }
|
---|
| 39 | else
|
---|
| 40 | {
|
---|
| 41 | $cfg_result = &diffutil::GenerateOutput($cfg_result,"");
|
---|
| 42 | return $cfg_result;
|
---|
| 43 | }
|
---|
[21711] | 44 | }
|
---|
| 45 | elsif($cfg_file eq "collect.cfg")
|
---|
| 46 | {
|
---|
| 47 |
|
---|
[36809] | 48 | $cfg_result = &diffutil::GenerateOutput($cfg_result,"");
|
---|
| 49 | if ($cfg_result eq "")
|
---|
| 50 | {
|
---|
| 51 | return "";
|
---|
| 52 | }
|
---|
| 53 | else
|
---|
| 54 | {
|
---|
| 55 | return "Difference Report:\n$cfg_result";
|
---|
| 56 | }
|
---|
[21711] | 57 | }
|
---|
| 58 | else
|
---|
| 59 | {
|
---|
[36809] | 60 | die "Error occour in cfgdiff::testcfg!!\n";
|
---|
[21711] | 61 | }
|
---|
| 62 | }
|
---|
| 63 |
|
---|
| 64 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.