Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
392 dpurdie 1
########################################################################
2
# Copyright (C) 1998-2012 Vix Technology, All rights reserved
3
#
4
# Module name   : cc2svn_gendata.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : Get all packages that are used in all releases
10
#                 Create a data file that can be used offline
11
#
12
#                 The process will exclude some old releases
13
#
14
#                 Generate data on Essential Package Versions to be
15
#                 transferred from CC to Subversion
16
#
17
#......................................................................#
18
 
19
require 5.006_001;
20
use strict;
21
use warnings;
22
use JatsError;
23
use JatsSystem;
24
use Getopt::Long;
25
use Pod::Usage;                             # required for help support
26
use JatsRmApi;
27
use ConfigurationFile;
28
 
29
use DBI;
30
use HTTP::Date;
31
 
32
my $VERSION = "1.2.3";                      # Update this
33
my $opt_verbose = 0;
34
my $opt_help = 0;
35
my $opt_manual;
36
my $opt_test;
37
my $opt_limit;
38
my $opt_quick;
39
my $RM_DB;
40
my $now = time();
41
 
42
#
43
#   Package information
44
#
45
my %Releases;
46
my %Packages;
47
my %Suffixes;
48
my @StrayPackages;
49
my %AllPackages;
50
 
51
my $doAllReleases = 0;
52
my $doIncludeOnly = 0;
53
my @includedProjects = (
54
#        481,    # UK BUS HOPS
55
);
56
 
57
my @includedReleases = (
58
        6222,   # HOME > UK STAGE COACH (SSW) > Mainline
59
        14503,  # HOME > UK STAGE COACH (SSW) > ITSO_HOPS_3
60
        21303,  # HOME > UK STAGE COACH (SSW) > SUPPORT_HOPS_REPORTS
61
        21343,  # HOME > UK STAGE COACH (SSW) > SUPPORT_CIPP
62
        17223,  # HOME > UK STAGE COACH (SSW) > ITSO HOPS 4
63
);
64
 
65
 
66
my @excludeProjects = ( 162,            # WASHINGTON (WDC)
67
                        341,            # TUTORIAL (TUT)
68
                        142,            # SYDNEY (SYD)
69
                        182 ,           # ROME (ROM)
70
                        6 ,             # GMPTE/PCL (GMP)
71
                        521,            # NSW CLUB CARD
72
                        221,            # NZ STAGE COACH (NZS)
73
                        82              # LVS
74
                        );
75
my @excludeReleases = ( 20424,          # MASS_REF (MAS) > test
76
                        9043,           # TECHNOLOGY GROUP > Development Environment - For Test Setup
77
                        #9263,           # TECHNOLOGY GROUP > Buildtool DEVI&TEST
78
                        14383,          # TECHNOLOGY GROUP > eBrio TDS
79
                        20463,          # TECHNOLOGY GROUP > TPIT - BackOffice Linux build
80
                        14603,          # TECHNOLOGY GROUP > TPIT - BackOffice 64 bit [CCB Mode!]
81
                        22163,          # GLOBAL PRODUCT MGMT > Rio Tinto - Remote Draught Survey
82
                        19483,          # SEATTLE (SEA) > Phase 2 - I18 [backup] [Restrictive Mode]
83
                        20403,          # SEATTLE (SEA) > Phase 2 - I19 [backup]
84
                        20983,          # ??? May have been deleted
395 dpurdie 85
                        13083,          # TECHNOLOGY GROUP > TRACS
86
                        15224,          # 64Bit Solaris Test
392 dpurdie 87
                        );
88
 
89
my %sillyVersions =
90
(
91
    '2b6'           => '2.6.0.cots',
92
    '1.0b2'         => '1.0.2.cots',
93
    '1.6.x'         => '1.6.0.cots',
94
    '3.5beta12.5'   => '3.5.12.5.cots',
95
);
96
 
