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