Subversion Repositories DevTools

Rev

Rev 7299 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
392 dpurdie 1
#! perl
2
########################################################################
7300 dpurdie 3
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
392 dpurdie 4
#
5
# Module name   : jats.sh
6
# Module type   : Makefile system
7
# Compiler(s)   : n/a
8
# Environment(s): jats
9
#
10
# Description   : Examine SITS Legacy and SITS TOT+AVM releases and
11
#                 ensure that the packages are in-sync. The build number are
12
#                 allowed to differ.
13
#
14
#                 Lots of hard coding in this
15
#
16
# Usage:
17
#
18
# Version   Who      Date        Description
19
#
20
#......................................................................#
21
 
22
require 5.006_001;
23
use strict;
24
use warnings;
25
use JatsError;
26
use JatsVersionUtils;
27
use JatsRmApi;
28
 
29
#use Data::Dumper;
30
use DBI;
31
use Cwd;
32
 
33
my $GBE_PERL     = $ENV{'GBE_PERL'};        # Essential ENV variables
34
my $GBE_CORE     = $ENV{'GBE_CORE'};
35
my $opt_verbose = 0;
36
my %all_names;
37
my @stop_list = qw (ERGavm.syd AVMAppUpgrade.syd AVMApplicationEngine.syd
38
                    ERGavmug.syd ERGtot.syd ERGtotug.syd IDC.syd IDCDB.syd ocp5000.syd
39
                    );
40
 
41
my %stop_list = map { ${_} => 1 } @stop_list;
42
my $RM_DB;
43
 
44
 
45
my @GDATA;
46
sub getPkgDetailsByRTAG_ID
47
{
48
    my ($RTAG_ID, $datap) = @_;
49
    my $foundDetails = 0;
50
    my (@row);
51
 
52
    # if we are not or cannot connect then return 0 as we have not found anything
53
    connectRM ( \$RM_DB ) unless ( $RM_DB );
54
 
55
    # First get details from pv_id
56
 
57
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.PKG_LABEL, pv.SRC_PATH, pv.BUILD_TYPE" .
58
                    " FROM RELEASE_CONTENT rc, PACKAGE_VERSIONS pv, PACKAGES pkg" .
59
                    " WHERE rc.RTAG_ID = $RTAG_ID AND rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
60
    my $sth = $RM_DB->prepare($m_sqlstr);
61
    if ( defined($sth) )
62
    {
63
        if ( $sth->execute( ) )
64
        {
65
            if ( $sth->rows )
66
            {
67
                while ( @row = $sth->fetchrow_array )
68
                {
69
                    my ($name, $version, $suffix, $full ) = SplitPackage ($row[1], $row[2]);
70
                    my ($maj, $min, $patch, $build ) = SplitVersion( $version );
71
 
72
#print "$name, $suffix, $version, -- $maj, $min, $patch, $build\n";
73
                    $name .= '.' . $suffix if $suffix;
74
                    $datap->{$name} = join( '.', $maj,$min,$patch);
75
                    $all_names{$name} = 1;
76
 
77
#printf ( "%40s %-15s %s\n",  $name, "$maj.$min.$patch.$build", $row[2]);
78
                }
79
            }
80
            $sth->finish();
81
        }
82
    }
83
    else
84
    {
85
        Error("Prepare failure" );
86
    }
87
 
88
    disconnectRM(\$RM_DB);
89
 
90
}
91
 
92
#-------------------------------------------------------------------------------
93
# Function        : Main
94
#
95
# Description     :
96
#
97
# Inputs          :
98
#
99
# Returns         :
100
#
101
 
102
ErrorConfig( 'name'    =>'SANITY' );
103
 
104
#
105
#   Get versions for the two packages
106
#
107
my %legacy;
108
my %avm;
109
 
110
getPkgDetailsByRTAG_ID(1861, \%legacy);        # 1861 : Syd Release Legacy
111
getPkgDetailsByRTAG_ID(3822, \%avm);           # 3822 : Syd Tot and AVM
112
 
113
#DebugDumpData ("Legacy", \%legacy );
114
 
115
#
116
#   Examine all packages
117
#
118
my $same = 0;
119
my $diff = 0;
120
my $not_common = 0;
121
my @diffs;
122
 
123
foreach my $package ( sort keys %all_names )
124
{
125
#    print "Examine: $package\n";
126
    next if ( $stop_list{ $package} );
127
 
128
    if ( exists $legacy{$package} && exists $avm{$package} )
129
    {
130
#        print "Package in both: $package\n";
131
        if ( $legacy{$package} ne $avm{$package} )
132
        {
133
#            print "Package differs $package: $legacy{$package} ne $avm{$package}\n";
134
            $diff ++;
135
            push @diffs, $package;
136
        }
137
        else
138
        {
139
            $same++;
140
        }
141
    }
142
    else
143
    {
144
        $not_common++;
145
#        print "Package not in both\n";
146
    }
147
}
148
 
149
if ( $diff )
150
{
151
    print "The following packages are different\n\n";
152
    foreach my $package ( @diffs )
153
    {
154
        printf( "%30s Legacy: >%9s<    AVM-TOT:%9s\n", $package, $legacy{$package}, $avm{$package});
155
    }
156
}
157
print "\nPackage same: $same, Different: $diff, Stopped: $#stop_list, Not Common: $not_common\n";
158
 
159
 
160
exit;
161
 
162
 
163