97
#-------------------------------------------------------------------------------
98
# Function        : Main Entry
99
#
100
# Description     :
101
#
102
# Inputs          :
103
#
104
# Returns         :
105
#
106
my $result = GetOptions (
107
                "help+"         => \$opt_help,          # flag, multiple use allowed
108
                "manual"        => \$opt_manual,        # flag
109
                "verbose+"      => \$opt_verbose,       # flag
110
                "test:s"        => \$opt_test,          # Test a version string
111
                "limit:n"       => \$opt_limit,         #
112
                "quick"         => \$opt_quick,         # Don't look for indirects
113
                );
114
 
115
#
116
#   Process help and manual options
117
#
118
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
119
pod2usage(-verbose => 1)  if ($opt_help == 2 );
120
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
121
 
122
if ( $opt_test )
123
{
124
    my @results = massageVersion( $opt_test, 'DummyName' );
125
    Message ("Version", $opt_test, @results);
126
    exit 1;
127
}
128
 
129
 
130
ErrorConfig( 'name'    =>'CC2SVN_GENDATA' );
131
GetAllPackageNames();
132
getReleaseDetails();
133
getPkgDetailsByRTAG_ID();
134
my $count;
135
$count = keys %Packages;
136
print "Directly referenced Packages: $count\n";
137
LocateStrays() unless ($opt_quick);
138
$count = keys %Packages;
139
print "Indirectly referenced Packages: $count\n";
140
outputData();
141
 
142
if ( $opt_verbose > 1 )
143
{
144
    print "=========================================================================\n";
145
    DebugDumpData("Releases", \%Releases);
146
    print "=========================================================================\n";
147
    DebugDumpData("Packages", \%Packages );
148
    print "=========================================================================\n";
149
    DebugDumpData("Suffixes", \%Suffixes );
150
}
151
 
152
$count = keys %Packages;
153
print "Total References Packages: $count\n";
154
 
155
exit;
156
 
157
#-------------------------------------------------------------------------------
158
# Function        : getReleaseDetails
159
#
160
# Description     : Determine all candiate releases
161
#
162
# Inputs          : 
163
#
164
# Returns         : 
165
#
166
sub getReleaseDetails
167
{
168
    my (@row);
169
 
170
    # if we are not or cannot connect then return 0 as we have not found anything
171
    connectRM(\$RM_DB) unless $RM_DB;
172
 
173
    # First get all packages that are referenced in a Release
174
    # This will only get the top level packages
175
    # From non-archived releases
176
 
177
    my $m_sqlstr = "SELECT prj.PROJ_NAME, rt.RTAG_NAME, rt.PROJ_ID, rt.RTAG_ID, rt.official" .
178
                   " FROM release_manager.release_tags rt, release_manager.projects prj" .
179
                   " WHERE prj.PROJ_ID = rt.PROJ_ID " .
180
                   "   AND rt.official != 'A' AND rt.official != 'Y'" .
181
                   " order by prj.PROJ_NAME";
182
    my $sth = $RM_DB->prepare($m_sqlstr);
183
    if ( defined($sth) )
184
    {
185
        if ( $sth->execute( ) )
186
        {
187
#            print "--- Execute\n";
188
            if ( $sth->rows )
189
            {
190
#                print "--- Execute ROWS\n";
191
                while ( @row = $sth->fetchrow_array )
192
                {
193
                    my $rtag_id =$row[3];
194
                    my $proj_id = $row[2];
195
 
196
                    $Releases{$rtag_id}{pName} = $row[0];
197
                    $Releases{$rtag_id}{name} = $row[1];
198
                    $Releases{$rtag_id}{proj_id} = $proj_id;
199
                    $Releases{$rtag_id}{rtag_id} = $rtag_id;
200
                    $Releases{$rtag_id}{official} = $row[4];
201
 
202
                    unless ( $doAllReleases )
203
                    {
204
                        if (grep {$_ eq $proj_id} @excludeProjects) {
205
                            $Releases{$rtag_id}{excluded} = 'E';
206
                        }
207
 
208
                        if (grep {$_ eq $rtag_id} @excludeReleases) {
209
                            $Releases{$rtag_id}{excluded} = 'E';
210
                        }
211
                    }
212
 
213
                    if ( $doIncludeOnly )
214
                    {
215
 
216
                        if (grep {$_ eq $proj_id} @includedProjects)
217
                        {
218
                            delete $Releases{$rtag_id}{excluded};
219
                        }
220
                        else
221
                        {
222
                            $Releases{$rtag_id}{excluded} = 'E';
223
                        }
224
 
225
                        if (grep {$_ eq $rtag_id} @includedReleases)
226
                        {
227
                            delete $Releases{$rtag_id}{excluded};
228
                        }
229
                    }
230
 
231
                    unshift @row, $Releases{$rtag_id}{excluded} || ' ';
232
                    print join (',',@row), "\n" if ($opt_verbose);
233
                }
234
            }
235
#            print "--- Finish\n";
236
            $sth->finish();
237
        }
238
        else
239
        {
240
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
241
        }
242
    }
243
    else
244
    {
245
        Error("Prepare failure" );
246
    }
247
}
248
 
