source: other-projects/diffcol/trunk/diffcol/cfgdiff.pm@ 21711

Last change on this file since 21711 was 21711, checked in by oranfry, 14 years ago

bringing across the diffcol project

File size: 1.4 KB
Line 
1package cfgdiff;
2
3BEGIN {
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
10use util;
11use diffutil;
12use Text::Diff;
13
14sub 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 {
23 my @temp_array = split (" ",$cfg_result);
24 my @r_array = grep {/\d+/} @temp_array;
25
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 }
44 }
45 elsif($cfg_file eq "collect.cfg")
46 {
47
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 }
57 }
58 else
59 {
60 die "Error occour in cfgdiff::testcfg!!\n";
61 }
62}
63
641;
Note: See TracBrowser for help on using the repository browser.