Subversion Repositories DevTools

Rev

Rev 2635 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2635 Rev 2652
Line 28... Line 28...
28
#   Globals
28
#   Globals
29
#
29
#
30
my $RM_DB;
30
my $RM_DB;
31
my $VERSION = "1.0.0";                      # Update this
31
my $VERSION = "1.0.0";                      # Update this
32
my %packageVcs;
32
my %packageVcs;
33
 
33
my %pkgInfo;
34
#
34
#
35
#   Options
35
#   Options
36
#
36
#
37
my $opt_verbose = 0;
37
my $opt_verbose = 0;
38
my $opt_help = 0;
38
my $opt_help = 0;
Line 112... Line 112...
112
    Message ("Check Complete OK");
112
    Message ("Check Complete OK");
113
    exit 0;
113
    exit 0;
114
}
114
}
115
 
115
 
116
 
116
 
117
foreach my $packageName ( $opt_package, @ARGV )
117
foreach my $fileName ( $opt_package, @ARGV )
118
{
118
{
119
    next unless ( defined $packageName );
119
    next unless ( defined $fileName );
120
    next if ( $packageName eq 'Dataman' );
120
    next if ( $fileName eq 'Dataman' );
-
 
121
 
-
 
122
    $fileName =~ s~\.data$~~;
-
 
123
    $fileName =~ s~\.svg$~~;
-
 
124
    $fileName =~ s~\.importlog$~~;
-
 
125
    readPackageDataFile($fileName);
121
 
126
 
122
    $packageName =~ s~\.data$~~;
127
    foreach my $packageName( sort keys %pkgInfo )
123
    $packageName =~ s~\.svg$~~;
128
    {
124
    $packageName =~ s~\.importlog$~~;
-
 
125
    getVcsData($packageName) if ( $opt_report <= 1 || $opt_report == 6 );
129
        getVcsData($packageName) if ( $opt_report <= 1 || $opt_report == 6 );
126
    readPackageData($packageName);
130
        processPackage($packageName);
-
 
131
    }
127
}
132
}
128
exit 0;
133
exit 0;
129
 
134
 
130
#-------------------------------------------------------------------------------
135
#-------------------------------------------------------------------------------
131
# Function        : getVcsData
136
# Function        : getVcsData
Line 140... Line 145...
140
{
145
{
141
    my ($packageName) = @_;
146
    my ($packageName) = @_;
142
    %packageVcs = ();
147
    %packageVcs = ();
143
    my $pkg_id = GetPkgIdByName ( $packageName );
148
    my $pkg_id = GetPkgIdByName ( $packageName );
144
    GetData_by_pkg_id ( $pkg_id, $packageName  );
149
    GetData_by_pkg_id ( $pkg_id, $packageName  );
145
#    DebugDumpData("packageVcs", \%packageVcs );
150
    #DebugDumpData("packageVcs", \%packageVcs );
146
}
151
}
147
 
152
 
148
#-------------------------------------------------------------------------------
153
#-------------------------------------------------------------------------------
149
# Function        : readPackageData
154
# Function        : readPackageDataFile
150
#
155
#
151
# Description     : Read in package data
156
# Description     : Read in the data file. It may contain data for more
-
 
157
#                   than one package - but this is rare
152
#
158
#
-
 
159
# Inputs          : 
-
 
160
#
153
# Inputs          : Name of the package
161
# Returns         : Fills in %pkgInfo
154
#
162
#
155
# Returns         : 
-
 