249
 
250
sub getPkgDetailsByRTAG_ID
251
{
252
    my (@row);
253
    my $excludes = '';
254
    my $count = 0;
255
 
256
    # if we are not or cannot connect then return 0 as we have not found anything
257
    connectRM(\$RM_DB) unless $RM_DB;
258
 
259
    Message ("Extract toplevel dependencies");
260
 
261
    # First get all packages that are referenced in a Release
262
    # This will only get the top level packages
263
    # From non-archived releases
264
 
265
    unless ($doAllReleases)
266
    {
267
        foreach  ( @excludeProjects )
268
        {
269
            $excludes .= " AND prj.PROJ_ID != $_ ";
270
        }
271
        foreach  ( @excludeReleases )
272
        {
273
            $excludes .= " AND rt.RTAG_ID != $_ ";
274
        }
275
    }
276
 
277
    my $m_sqlstr = "SELECT DISTINCT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.DLOCKED" .
278
                   "    , release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), pv.PKG_ID" .
279
                   "    , rt.RTAG_ID, rmv.VIEW_NAME, pv.MODIFIED_STAMP, prj.PROJ_ID" .
280
                   " FROM RELEASE_MANAGER.RELEASE_CONTENT rc, RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
281
                   "      RELEASE_MANAGER.PACKAGES pkg, release_manager.release_tags rt, release_manager.projects prj" .
282
                   "    , release_manager.views rmv" .
283
                   " WHERE rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID" .
284
                   "   AND rmv.VIEW_ID = rc.BASE_VIEW_ID" .
285
                   "   AND prj.PROJ_ID = rt.PROJ_ID and rt.RTAG_ID = rc.RTAG_ID" .
286
                   "   AND rt.official != 'A' AND rt.official != 'Y'" .
287
                   $excludes .
288
                   " order by pkg.PKG_NAME";
289
    my $sth = $RM_DB->prepare($m_sqlstr);
290
    if ( defined($sth) )
291
    {
292
        if ( $sth->execute( ) )
293
        {
294
#            print "--- Execute\n";
295
            if ( $sth->rows )
296
            {
297
#                print "--- Execute ROWS\n";
298
                while ( @row = $sth->fetchrow_array )
299
                {
300
                    print join (',',@row), "\n" if ($opt_verbose);
301
                    my $pvid = $row[0];
302
                    unless ( exists $Packages{$pvid}{name} )
303
                    {
304
                        $Packages{$pvid}{name} = $row[1];
305
                        $Packages{$pvid}{version} = $row[2];
306
                        $Packages{$pvid}{locked} = $row[3];
307
                        $row[4] =~ tr~\\/~/~;
308
                        $Packages{$pvid}{vcstag} = $row[4];
309
                        $Packages{$pvid}{pkgid} = $row[5];
310
                        $Packages{$pvid}{tlp} = 1;
311
                        ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
312
                        $Suffixes{$Packages{$pvid}{suffix}}++;
313
 
314
                        push @StrayPackages, $pvid;
315
                    }
316
 
317
                    my $rtag_id = $row[6];
318
                    push @{$Packages{$pvid}{release}}, $rtag_id;
319
                    $Packages{$pvid}{view}{$row[7]}++ if ( $row[7] );
320
 
321
                    $Packages{$pvid}{Age} = ($now - str2time( $row[8] )) / (60 * 60 * 24);
322
 
323
                    my $proj_id = $row[9];
324
                    push @{$Packages{$pvid}{projects}}, $proj_id;
325
 
326
                    if ( $doIncludeOnly )
327
                    {
328
                        if (grep {$_ eq $proj_id} @includedProjects)
329
                        {
330
                            $Packages{$pvid}{NamedProject} = 1;
331
                        }
332
                        if (grep {$_ eq $rtag_id} @includedReleases)
333
                        {
334
                            $Packages{$pvid}{NamedProject} = 1;
335
                        }
336
                    }
337
                    else
338
                    {
339
                        $Packages{$pvid}{NamedProject} = 1;
340
                    }
341
 
342
 
343
                    if ( $opt_limit )
344
                    {
345
                        last if ( $count++ > $opt_limit );
346
                    }
347
                }
348
            }
349
#            print "--- Finish\n";
350
            $sth->finish();
351
        }
352
        else
353
        {
354
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
355
        }
356
    }
357
    else
358
    {
359
        Error("Prepare failure" );
360
    }
361
}
362
 
363
#-------------------------------------------------------------------------------
364
# Function        : GetDepends
365
#
366
# Description     :
367
#
368
# Inputs          : $pvid
369
#
370
# Returns         :
371
#
372
sub GetDepends
373
{
374
    my ($pv_id ) = @_;
375
 
376
    #
377
    #   Now extract the package dependacies
378
    #
379
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.DLOCKED, release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), pv.PKG_ID, pv.MODIFIED_STAMP" .
380
                  " FROM RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
381
                  " WHERE pd.PV_ID = \'$pv_id\' AND pd.DPV_ID = pv.PV_ID" .
382
                  "       AND pv.PKG_ID = pkg.PKG_ID";
383
    my $sth = $RM_DB->prepare($m_sqlstr);
384
    if ( defined($sth) )
385
    {
386
        if ( $sth->execute( ) )
387
        {
388
            if ( $sth->rows )
389
            {
390
                while ( my @row = $sth->fetchrow_array )
391
                {
392
                    my $pvid = $row[0];
393
                    unless ( exists $Packages{$pvid}{name} )
394
                    {
395
                        print join (',',@row), "\n" if ($opt_verbose) ;
396
                        $Packages{$pvid}{name} = $row[1];
397
                        $Packages{$pvid}{version} = $row[2];
398
                        $Packages{$pvid}{locked} = $row[3];
399
                        $row[4] =~ tr~\\/~/~;
400
                        $Packages{$pvid}{vcstag} = $row[4];
401
                        $Packages{$pvid}{pkgid} = $row[5];
402
                        $Packages{$pvid}{Age} = ($now - str2time( $row[6] )) / (60 * 60 * 24);
403
 
404
                        $Packages{$pvid}{depend} = 1;
405
                        ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version},$Packages{$pvid}{name} );
406
                        $Suffixes{$Packages{$pvid}{suffix}}++;
407
 
408
                        push @StrayPackages, $pvid;
409
                    }
410
 
411
                    push @{$Packages{$pvid}{usedBy}}, $pv_id;
412
                }
413
            }