156
#
163
#
157
our %ScmVersions;
164
our %ScmVersions;
158
sub readPackageData
165
sub readPackageDataFile
159
{
166
{
-
 
167
    %pkgInfo = ();
160
    my ($pname) = @_;
168
    my ($pname) = @_;
161
    my $fname = $pname . '.data';
169
    my $fname = $pname . '.data';
162
    my @updateList;
-
 
163
    Verbose2 ('Reading Package Data: ' . $fname);
170
    Verbose2 ('Reading Package Data: ' . $fname);
164
return unless ( -f $fname );
171
return unless ( -f $fname );
165
    Error "Cannot locate $fname" unless ( -f $fname );
172
    Error "Cannot locate $fname" unless ( -f $fname );
166
    %ScmVersions = ();
173
    %ScmVersions = ();
167
    require $fname;
174
    require $fname;
168
 
175
 
169
    Error "Data in $fname is not valid\n"
176
    Error "Data in $fname is not valid\n"
170
        unless ( keys(%ScmVersions) >= 0 );
177
        unless ( keys(%ScmVersions) >= 0 );
171
 
178
 
-
 
179
    foreach (keys %ScmVersions)
-
 
180
    {
-
 
181
        my $entry = $ScmVersions{$_};
-
 
182
        $pkgInfo{$entry->{name}}{$_} = $entry;
-
 
183
    }
-
 
184
 
-
 
185
    %ScmVersions = ();
-
 
186
}
-
 
187
 
-
 
188
#-------------------------------------------------------------------------------
-
 
189
# Function        : processPackage
-
 
190
#
-
 
191
# Description     : Process data for one package
-
 
192
#
-
 
193
# Inputs          : Name of the package
-
 
194
#
-
 
195
# Returns         : 
-
 
196
#
-
 
197
sub processPackage
-
 
198
{
-
 
199
    my ($pname) = @_;
-
 
200
    Error ("Internal: Hash data not found")
-
 
201
        unless ( exists $pkgInfo{$pname});
-
 
202
    my $pkgData = $pkgInfo{$pname};
172
 
203
 
-
 
204
    my @updateList;
173
    my $essentialCount = 0;
205
    my $essentialCount = 0;
174
    my $errorCount = 0;
206
    my $errorCount = 0;
175
    my $ecount = 0;
207
    my $ecount = 0;
176
    my $notOk = 0;
208
    my $notOk = 0;
177
    my $transferred = 0;
209
    my $transferred = 0;
Line 187... Line 219...
187
    my $adjustedPath = 0;
219
    my $adjustedPath = 0;
188
#    my $rtCount = 0;
220
#    my $rtCount = 0;
189
    my $rtErrorCount = 0;
221
    my $rtErrorCount = 0;
190
    
222
    
191
 
223
 
192
    foreach my $entry (sort {$a <=> $b}  keys(%ScmVersions) )
224
    foreach (sort {$a <=> $b}  keys(%{$pkgInfo{$pname}} ) )
193
    {
225
    {
-
 
226
        my $pkgEntry = $pkgInfo{$pname}{$_};
-
 
227
 
194
        $totalCount ++;
228
        $totalCount ++;
195
        $notProcessed++ unless $ScmVersions{$entry}{Scanned};
229
        $notProcessed++ unless $pkgEntry->{Scanned};
196
        $essentialCount++ if ( $ScmVersions{$entry}{Essential}  );
230
        $essentialCount++ if ( $pkgEntry->{Essential}  );
197
        $rippleProcessed++ if ( $ScmVersions{$entry}{rippleProcessed} );
231
        $rippleProcessed++ if ( $pkgEntry->{rippleProcessed} );
198
 
232
 
199
        $globalErrors++ if ( ($ScmVersions{$entry}{data}{errFlags} || '') eq 'e' );
233
        $globalErrors++ if ( ($pkgEntry->{data}{errFlags} || '') eq 'e' );
200
        $prjBase++ if ( $ScmVersions{$entry}{data}{BadProjectBase} );
234
        $prjBase++ if ( $pkgEntry->{data}{BadProjectBase} );
201
        $pkgProject++ if ( $ScmVersions{$entry}{data}{BadMakeProject} );
235
        $pkgProject++ if ( $pkgEntry->{data}{BadMakeProject} );
202
        $badPaths++ if ( $ScmVersions{$entry}{data}{BadPath} );
236
        $badPaths++ if ( $pkgEntry->{data}{BadPath} );
203
        $adjustedPath++ if ( $ScmVersions{$entry}{data}{adjustedPath} );
237
        $adjustedPath++ if ( $pkgEntry->{data}{adjustedPath} );
204
        unless ( $ScmVersions{$entry}{TagCreated} )
238
        unless ( $pkgEntry->{TagCreated} )
205
        {
239
        {
206
            $errorCount++ if ( $ScmVersions{$entry}{Essential}  );
240
            $errorCount++ if ( $pkgEntry->{Essential}  );
207
            $ecount++;
241
            $ecount++;
208
            Verbose ("Package Not Processed: " . $ScmVersions{$entry}{vname} . ' - ' . ($ScmVersions{$entry}{data}{errStr} || 'Unspecified Error')  );
242
            Verbose ("Package Not Processed: " . $pkgEntry->{vname} . ' - ' . ($pkgEntry->{data}{errStr} || 'Unspecified Error')  );
209
 
243
 
210
            unless ( $ScmVersions{$entry}{DeadWood} ||  $ScmVersions{$entry}{locked} eq 'N' )
244
            unless ( $pkgEntry->{DeadWood} ||  $pkgEntry->{locked} eq 'N' )
211
            {
245
            {
212
                $notOk++;
246
                $notOk++;
213
#Warning ("Package Not OK: " . $ScmVersions{$entry}{vname} . ' - ' . ($ScmVersions{$entry}{data}{errStr} || 'Unspecified Error')  );
247
#Warning ("Package Not OK: " . $pkgEntry->{vname} . ' - ' . ($pkgEntry->{data}{errStr} || 'Unspecified Error')  );
214
            }
248
            }
215
 
249
 
216
        }
250
        }
217
 
251
 
218
#        $rtCount += $ScmVersions{$entry}{data}{ReleaseTag}{tCount} || 0;
252
#        $rtCount += $pkgEntry->{data}{ReleaseTag}{tCount} || 0;
219
#        $rtErrorCount += $ScmVersions{$entry}{data}{ReleaseTag}{eCount} || 0;
253
#        $rtErrorCount += $pkgEntry->{data}{ReleaseTag}{eCount} || 0;
220
    }
254
    }
221
 
255
 
222
    foreach my $entry (sort {$a <=> $b}  keys(%ScmVersions) )
256
    foreach my $pvid (sort {$a <=> $b}  keys(%{$pkgInfo{$pname}} ) )
223
    {
257
    {
-
 
258
        my $pkgEntry = $pkgInfo{$pname}{$pvid};
224
        if ( $ScmVersions{$entry}{TagCreated} )
259
        if ( $pkgEntry->{TagCreated} )
225
        {
260
        {
226
            $transferred++;
261
            $transferred++;
227
            my $done = '';
262
            my $done = '';
228
            my $rmRef = $ScmVersions{$entry}{rmRef} ;
263
            my $rmRef = $pkgEntry->{rmRef} ;
229
 
264
 
230
            my $include = 1;
265
            my $include = 1;
231
            if ( exists $packageVcs{$entry} )
266
            if ( exists $packageVcs{$pvid} )
232
            {
267
            {
233
                if ( $opt_report == 6 )
268
                if ( $opt_report == 6 )
234
                {
269
                {
235
                    $include = 0 if ( $packageVcs{$entry} =~ m~^SVN::~ );
270
                    $include = 0 if ( $packageVcs{$pvid} =~ m~^SVN::~ );
236
                }
271
                }
237
                else
272
                else
238
                {
273
                {
239
                    $include = 0 if ( ($packageVcs{$entry} eq $rmRef) );
274
                    $include = 0 if ( ($packageVcs{$pvid} eq $rmRef) );
240
                }
275
                }
241
            }
276
            }
242
            else
277
            else
243
            {
278
            {
244
                $missingPVID++;
279
                $missingPVID++;
Line 248... Line 283...
248
 
283
 
249
            if ( $include || $opt_force)
284
            if ( $include || $opt_force)
250
            {
285
            {
251
                    $diffCount++;
286
                    $diffCount++;
252
                    $done = ' *' unless $done;
287
                    $done = ' *' unless $done;
253
                    push @updateList, $entry;
288
                    push @updateList, $pvid;
254
            }
289
            }
255
 
290
 
256
            Verbose ("Processed: " . $ScmVersions{$entry}{vname} . ' :: ' . ($rmRef || '???') . $done );
291
            Verbose ("Processed: " . $pkgEntry->{vname} . ' :: ' . ($rmRef || '???') . $done );
257
            
292
            
258
        }
293
        }
259
    }
294
    }
260
 
295
 
261
    if ( $opt_report == 6 )
296
    if ( $opt_report == 6 )
262
    {
297
    {
263
        # Display missing updates
298
        # Display missing updates
264
        foreach my $entry ( @updateList )
299
        foreach my $entry ( @updateList )
265
        {
300
        {
266
            print "$pname : $ScmVersions{$entry}{vname}\n";
301
            print "$pname : $pkgData->{$entry}{vname}\n";
267
        }
302
        }
268
        return;
303
        return;
269
    }
304
    }
270
 
305
 
271
    if ( $opt_report == 5 )
306
    if ( $opt_report == 5 )
Line 360... Line 395...
360
    #   Now do the RM Update
395
    #   Now do the RM Update
361
    #
396
    #
362
    Message('Updating Release Manager: ' . $opt_rm);
397
    Message('Updating Release Manager: ' . $opt_rm);
363
    foreach my $entry ( @updateList )
398
    foreach my $entry ( @updateList )
364
    {
399
    {
365
        intoReleaseManager ( $entry, $ScmVersions{$entry}{rmRef} );
400
        intoReleaseManager ( $entry, $pkgData->{$entry}{vname}  ,$pkgData->{$entry}{rmRef} );
366
    }
401
    }
367
}
402
}
368
 
403
 
369
#-------------------------------------------------------------------------------
404
#-------------------------------------------------------------------------------
370
# Function        : intoReleaseManager
405
# Function        : intoReleaseManager
371
#
406
#
372
# Description     : Update VCS tags in RM
407
# Description     : Update VCS tags in RM
373
#
408
#
374
# Inputs          : $pvid           - PVId
409
# Inputs          : $pvid           - PVId
-
 
410
#                   $name           - Package Version (text)
375
#                   $tag            - New Tag
411
#                   $tag            - New Tag
376
#
412
#
377
# Returns         : 
413
# Returns         : 
378
#
414
#
379
sub intoReleaseManager
415
sub intoReleaseManager
380
{
416
{
381
    my ($pvid, $new_tag ) = @_;
417
    my ($pvid, $name, $new_tag ) = @_;
382
    my @row;
418
    my @row;
383
    my $user = 3768;            # buildadm
419
    my $user = 3768;            # buildadm
384
 
420
 
385
    connectRM(\$RM_DB, $opt_verbose) unless $RM_DB;
421
    connectRM(\$RM_DB, $opt_verbose) unless $RM_DB;
386
 
422
 
387
    Verbose ("ToRm: $ScmVersions{$pvid}{vname}  - $new_tag");
423
    Verbose ("ToRm: $pvid, $name  - $new_tag");
388
    my $m_sqlstr =  "begin release_manager.PK_RMAPI.update_vcs_details($pvid, '$new_tag', $user); end;";
424
    my $m_sqlstr =  "begin release_manager.PK_RMAPI.update_vcs_details($pvid, '$new_tag', $user); end;";
389
    my $sth = $RM_DB->prepare($m_sqlstr);
425
    my $sth = $RM_DB->prepare($m_sqlstr);
390
    if ( defined($sth) )
426
    if ( defined($sth) )
391
    {
427
    {
392
        if ( $sth->execute( ) )
428
        if ( $sth->execute( ) )