414
            $sth->finish();
415
        }
416
        else
417
        {
418
        Error("GetDepends:Execute failure" );
419
        }
420
    }
421
    else
422
    {
423
        Error("GetDepends:Prepare failure" );
424
    }
425
}
426
 
427
#-------------------------------------------------------------------------------
428
# Function        : GetAllPackageNames
429
#
430
# Description     :
431
#
432
# Inputs          : None
433
#
434
# Returns         :
435
#
436
sub GetAllPackageNames
437
{
438
    # if we are not or cannot connect then return 0 as we have not found anything
439
    connectRM(\$RM_DB) unless $RM_DB;
440
 
441
    #
442
    #   Now extract all the package names
443
    #
444
    my $m_sqlstr = "SELECT pkg.PKG_ID, pkg.PKG_NAME" .
445
                  " FROM RELEASE_MANAGER.PACKAGES pkg";
446
    my $sth = $RM_DB->prepare($m_sqlstr);
447
    if ( defined($sth) )
448
    {
449
        if ( $sth->execute( ) )
450
        {
451
            if ( $sth->rows )
452
            {
453
                while ( my @row = $sth->fetchrow_array )
454
                {
455
                    my $id = $row[0];
456
                    my $name = $row[1];
457
                    next unless ( $id );
458
                    $AllPackages{$id} = $name;
459
                }
460
            }
461
            $sth->finish();
462
        }
463
        else
464
        {
465
        Error("GetAllPackageNames:Execute failure" );
466
        }
467
    }
468
    else
469
    {
470
        Error("GetAllPackageNames:Prepare failure" );
471
    }
472
}
473
 
474
 
475
#-------------------------------------------------------------------------------
476
# Function        : massageVersion
477
#
478
# Description     : Process a version number and return usful bits
479
#
480
# Inputs          : Version Number
481
#                   Package Name - debug only
482
#
483
# Returns         : An array
484
#                       suffix
485
#                       multipart version string useful for text comparisons
486
#
487
sub massageVersion
488
{
489
    my ($version, $name) = @_;
490
    my ($major, $minor, $patch, $build, $suffix);
491
    my $result;
492
    my $isaRipple;
493
    my $isaWIP;
494
    $build = 0;
495
 
496
    #
497
    #   Pre-massage some silly ones
498
    #
499
    if ( exists $sillyVersions{$version} ) {
500
        $version = $sillyVersions{$version};
501
    }
502
 
503
 
504
    if ( $version =~ m~(.*)\.cots$~ ) {
505
        my $cots_base = $1;
506
        $suffix = '.cots';
507
        if ( $version =~ m~(.*?)\.([0-9]{4})\.cots$~ )
508
        {
509
            $result = $1 . sprintf (".%4.4d", $2) . $suffix;
510
        }
511
        else
512
        {
513
            $result = $cots_base . '.0000.cots';
514
        }
515
    }
516
    #
517
    #   Convert version into full form for comparisions
518
    #       nnn.nnn.nnn.[p]nnn.xxx
519
    #       nnn.nnn.nnn.[p]nnn-xxx
520
    #       nnn.nnn.nnn-[p]nnn.xxx
521
    #       nnn.nnn.nnn-[p]nnn-xxx
522
    #       nnn.nnn.nnn[p]nnn-xxx
523
    #
524
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)[-.p][p]?(\d+)([-.](.*))?$~ ) {
525
        $major = $1;
526
        $minor = $2;
527
        $patch = $3;
528
        $build = $4;
529
        $suffix = defined $6 ? ".$6" : '';
530
    }
531
    #
532
    #       nn.nnn.nnnnn.xxx
533
    #       nn.nnn.nnnnn-xxx
534
    #
535
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)([-.](.*))?$~ ) {
536
        $major = $1;
537
        $minor = $2;
538
        $patch = $3;
539
        if ( length( $patch) >= 4 )
540
        {
541
            $build = substr( $patch, -3 ,3);
542
            $patch = substr( $patch,  0 ,length($patch)-3);
543
        }
544
        $suffix = defined $5 ? ".$5" : '';
545
    }
546
    #
547
    #       nn.nnn.nnn_nnn
548
    #
549
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)[-_.](\d+)$~ ) {
550
        $major = $1;
551
        $minor = $2;
552
        $patch = $3;
553
        $build = $4;
554
        $suffix = '';
555
    }
556
 
557
    #
558
    #       nnn.nnn.nnn
559
    #       nnn.nnn-nnn
560
    #
561
    elsif ( $version =~ m~^(\d+)\.(\d+)[-.](\d+)$~ ) {
562
        $major = $1;
563
        $minor = $2;
564
        $patch = $3;
565
        $suffix = '';
566
    }
567
 
568
    #
569
    #       nnn.nnn
570
    #
571
    elsif ( $version =~ m~^(\d+)\.(\d+)$~ ) {
572
        $major = $1;
573
        $minor = $2;
574
        $patch = 0;
575
        $suffix = '';
576
    }
577
    #
578
    #       nnn.nnn.nnnz
579
    #
580
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)([a-z])$~ ) {
581
        $major = $1;
582
        $minor = $2;
583
        $patch = $3;
584
        $build = ord($4) - ord('a');
585
        $suffix = '.cots';
586
    }
587
    #
588
    #       ???REV=???
589
    #
590
    elsif ( $version =~ m~REV=~ ) {
591
        $suffix = '.cots';
592
        $result = $version . '.0000.cots';
593
    }
594
 
595
    #
596
    #   Wip Packages
597
    #   Should be essential, but want to sort very low
598
    #
599
    elsif ($version =~ m~\((.*)\)(\.*)~) {
600
        $suffix = $2;
601
        $result = "000.000.000.000.$suffix";
602
        $isaWIP = 1;
603
    }
604
    #
605
    #   zzzzzzzzzzzzzzz.cots
606
    #   zzzzzzzzzz.nnnn.cots
607
    #
608
    else  {
609
        Warning ("Unknown version number: '$name','$version'");
610
        $version =~ m~(\.\w+)$~;
611
        $suffix = $1 || '';
612
        $result = $version;
613
    }
614
 
615
    $isaRipple = ($build > 0);
616
    unless ( $result )
617
    {
618
        $result = sprintf("%3.3d.%3.3d.%3.3d.%3.3d%s", $major,$minor,$patch,$build,$suffix || '.0000');
619
    }
620
 
621
#    $suffix = $suffixFixup{$suffix} if ( exists $suffixFixup{$suffix} );
622
 
623
    return ($suffix, $result, $isaRipple, $isaWIP );
624
}
625
 
626
 
627
#-------------------------------------------------------------------------------
628
# Function        : LocateStrays
629
#
630
# Description     :
631
#
632
# Inputs          :
633
#
634
# Returns         :
635
#
636
sub LocateStrays
637
{
638
    Message ("Locate indirectly referenced packages");
639
    while ( $#StrayPackages >= 0 )
640
    {
641
        my $pv_id = pop @StrayPackages;
642
 
643
        next if ( exists $Packages{$pv_id}{done} );
644
#print "... ",$#StrayPackages,"\n";
645
        GetDepends( $pv_id);
646
        $Packages{$pv_id}{done} = 1;
647
    }
648
}
649
 
650
#-------------------------------------------------------------------------------
651
# Function        : outputData
652
#
653
# Description     : Write out data in a form to allow post processing
654
#
655
# Inputs          : 
656
#
657
# Returns         : 
658
#
659
sub outputData
660
{
661
    my $file = "cc2svn.raw.txt";
662
    Message ("Create: $file");
663
    my $fh = ConfigurationFile::New( $file );
664
 
665
    $fh->DumpData(
666
        "\n# Releases.\n#\n",
667
        "ScmReleases", \%Releases );
668
 
669
    foreach ( keys %Packages )
670
    {
671
        delete $Packages{$_}{done};
672
        next if ( $Packages{$_}{name} =~ ~m~CSWcfengine~ );
673
 
674
        if ($Packages{$_}{name} eq 'Activestate Perl - Solaris')
675
        {
676
            delete $Packages{$_};
677
            next;
678
        }
679
 
680
        if ( $Packages{$_}{name} =~ m/^CSW/ || $Packages{$_}{name} =~ m/^Solaris$/)
681
        {
682
            delete $Packages{$_};
683
            next;
684
        }
685
 
686
        if ( $Packages{$_}{name} =~ m/^jats_/)
687
        {
688
            delete $Packages{$_};
689
            next;
690
        }
691
 
692
    }
693
 
694
    $fh->DumpData(
695
        "\n# Packages.\n#\n",
696
        "ScmPackages", \%Packages );
697
 
698
    $fh->DumpData(
699
        "\n# Suffixes.\n#\n",
700
        "ScmSuffixes", \%Suffixes );
701
 
702
    $fh->DumpData(
703
        "\n# All Package Names.\n#\n",
704
        "ScmAllPackages", \%AllPackages );
705
 
706
    #
707
    #   Close out the file
708
    #
709
    $fh->Close();
710
 
711
#    #
712
#    #   Split up package data into small files for easy consumption
713
#    #
714
#
715
#    foreach ( keys %Packages )
716
#    {
717
#        my $file = "cc2svn.raw.${_}.txt";
718
#        Message ("Create: $file");
719
#        my $fh = ConfigurationFile::New( $file );
720
#
721
#        $fh->DumpData(
722
#            "\n# Releases.\n#\n",
723
#            "ScmReleases", \$Packages{$_} );
724
#        $fh->Close();
725
#    }
726
 
727
}
728
 
729
 
730
#-------------------------------------------------------------------------------
731
#   Documentation
732
#
733
 
734
=pod
735
 
736
=for htmltoc    SYSUTIL::cc2svn::
737
 
738
=head1 NAME
739
 
740
cc2svn_gendata - Extract CC2SVN Essential Package Data from Release Manager
741
 
742
=head1 SYNOPSIS
743
 
744
  jats cc2svn_gendata [options]
745
 
746
 Options:
747
    -help              - brief help message
748
    -help -help        - Detailed help message
749
    -man               - Full documentation
750
    -test=version      - Test a version string, then exit
751
    -limit=n           - Limit packages processed. Test only
752
 
753
=head1 OPTIONS
754
 
755
=over 8
756
 
757
=item B<-help>
758
 
759
Print a brief help message and exits.
760
 
761
=item B<-help -help>
762
 
763
Print a detailed help message with an explanation for each option.
764
 
765
=item B<-man>
766
 
767
Prints the manual page and exits.
768
 
769
=item B<-test=version>
770
 
771
Examine a package version string and report how the tool will parse it.
772
 
773
=item B<-limit=n>
774
 
775
Limit the number of packages processed by the tool. This is only used to
776
simplify testing of the program
777
 
778
=back
779
 
780
=head1 DESCRIPTION
781
 
782
This program is a tool used in the conversion of ClearCase VOBS to subversion.
783
It will:
784
 
785
=over 8
786
 
787
=item *
788
 
789
Determine all Releases in Release manager and mark those that
790
are to be excluded.
791
 
792
=item *
793
 
794
Determine all the package-versions used by the releases that are
795
not excluded. These are called 'direct' dependencies.
796
 
797
=item *
798
 
799
Recursively find all the dependent packages of all packages. New package
800
versions are called 'indirect' dependencies. They are buried. This process can
801
take several minutes.
802
 
803
=back
804
 
805
The data collected is dumped into a text file for later processing.
806
 
807
=cut
808