Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
394 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 $opt_mode = '';
40
my $RM_DB;
41
my $DM_DB;
42
my $now = time();
43
 
44
#
45
#   Package information
46
#
47
my %Releases;
48
my %Packages;
49
my %Suffixes;
50
my @StrayPackages;
51
my %AllPackages;
52
 
53
my %AllBoms;
54
my %sboms;
55
my %os_id_list;
56
my %os_env_list;
57
my %sbom_pvid;
58
 
59
my $doAllReleases = 0;
60
my $doIncludeOnly = 1;
61
my @includedProjects = (
62
#        481,    # UK BUS HOPS
63
);
64
 
65
my @includedReleases = (
66
        6222,   # HOME > UK STAGE COACH (SSW) > Mainline
67
        14503,  # HOME > UK STAGE COACH (SSW) > ITSO_HOPS_3
68
        21303,  # HOME > UK STAGE COACH (SSW) > SUPPORT_HOPS_REPORTS
69
        21343,  # HOME > UK STAGE COACH (SSW) > SUPPORT_CIPP
70
        17223,  # HOME > UK STAGE COACH (SSW) > ITSO HOPS 4
71
);
72
 
73
 
74
my @excludeProjects = ( 162,            # WASHINGTON (WDC)
75
                        341,            # TUTORIAL (TUT)
76
                        142,            # SYDNEY (SYD)
77
                        182 ,           # ROME (ROM)
78
                        6 ,             # GMPTE/PCL (GMP)
79
                        521,            # NSW CLUB CARD
80
                        221,            # NZ STAGE COACH (NZS)
81
                        82              # LVS
82
                        );
83
my @excludeReleases = ( 20424,          # MASS_REF (MAS) > test
84
                        9043,           # TECHNOLOGY GROUP > Development Environment - For Test Setup
85
                        #9263,           # TECHNOLOGY GROUP > Buildtool DEVI&TEST
86
                        14383,          # TECHNOLOGY GROUP > eBrio TDS
87
                        20463,          # TECHNOLOGY GROUP > TPIT - BackOffice Linux build
88
                        14603,          # TECHNOLOGY GROUP > TPIT - BackOffice 64 bit [CCB Mode!]
89
                        22163,          # GLOBAL PRODUCT MGMT > Rio Tinto - Remote Draught Survey
90
                        19483,          # SEATTLE (SEA) > Phase 2 - I18 [backup] [Restrictive Mode]
91
                        20403,          # SEATTLE (SEA) > Phase 2 - I19 [backup]
92
                        20983,          # ??? May have been deleted
93
                        );
94
 
95
my @excludeBomProjects = (
96
    4,      # SINGAPORE (SG)
97
    6,      # GMPTE/PCL (GMP)
98
    42,     # SAN FRANCISCO (SFO)
99
    62,     # OSLO (OSO)
100
    82,     # LAS VEGAS (LVS)
101
    102,    # VENTURA (VC)
102
#    122,    # VASTTRAFIK (VTK)
103
    142,    # SYDNEY (SYD)
104
    162,    # WASHINGTON (WDC)
105
#    164,    # SEATTLE (SEA)
106
    182,    # ROME (ROM)
107
#    202,    # STOCKHOLM (SLS)
108
#    221,    # NZ STAGE COACH (NZS)
109
#    261,    # VÄSTTRAFIK PRODUCTION (VTProd)
110
#    301,    # BEIJING (BEI)
111
    321,    # SAN FRANCISCO PRODUCTION (SFOProd)
112
#    361,    # UK STAGE COACH (SSW) Historical
113
#    401,    # SEATTLE INTEGRATION (SEA Int)
114
#    421,    # UK STAGE COACH PRODUCTION (SSWProd)
115
    441,    # COTRAL
116
    461,    # TASMANIA DEMO (MFCS)
117
#    481,    # TECHNOLOGY GROUP
118
#    501,    # UK Certification (UKCert)
119
#    503,    # UK SOUTHWEST TRAINS (SWT)
120
#    521,    # UKSP
121
#    541,    # UK BUS HOPS (SBH)
122
#    561,    # NSW Club Card (NCC)
123
#    581,    # UK Projects
124
#    601,    # GLOBAL PRODUCT MGMT(GPM)
125
    621,    # NEW DEHLI (NDL)
126
#    641,    # TRACS Projects
127
#    701,    # BANGKOK (BKK)
128
#    721,    # CAPE TOWN
129
);
130
 
131
my @includeBomProjects = (
132
    361,    # UK STAGE COACH (SSW) Historical
133
    421,    # UK STAGE COACH PRODUCTION (SSWProd)
134
    501,    # UK Certification (UKCert)
135
    503,    # UK SOUTHWEST TRAINS (SWT)
136
    521,    # UKSP
137
    541,    # UK BUS HOPS (SBH)
138
    581,    # UK Projects
139
    641,    # TRACS Projects
140
);
141
 
142
 
143
my %sillyVersions =
144
(
145
    '2b6'           => '2.6.0.cots',
146
    '1.0b2'         => '1.0.2.cots',
147
    '1.6.x'         => '1.6.0.cots',
148
    '3.5beta12.5'   => '3.5.12.5.cots',
149
);
150
 
151
my %suffixFixup = (
152
    '.sf'           => '.sfo',
153
    '.vt'           => '.vtk',
154
    '.lv'           => '.lvs',
155
    '.was'          => '.wdc',
156
    '.uk.1'         => '.uk',
157
    '.ssts.demo'    => '.ssts',
158
    '.u244.syd'     => '.syd',
159
    '.pxxx.sea'     => '.sea',
160
    '.pxxx.syd'     => '.syd',
161
    '.pxxx.sydddd'  => '.syd',
162
    '.oslo'         => '.oso',
163
);
164
 
165
#-------------------------------------------------------------------------------
166
# Function        : Main Entry
167
#
168
# Description     :
169
#
170
# Inputs          :
171
#
172
# Returns         :
173
#
174
my $result = GetOptions (
175
                "help+"         => \$opt_help,          # flag, multiple use allowed
176
                "manual"        => \$opt_manual,        # flag
177
                "verbose+"      => \$opt_verbose,       # flag
178
                "test:s"        => \$opt_test,          # Test a version string
179
                "limit:n"       => \$opt_limit,         #
180
                "quick"         => \$opt_quick,         # Don't look for indirects
181
                'mode:s'        => \$opt_mode,          # Mode of operation
182
                );
183
 
184
#
185
#   Process help and manual options
186
#
187
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
188
pod2usage(-verbose => 1)  if ($opt_help == 2 );
189
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
190
ErrorConfig( 'name'    =>'CC2SVN_GENDATA' );
191
 
192
if ( $opt_test )
193
{
194
    my @results = massageVersion( $opt_test, 'DummyName' );
195
    Message ("Version", $opt_test, @results);
196
    exit 1;
197
}
198
 
199
#
200
#   Set up the mode
201
#   Must be specified
202
#
203
if ( $opt_mode eq 'all' ) {
204
    $doAllReleases = 1;
205
    $doIncludeOnly = 0;
206
 
207
} elsif ( $opt_mode eq 'hops' ) {
208
    $doAllReleases = 0;
209
    $doIncludeOnly = 1;
210
 
211
} elsif ( $opt_mode eq 'standard' ) {
212
    $doAllReleases = 0;
213
    $doIncludeOnly = 0;
214
 
215
} else {
216
    Error ("Mode not specified: all, hops, standard");
217
}
218
 
219
#
220
#   Extract information from Deployment Manager
221
#
222
Message ("Get BOMs");
223
getBoms();
224
Message ("Get SBOM Info");
225
getOSIDforBOMID($_) foreach keys %AllBoms;
226
Message ("SBOMs : " . scalar keys %sboms);
227
Message ("get SBOM Details");
228
getSBOMDetails($_) foreach ( keys %sboms );
229
#
230
#   Locate packages associated with the base install for each os
231
#
232
Message ("get Base Install Packages");
233
foreach my $base_env_id ( sort keys %os_env_list )
234
{
235
    getPackagesforBaseInstall( $base_env_id );
236
}
237
 
238
#
239
#   Determine all the top level packages in the BOM
240
#
241
Message ("get Top Level BOM Packages");
242
foreach my $os_id ( sort keys %os_id_list )
243
{
244
    getPackages_by_osid( $os_id );
245
}
246
Message ("SBOM PackageVersions : " . scalar keys %sbom_pvid);
247
#DebugDumpData("PVID", \%sbom_pvid );
248
 
249
GetAllPackageNames();
250
getReleaseDetails();
251
getPkgDetailsByRTAG_ID();
252
my $count;
253
$count = keys %Packages;
254
print "Directly referenced Packages: $count\n";
255
LocateStrays() unless ($opt_quick);
256
$count = keys %Packages;
257
print "Indirectly referenced Packages: $count\n";
258
outputData();
259
 
260
if ( $opt_verbose > 1 )
261
{
262
    print "=========================================================================\n";
263
    DebugDumpData("Releases", \%Releases);
264
    print "=========================================================================\n";
265
    DebugDumpData("Packages", \%Packages );
266
    print "=========================================================================\n";
267
    DebugDumpData("Suffixes", \%Suffixes );
268
}
269
 
270
$count = keys %Packages;
271
print "Total References Packages: $count\n";
272
exit;
273
 
274
 
275
#-------------------------------------------------------------------------------
276
# Function        : getBoms
277
#
278
# Description     : Get all the BOM Id's and parent project IDs
279
#                   Also get base_env_id's where they exist
280
#
281
# Inputs          :
282
#
283
# Returns         :
284
#
285
sub getBoms
286
{
287
    my $foundDetails = 0;
288
    my (@row);
289
    Verbose ("getBoms");
290
    connectDM(\$DM_DB) unless ($DM_DB);
291
 
292
    my $m_sqlstr = "SELECT ".
293
                        "p.PROJ_ID,".
294
                        "p.PROJ_NAME,".
295
                        "br.BRANCH_ID,".
296
                        "bm.BOM_ID".
297
                   " FROM DEPLOYMENT_MANAGER.DM_PROJECTS p, " .
298
                         "DEPLOYMENT_MANAGER.BRANCHES br, ".
299
                         "DEPLOYMENT_MANAGER.BOMS bm ".
300
                   " WHERE p.PROJ_ID = br.PROJ_ID ".
301
                      "AND br.BRANCH_ID = bm.BRANCH_ID";
302
 
303
    my $sth = $DM_DB->prepare($m_sqlstr);
304
    if ( defined($sth) )
305
    {
306
        if ( $sth->execute( ) )
307
        {
308
            if ( $sth->rows )
309
            {
310
                while ( @row = $sth->fetchrow_array )
311
                {
312
#print "----@row\n";
313
                    my $project_id = $row[0];
314
                    my $name = $row[1];
315
                    my $bom_id = $row[3];
316
 
317
                    if ( exists $AllBoms{$bom_id} )
318
                    {
319
                        print "---- BAD: Multiple BOM IDS\n";
320
                    }
321
 
322
                    $AllBoms{$bom_id}{project_id} = $project_id;
323
                    $AllBoms{$bom_id}{project_name} = $name;
324
                    $foundDetails = 1;
325
                }
326
            }
327
            $sth->finish();
328
        }
329
        else
330
        {
331
            Error("getBoms:Execute failure: $m_sqlstr" );
332
        }
333
    }
334
    else
335
    {
336
        Error("getBoms:Prepare failure" );
337
    }
338
 
339
    Warnng("getBoms:No BOM Information Found" ) unless $foundDetails;
340
 
341
#    DebugDumpData("AllBoms", \%AllBoms );
342
}
343
#-------------------------------------------------------------------------------
344
# Function        : getOSIDforBOMID
345
#
346
# Description     : Get all the os_id's associated with a BOMID
347
#                   Also get base_env_id's where they exist
348
#
349
# Inputs          : $bom_id             - BOM to process
350
#
351
# Returns         :
352
#
353
sub getOSIDforBOMID
354
{
355
    my ($bom_id) = @_;
356
    my $foundDetails = 0;
357
    my (@row);
358
    Verbose ("getOSIDforBOMID");
359
    connectDM(\$DM_DB) unless ($DM_DB);
360
 
361
    my $project_id = $AllBoms{$bom_id}{project_id};
362
#print "getOSIDforBOMID: $bom_id, $project_id\n";
363
    if ( $doIncludeOnly )
364
    {
365
        unless ( grep {$_ eq $project_id} @includeBomProjects)
366
        {
367
            return;
368
        }
369
    }
370
    else
371
    {
372
        if ( grep {$_ eq $project_id} @excludeBomProjects)
373
        {
374
     #print "Ignoring $bom_id\n";
375
            return;
376
        }
377
    }
378
 
379
 
380
    my $m_sqlstr = "SELECT distinct bc.BOM_ID, os.OS_ID, os.OS_NAME, nn.NODE_NAME, obe.BASE_ENV_ID " .
381
                   " FROM DEPLOYMENT_MANAGER.OPERATING_SYSTEMS os, " .
382
                         "DEPLOYMENT_MANAGER.BOM_CONTENTS bc, ".
383
                         "DEPLOYMENT_MANAGER.NETWORK_NODES nn, ".
384
                         "DEPLOYMENT_MANAGER.OS_BASE_ENV obe" .
385
                   " WHERE bc.BOM_ID = $bom_id ".
386
                      "AND bc.NODE_ID = os.NODE_ID ".
387
                      "AND nn.NODE_ID = os.NODE_ID ".
388
                      "AND obe.OS_ID (+) = os.OS_ID ";
389
 
390
    my $sth = $DM_DB->prepare($m_sqlstr);
391
    if ( defined($sth) )
392
    {
393
        if ( $sth->execute( ) )
394
        {
395
            if ( $sth->rows )
396
            {
397
                while ( @row = $sth->fetchrow_array )
398
                {
399
#print "----@row\n";
400
                    Verbose ("OS_ID: ".join (',',@row) );
401
                    $sboms{$row[0]}{needed} = 1;
402
                    $os_id_list{$row[1]}{bom_id} = $row[0];
403
                    $os_id_list{$row[1]}{os_name} = $row[2];
404
                    $os_id_list{$row[1]}{node_name} = $row[3];
405
 
406
                    if ( defined $row[4] )
407
                    {
408
                        $os_env_list{$row[4]}{needed} = 1;
409
                        $os_env_list{$row[4]}{os_id}{$row[1]} = 1;
410
                    }
411
 
412
                    $foundDetails = 1;
413
                }
414
            }
415
            $sth->finish();
416
        }
417
        else
418
        {
419
            Error("getOSIDforBOMID:Execute failure" );
420
        }
421
    }
422
    else
423
    {
424
        Error("getOSIDforBOMID:Prepare failure" );
425
    }
426
 
427
    Warning("getOSIDforBOMID:No OS Information Found: Project:$project_id BOM:$bom_id" ) unless $foundDetails;
428
 
429
}
430
 
431
#-------------------------------------------------------------------------------
432
# Function        : getSBOMDetails
433
#
434
# Description     : Get some details about the SBOM
435
#                   Used for descriptive text
436
#
437
# Inputs          : $bom_id             - BOM to process
438
#
439
# Returns         : 
440
#
441
sub getSBOMDetails
442
{
443
    my ($bom_id) = @_;
444
    my $foundDetails = 0;
445
    my (@row);
446
 
447
    Verbose ("getSBOMDetails: $bom_id");
448
    connectDM(\$DM_DB) unless ($DM_DB);
449
 
450
    my $m_sqlstr = "SELECT distinct dp.PROJ_NAME ,bn.BOM_NAME, br.BRANCH_NAME, bm.BOM_VERSION, bm.BOM_LIFECYCLE" .
451
                   " FROM DEPLOYMENT_MANAGER.BOMS bm, DEPLOYMENT_MANAGER.BOM_NAMES bn, DEPLOYMENT_MANAGER.BRANCHES br, DEPLOYMENT_MANAGER.DM_PROJECTS dp" .
452
                   " WHERE bm.BOM_ID = $bom_id AND bm.BOM_NAME_ID = bn.BOM_NAME_ID AND bm.BRANCH_ID = br.BRANCH_ID AND br.PROJ_ID = dp.PROJ_ID";
453
 
454
    my $sth = $DM_DB->prepare($m_sqlstr);
455
    if ( defined($sth) )
456
    {
457
        if ( $sth->execute( ) )
458
        {
459
            if ( $sth->rows )
460
            {
461
                while ( @row = $sth->fetchrow_array )
462
                {
463
                    $sboms{$bom_id}{sbom_project}   = $row[0];
464
                    $sboms{$bom_id}{sbom_name}      = $row[1];
465
                    $sboms{$bom_id}{sbom_branch}    = $row[2];
466
                    $sboms{$bom_id}{sbom_version}   = $row[3] . '.' . $row[4];
467
                    $foundDetails = 1;
468
                }
469
            }
470
            $sth->finish();
471
        }
472
        else
473
        {
474
            Error("getSBOMDetails:Execute failure", $m_sqlstr );
475
        }
476
    }
477
    else
478
    {
479
        Error("getSBOMDetails:Prepare failure" );
480
    }
481
 
482
    Error("getSBOMDetails:No OS Information Found" ) unless $foundDetails;
483
 
484
}
485
 
486
#-------------------------------------------------------------------------------
487
# Function        : getPackagesforBaseInstall
488
#
489
# Description     : Get all the packages for a given base install
490
#
491
# Inputs          :
492
#
493
# Returns         :
494
#
495
 
496
sub getPackagesforBaseInstall
497
{
498
    my ($base_env_id) = @_;
499
    my $foundDetails = 0;
500
    my (@row);
501
 
502
    connectDM(\$DM_DB) unless ($DM_DB);
503
 
504
    # First get details from pv_id
505
 
506
    my $m_sqlstr = "SELECT DISTINCT bec.PROD_ID, pkg.pkg_name, pv.pkg_version, pkg.pkg_id, pv.pv_id" .
507
                " FROM RELEASE_MANAGER.PACKAGES pkg, RELEASE_MANAGER.PACKAGE_VERSIONS pv, DEPLOYMENT_MANAGER.PRODUCT_DETAILS pd, DEPLOYMENT_MANAGER.BASE_ENV_CONTENTS bec".
508
                " WHERE bec.BASE_ENV_ID = $base_env_id AND bec.PROD_ID (+)= pv.PV_ID AND pv.pkg_id = pkg.pkg_id";
509
 
510
    my $sth = $DM_DB->prepare($m_sqlstr);
511
    if ( defined($sth) )
512
    {
513
        if ( $sth->execute( ) )
514
        {
515
            if ( $sth->rows )
516
            {
517
                while ( @row = $sth->fetchrow_array )
518
                {
519
                    Verbose ("OS ENV Package($base_env_id}:" . join (',',@row) );
520
 
521
                    my $pv_id =     $row[0];
522
                    my $name =      $row[1]  || 'BadName';
523
                    my $ver =       $row[2]  || 'BadVer';
524
 
525
                    $sbom_pvid{$pv_id}{pkg_name} =$name;
526
                    $sbom_pvid{$pv_id}{pkg_ver} = $ver;
527
 
528
                    push @{$Packages{$pv_id}{sbomBase}}, $pv_id;
529
                    push @StrayPackages, $pv_id;
530
 
531
                    foreach my $os_id ( keys %{$os_env_list{$base_env_id}{os_id}} )
532
                    {
533
                        $sbom_pvid{$pv_id}{os_id}{$os_id} = 2;
534
                    }
535
                }
536
            }
537
            $sth->finish();
538
        }
539
        else
540
        {
541
            Error ("getPackagesforBaseInstall: Execute error");
542
        }
543
    }
544
    else
545
    {
546
        Error("getPackagesforBaseInstall:Prepare failure" );
547
    }
548
}
549
 
550
#-------------------------------------------------------------------------------
551
# Function        : getPackages_by_osid
552
#
553
# Description     : Get all the packages used by a given os_id
554
#
555
# Inputs          :
556
#
557
# Returns         :
558
#
559
 
560
sub getPackages_by_osid
561
{
562
    my ($os_id) =@_;
563
    my $foundDetails = 0;
564
    my (@row);
565
 
566
    connectDM(\$DM_DB) unless ($DM_DB);
567
 
568
    # First get details from pv_id
569
 
570
    my $m_sqlstr = "SELECT osc.*, pkg.pkg_name, pv.pkg_version, pd.IS_REJECTED, pv.IS_PATCH,pv.IS_OBSOLETE, pkg.pkg_id, pv.pv_id" .
571
                " FROM RELEASE_MANAGER.PACKAGES pkg, RELEASE_MANAGER.PACKAGE_VERSIONS pv, DEPLOYMENT_MANAGER.PRODUCT_DETAILS pd,".
572
	            "(" .
573
		        " SELECT osc.seq_num, osc.prod_id".
574
		        " FROM DEPLOYMENT_MANAGER.os_contents osc".
575
		        " WHERE osc.os_id = $os_id" .
576
	            " ) osc" .
577
                " WHERE pd.PROD_ID (+)= pv.PV_ID" .
578
                "   AND pv.pkg_id = pkg.pkg_id" .
579
                "   AND osc.PROD_ID = pv.pv_id" .
580
                " ORDER BY osc.SEQ_NUM desc" ;
581
 
582
    my $sth = $DM_DB->prepare($m_sqlstr);
583
    if ( defined($sth) )
584
    {
585
        if ( $sth->execute( ) )
586
        {
587
            if ( $sth->rows )
588
            {
589
                while ( @row = $sth->fetchrow_array )
590
                {
591
                    Verbose ("SBOM Package:".join (',',@row) );
592
                    my $pv_id =     $row[8];
593
                    unless ( exists $sbom_pvid{$pv_id} )
594
                    {
595
                        my $name =      $row[2]  || 'BadName';
596
                        my $ver =       $row[3]  || 'BadVer';
597
 
598
                        $sbom_pvid{$pv_id}{pkg_name} =$name;
599
                        $sbom_pvid{$pv_id}{pkg_ver} = $ver;
600
 
601
                        push @{$Packages{$pv_id}{sbomOsid}}, $pv_id;
602
                        $Packages{$pv_id}{sbomOsid} = 1;
603
                        push @StrayPackages, $pv_id;
604
 
605
 
606
                    }
607
                    $sbom_pvid{$pv_id}{os_id}{$os_id} = 1;
608
                }
609
            }
610
            $sth->finish();
611
        }
612
    }
613
    else
614
    {
615
        Error("getPackages_by_osid:Prepare failure" );
616
    }
617
}
618
 
619
#-------------------------------------------------------------------------------
620
# Function        : getReleaseDetails
621
#
622
# Description     : Determine all candiate releases
623
#
624
# Inputs          : 
625
#
626
# Returns         : 
627
#
628
sub getReleaseDetails
629
{
630
    my (@row);
631
 
632
    # if we are not or cannot connect then return 0 as we have not found anything
633
    connectRM(\$RM_DB) unless $RM_DB;
634
 
635
    # First get all packages that are referenced in a Release
636
    # This will only get the top level packages
637
    # From non-archived releases
638
 
639
    my $m_sqlstr = "SELECT prj.PROJ_NAME, rt.RTAG_NAME, rt.PROJ_ID, rt.RTAG_ID, rt.official" .
640
                   " FROM release_manager.release_tags rt, release_manager.projects prj" .
641
                   " WHERE prj.PROJ_ID = rt.PROJ_ID " .
642
                   "   AND rt.official != 'A' AND rt.official != 'Y'" .
643
                   " order by prj.PROJ_NAME";
644
    my $sth = $RM_DB->prepare($m_sqlstr);
645
    if ( defined($sth) )
646
    {
647
        if ( $sth->execute( ) )
648
        {
649
#            print "--- Execute\n";
650
            if ( $sth->rows )
651
            {
652
#                print "--- Execute ROWS\n";
653
                while ( @row = $sth->fetchrow_array )
654
                {
655
                    my $rtag_id =$row[3];
656
                    my $proj_id = $row[2];
657
 
658
                    $Releases{$rtag_id}{pName} = $row[0];
659
                    $Releases{$rtag_id}{name} = $row[1];
660
                    $Releases{$rtag_id}{proj_id} = $proj_id;
661
                    $Releases{$rtag_id}{rtag_id} = $rtag_id;
662
                    $Releases{$rtag_id}{official} = $row[4];
663
 
664
                    unless ( $doAllReleases )
665
                    {
666
                        if (grep {$_ eq $proj_id} @excludeProjects) {
667
                            $Releases{$rtag_id}{excluded} = 'E';
668
                        }
669
 
670
                        if (grep {$_ eq $rtag_id} @excludeReleases) {
671
                            $Releases{$rtag_id}{excluded} = 'E';
672
                        }
673
                    }
674
 
675
                    if ( $doIncludeOnly )
676
                    {
677
 
678
                        if (grep {$_ eq $proj_id} @includedProjects)
679
                        {
680
                            delete $Releases{$rtag_id}{excluded};
681
                        }
682
                        else
683
                        {
684
                            $Releases{$rtag_id}{excluded} = 'E';
685
                        }
686
 
687
                        if (grep {$_ eq $rtag_id} @includedReleases)
688
                        {
689
                            delete $Releases{$rtag_id}{excluded};
690
                        }
691
                    }
692
 
693
                    unshift @row, $Releases{$rtag_id}{excluded} || ' ';
694
                    print join (',',@row), "\n" if ($opt_verbose);
695
                }
696
            }
697
#            print "--- Finish\n";
698
            $sth->finish();
699
        }
700
        else
701
        {
702
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
703
        }
704
    }
705
    else
706
    {
707
        Error("Prepare failure" );
708
    }
709
}
710
 
711
 
712
sub getPkgDetailsByPVID
713
{
714
    my ($pv_id) = @_;
715
    my (@row);
716
 
717
    #
718
    #   Only do once
719
    #
720
    return if ( exists $Packages{$pv_id}{name} );
721
 
722
    # if we are not or cannot connect then return 0 as we have not found anything
723
    connectRM(\$RM_DB) unless $RM_DB;
724
 
725
    my $m_sqlstr = "SELECT" .
726
                        " pv.PV_ID, ".                                          #[0]
727
                        " pkg.PKG_NAME, ".                                      #[1]
728
                        " pv.PKG_VERSION, ".                                    #[2]
729
                        " pv.DLOCKED," .                                        #[3]
730
                        " release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), ". #[4]
731
                        " pv.PKG_ID," .                                         #[5]
732
                        " pv.MODIFIED_STAMP  ".                                 #[6]
733
                   " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
734
                   "      RELEASE_MANAGER.PACKAGES pkg ".
735
                   " WHERE pv.PV_ID = \'$pv_id\' ".
736
                   "   AND pv.PKG_ID = pkg.PKG_ID" ;
737
    my $sth = $RM_DB->prepare($m_sqlstr);
738
    if ( defined($sth) )
739
    {
740
        if ( $sth->execute( ) )
741
        {
742
#            print "--- Execute\n";
743
            if ( $sth->rows )
744
            {
745
#                print "--- Execute ROWS\n";
746
                while ( @row = $sth->fetchrow_array )
747
                {
748
                    print join (',',@row), "\n" if ($opt_verbose);
749
 
750
                    my $pvid = $row[0];
751
                    $Packages{$pvid}{name} = $row[1];
752
                    $Packages{$pvid}{version} = $row[2];
753
                    $Packages{$pvid}{locked} = $row[3];
754
                    $row[4] =~ tr~\\/~/~;
755
                    $Packages{$pvid}{vcstag} = $row[4];
756
                    $Packages{$pvid}{pkgid} = $row[5];
757
#                    $Packages{$pvid}{tlp} = 1;
758
                    ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
759
                    $Suffixes{$Packages{$pvid}{suffix}}++;
760
                    $Packages{$pvid}{Age} = ($now - str2time( $row[6] )) / (60 * 60 * 24);
761
                }
762
            }
763
#            print "--- Finish\n";
764
            $sth->finish();
765
        }
766
        else
767
        {
768
            Error("getPkgDetailsByPVID:Execute failure: $m_sqlstr", $sth->errstr() );
769
        }
770
    }
771
    else
772
    {
773
        Error("getPkgDetailsByPVID:Prepare failure" );
774
    }
775
}
776
 
777
 
778
sub getPkgDetailsByRTAG_ID
779
{
780
    my (@row);
781
    my $excludes = '';
782
    my $count = 0;
783
 
784
    # if we are not or cannot connect then return 0 as we have not found anything
785
    connectRM(\$RM_DB) unless $RM_DB;
786
 
787
    Message ("Extract toplevel dependencies");
788
 
789
    # First get all packages that are referenced in a Release
790
    # This will only get the top level packages
791
    # From non-archived releases
792
 
793
    unless ($doAllReleases)
794
    {
795
        foreach  ( @excludeProjects )
796
        {
797
            $excludes .= " AND prj.PROJ_ID != $_ ";
798
        }
799
        foreach  ( @excludeReleases )
800
        {
801
            $excludes .= " AND rt.RTAG_ID != $_ ";
802
        }
803
    }
804
 
805
    my $m_sqlstr = "SELECT DISTINCT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.DLOCKED" .
806
                   "    , release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), pv.PKG_ID" .
807
                   "    , rt.RTAG_ID, rmv.VIEW_NAME, pv.MODIFIED_STAMP, prj.PROJ_ID" .
808
                   " FROM RELEASE_MANAGER.RELEASE_CONTENT rc, RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
809
                   "      RELEASE_MANAGER.PACKAGES pkg, release_manager.release_tags rt, release_manager.projects prj" .
810
                   "    , release_manager.views rmv" .
811
                   " WHERE rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID" .
812
                   "   AND rmv.VIEW_ID = rc.BASE_VIEW_ID" .
813
                   "   AND prj.PROJ_ID = rt.PROJ_ID and rt.RTAG_ID = rc.RTAG_ID" .
814
                   "   AND rt.official != 'A' AND rt.official != 'Y'" .
815
                   $excludes .
816
                   " order by pkg.PKG_NAME";
817
    my $sth = $RM_DB->prepare($m_sqlstr);
818
    if ( defined($sth) )
819
    {
820
        if ( $sth->execute( ) )
821
        {
822
#            print "--- Execute\n";
823
            if ( $sth->rows )
824
            {
825
#                print "--- Execute ROWS\n";
826
                while ( @row = $sth->fetchrow_array )
827
                {
828
                    print join (',',@row), "\n" if ($opt_verbose);
829
                    my $pvid = $row[0];
830
                    unless ( exists $Packages{$pvid}{name} )
831
                    {
832
                        $Packages{$pvid}{name} = $row[1];
833
                        $Packages{$pvid}{version} = $row[2];
834
                        $Packages{$pvid}{locked} = $row[3];
835
                        $row[4] =~ tr~\\/~/~;
836
                        $Packages{$pvid}{vcstag} = $row[4];
837
                        $Packages{$pvid}{pkgid} = $row[5];
838
                        $Packages{$pvid}{tlp} = 1;
839
                        ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
840
                        $Suffixes{$Packages{$pvid}{suffix}}++;
841
 
842
                        push @StrayPackages, $pvid;
843
                    }
844
 
845
                    my $rtag_id = $row[6];
846
                    push @{$Packages{$pvid}{release}}, $rtag_id;
847
                    $Packages{$pvid}{view}{$row[7]}++ if ( $row[7] );
848
 
849
                    $Packages{$pvid}{Age} = ($now - str2time( $row[8] )) / (60 * 60 * 24);
850
 
851
                    my $proj_id = $row[9];
852
                    push @{$Packages{$pvid}{projects}}, $proj_id;
853
 
854
                    if ( $doIncludeOnly )
855
                    {
856
                        if (grep {$_ eq $proj_id} @includedProjects)
857
                        {
858
                            $Packages{$pvid}{NamedProject} = 1;
859
                        }
860
                        if (grep {$_ eq $rtag_id} @includedReleases)
861
                        {
862
                            $Packages{$pvid}{NamedProject} = 1;
863
                        }
864
                    }
865
                    else
866
                    {
867
                        $Packages{$pvid}{NamedProject} = 1;
868
                    }
869
 
870
 
871
                    if ( $opt_limit )
872
                    {
873
                        last if ( $count++ > $opt_limit );
874
                    }
875
                }
876
            }
877
#            print "--- Finish\n";
878
            $sth->finish();
879
        }
880
        else
881
        {
882
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
883
        }
884
    }
885
    else
886
    {
887
        Error("Prepare failure" );
888
    }
889
}
890
 
891
#-------------------------------------------------------------------------------
892
# Function        : GetDepends
893
#
894
# Description     :
895
#
896
# Inputs          : $pvid
897
#
898
# Returns         :
899
#
900
sub GetDepends
901
{
902
    my ($pv_id ) = @_;
903
 
904
    #
905
    #   Ensure we have package information
906
    #
907
    getPkgDetailsByPVID( $pv_id );
908
    return if ( $Packages{$pv_id}{depend} );
909
    $Packages{$pv_id}{depend} = 1;
910
 
911
    #
912
    #   Now extract the package dependacies
913
    #   There may not be any
914
    #
915
    my $m_sqlstr = "SELECT ".
916
                    " pd.PV_ID, ".
917
                    " pd.DPV_ID " .
918
                  " FROM    RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd ".
919
                  " WHERE pd.PV_ID = \'$pv_id\'";
920
    my $sth = $RM_DB->prepare($m_sqlstr);
921
    if ( defined($sth) )
922
    {
923
        if ( $sth->execute( ) )
924
        {
925
            if ( $sth->rows )
926
            {
927
                while ( my @row = $sth->fetchrow_array )
928
                {
929
                    my $pvid = $row[0];
930
                    my $dpvid = $row[1];
931
                    push @StrayPackages, $dpvid;
932
                    push @{$Packages{$dpvid}{usedBy}}, $pvid;
933
                }
934
            }
935
            $sth->finish();
936
        }
937
        else
938
        {
939
            Error("GetDepends:Execute failure: $m_sqlstr", $sth->errstr() );
940
        }
941
    }
942
    else
943
    {
944
        Error("GetDepends:Prepare failure" );
945
    }
946
}
947
 
948
#-------------------------------------------------------------------------------
949
# Function        : GetAllPackageNames
950
#
951
# Description     :
952
#
953
# Inputs          : None
954
#
955
# Returns         :
956
#
957
sub GetAllPackageNames
958
{
959
    # if we are not or cannot connect then return 0 as we have not found anything
960
    connectRM(\$RM_DB) unless $RM_DB;
961
 
962
    #
963
    #   Now extract all the package names
964
    #
965
    my $m_sqlstr = "SELECT pkg.PKG_ID, pkg.PKG_NAME" .
966
                  " FROM RELEASE_MANAGER.PACKAGES pkg";
967
    my $sth = $RM_DB->prepare($m_sqlstr);
968
    if ( defined($sth) )
969
    {
970
        if ( $sth->execute( ) )
971
        {
972
            if ( $sth->rows )
973
            {
974
                while ( my @row = $sth->fetchrow_array )
975
                {
976
                    my $id = $row[0];
977
                    my $name = $row[1];
978
                    next unless ( $id );
979
                    $AllPackages{$id} = $name;
980
                }
981
            }
982
            $sth->finish();
983
        }
984
        else
985
        {
986
        Error("GetAllPackageNames:Execute failure" );
987
        }
988
    }
989
    else
990
    {
991
        Error("GetAllPackageNames:Prepare failure" );
992
    }
993
}
994
 
995
#-------------------------------------------------------------------------------
996
# Function        : massageVersion
997
#
998
# Description     : Process a version number and return usful bits
999
#
1000
# Inputs          : Version Number
1001
#                   Package Name - debug only
1002
#
1003
# Returns         : An array
1004
#                       suffix
1005
#                       multipart version string useful for text comparisons
1006
#
1007
sub massageVersion
1008
{
1009
    my ($version, $name) = @_;
1010
    my ($major, $minor, $patch, $build, $suffix);
1011
    my $result;
1012
    my $buildVersion;
1013
    my $isaRipple;
1014
    my $isaWIP;
1015
    $build = 0;
1016
 
1017
#print "--- $name, $version\n";
1018
    $version =~ s~^_~~;
1019
    $version =~ s~^\Q${name}\E_~~;
1020
 
1021
    #
1022
    #   Pre-massage some silly ones
1023
    #
1024
    if ( exists $sillyVersions{$version} ) {
1025
        $version = $sillyVersions{$version};
1026
    }
1027
 
1028
    #
1029
    #   xxxxxxxxx.nnnn.cots
1030
    #
1031
    if ( $version =~ m~(.*)\.cots$~ ) {
1032
        my $cots_base = $1;
1033
        $suffix = '.cots';
1034
        if ( $version =~ m~(.*?)\.([0-9]{4})\.cots$~ )
1035
        {
1036
            $result = $1 . sprintf (".%4.4d", $2) . $suffix;
1037
        }
1038
        else
1039
        {
1040
            $result = $cots_base . '.0000.cots';
1041
        }
1042
    }
1043
    #
1044
    #   Convert version into full form for comparisions
1045
    #       nnn.nnn.nnn.[p]nnn.xxx
1046
    #       nnn.nnn.nnn.[p]nnn-xxx
1047
    #       nnn.nnn.nnn-[p]nnn.xxx
1048
    #       nnn.nnn.nnn-[p]nnn-xxx
1049
    #       nnn.nnn.nnn[p]nnn-xxx
1050
    #   Don't flag as ripples - they are patches
1051
    #
1052
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)[-.p][p]?(\d+)([-.](.*))?$~ ) {
1053
        $major = $1;
1054
        $minor = $2;
1055
        $patch = $3;
1056
        $build = $4;
1057
        $suffix = defined $6 ? ".$6" : '';
1058
        $isaRipple = 0;
1059
    }
1060
    #
1061
    #       nn.nnn.nnnnn.xxx
1062
    #       nn.nnn.nnnnn-xxx
1063
    #       nnn.nnn.nnnx.xxx
1064
    #   Don't flag as ripples - they are patches
1065
    #
1066
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)\w?([-.](.*))?$~ ) {
1067
        $major = $1;
1068
        $minor = $2;
1069
        $patch = $3;
1070
        if ( length( $patch) >= 4 )
1071
        {
1072
            $build = substr( $patch, -3 ,3);
1073
            $patch = substr( $patch,  0 ,length($patch)-3);
1074
        }
1075
        $suffix = defined $5 ? ".$5" : '';
1076
    }
1077
 
1078
    #
1079
    #       nnn.nnn.nnn
1080
    #       nnn.nnn-nnn
1081
    #       nnn.nnn_nnn
1082
    #
1083
    elsif ( $version =~ m~^(\d+)\.(\d+)[-._](\d+)$~ ) {
1084
        $major = $1;
1085
        $minor = $2;
1086
        $patch = $3;
1087
        $suffix = '';
1088
    }
1089
 
1090
    #
1091
    #       nnn.nnn.nnn.nnn
1092
    #       nnn.nnn.nnn-nnn
1093
    #       nnn.nnn.nnn_nnn
1094
    #
1095
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)[-._](\d+)$~ ) {
1096
        $major = $1;
1097
        $minor = $2;
1098
        $patch = $3;
1099
        $build = $4;
1100
        $suffix = '';
1101
        $isaRipple = 0;
1102
    }
1103
 
1104
 
1105
    #
1106
    #       nnn.nnn
1107
    #
1108
    elsif ( $version =~ m~^(\d+)\.(\d+)$~ ) {
1109
        $major = $1;
1110
        $minor = $2;
1111
        $patch = 0;
1112
        $suffix = '';
1113
    }
1114
    #
1115
    #       nnn.nnn.xxx
1116
    #
1117
    elsif ( $version =~ m~^(\d+)\.(\d+)(\.\w+)$~ ) {
1118
        $major = $1;
1119
        $minor = $2;
1120
        $patch = 0;
1121
        $suffix = $3;
1122
    }
1123
 
1124
    #
1125
    #       nnn.nnn.nnnz
1126
    #
1127
    elsif ( $version =~ m~^(\d+)\.(\d+)\.(\d+)([a-z])$~ ) {
1128
        $major = $1;
1129
        $minor = $2;
1130
        $patch = $3;
1131
        $build = ord($4) - ord('a');
1132
        $suffix = '.cots';
1133
        $isaRipple = 0;
1134
    }
1135
    #
1136
    #       ???REV=???
1137
    #
1138
    elsif ( $version =~ m~REV=~ ) {
1139
        $suffix = '.cots';
1140
        $result = $version . '.0000.cots';
1141
    }
1142
 
1143
    #
1144
    #   Wip Packages
1145
    #   (nnnnnn).xxx
1146
    #   Should be essential, but want to sort very low
1147
    #
1148
    elsif ($version =~ m~\((.*)\)(\..*)?~) {
1149
        $suffix = $2 || '';
1150
        $result = "000.000.000.000$suffix";
1151
        $isaWIP = 1;
1152
    }
1153
 
1154
    #
1155
    #   !current
1156
    #
1157
    elsif ($version eq '!current' || $version eq 'current_$USER' || $version eq 'current' || $version eq 'beta' || $version eq 'latest' || $version eq 'beta.cr' || $version eq 'CREATE') {
1158
        $suffix = '';
1159
        $result = "000.000.000.000$suffix";
1160
        $isaWIP = 1;
1161
    }
1162
 
1163
    #
1164
    #   Also WIP: FINRUN.103649.BEI.WIP
1165
    elsif ($version =~ m~(\.[a-zA-Z]+)\.WIP$~) {
1166
        $suffix = lc($1);
1167
        $result = "000.000.000.000$suffix";
1168
        $isaWIP = 1;
1169
    }
1170
 
1171
    #
1172
    #   Also ERGOFSSLS190100_015
1173
    #   Don't flag as a ripple
1174
    elsif ($version =~ m~^ERG[A-Z]+(\d\d)(\d\d)(\d\d)[-_](\d+)(\.\w+)?$~) {
1175
        $major = $1;
1176
        $minor = $2;
1177
        $patch = $3;
1178
        $build = $4;
1179
        $suffix = $5 || '.sls';
1180
        $isaRipple = 0;
1181
    }
1182
 
1183
    #
1184
    #   Stuff we don't yet handle
1185
    #
1186
    else  {
1187
        Warning ("Unknown version number: $name,$version");
1188
        $version =~ m~(\.\w+)$~;
1189
        $suffix = $1 || '';
1190
        $result = $version;
1191
    }
1192
 
1193
    $isaRipple = ($build > 0) unless defined $isaRipple;
1194
    unless ( $result )
1195
    {
1196
        # Major and minor of 99.99 are normally funny versions
1197
        # Don't make important decisions on them
1198
        #
1199
        if (defined $major && defined $minor && $major == 99 && $minor == 99 )
1200
        {
1201
            $major = 0;
1202
            $minor = 0;
1203
            $patch = 0;
1204
        }
1205
 
1206
        $result = sprintf("%3.3d.%3.3d.%3.3d.%3.3d%s", $major,$minor,$patch,$build,$suffix || '.0000');
1207
        $buildVersion = [ $major, $minor, $patch, $build ];
1208
    }
1209
 
1210
    $suffix = lc( $suffix );
1211
    if ( exists $suffixFixup{$suffix} )
1212
    {
1213
        $suffix = $suffixFixup{$suffix} ;
1214
    }
1215
 
1216
    return ($suffix, $result, $isaRipple, $isaWIP, $buildVersion );
1217
}
1218
 
1219
 
1220
#-------------------------------------------------------------------------------
1221
# Function        : LocateStrays
1222
#
1223
# Description     :
1224
#
1225
# Inputs          :
1226
#
1227
# Returns         :
1228
#
1229
sub LocateStrays
1230
{
1231
    Message ("Locate indirectly referenced packages");
1232
    while ( $#StrayPackages >= 0 )
1233
    {
1234
        my $pv_id = pop @StrayPackages;
1235
 
1236
        next if ( exists $Packages{$pv_id}{done} );
1237
#print "... ",$#StrayPackages,"\n";
1238
        GetDepends( $pv_id);
1239
        $Packages{$pv_id}{done} = 1;
1240
    }
1241
}
1242
 
1243
#-------------------------------------------------------------------------------
1244
# Function        : outputData
1245
#
1246
# Description     : Write out data in a form to allow post processing
1247
#
1248
# Inputs          : 
1249
#
1250
# Returns         : 
1251
#
1252
sub outputData
1253
{
1254
    my $file = "cc2svn.raw.txt";
1255
    Message ("Create: $file");
1256
    my $fh = ConfigurationFile::New( $file );
1257
 
1258
    $fh->DumpData(
1259
        "\n# Releases.\n#\n",
1260
        "ScmReleases", \%Releases );
1261
 
1262
    foreach ( keys %Packages )
1263
    {
1264
        delete $Packages{$_}{done};
1265
        next if ( $Packages{$_}{name} =~ ~m~CSWcfengine~ );
1266
 
1267
        if ($Packages{$_}{name} eq 'Activestate Perl - Solaris')
1268
        {
1269
            delete $Packages{$_};
1270
            next;
1271
        }
1272
 
1273
        if ( $Packages{$_}{name} =~ m/^CSW/ || $Packages{$_}{name} =~ m/^Solaris$/)
1274
        {
1275
            delete $Packages{$_};
1276
            next;
1277
        }
1278
 
1279
        if ( $Packages{$_}{name} =~ m/^jats_/)
1280
        {
1281
            delete $Packages{$_};
1282
            next;
1283
        }
1284
 
1285
    }
1286
 
1287
    $fh->DumpData(
1288
        "\n# Packages.\n#\n",
1289
        "ScmPackages", \%Packages );
1290
 
1291
    $fh->DumpData(
1292
        "\n# Suffixes.\n#\n",
1293
        "ScmSuffixes", \%Suffixes );
1294
 
1295
    $fh->DumpData(
1296
        "\n# All Package Names.\n#\n",
1297
        "ScmAllPackages", \%AllPackages );
1298
 
1299
#
1300
#   Just for debug
1301
#
1302
    $fh->DumpData("\n# All sboms.\n#\n", "ScmAllBoms", \%AllBoms );
1303
    $fh->DumpData("\n# All SBOMS.\n#\n", "ScmSboms", \%sboms );
1304
    $fh->DumpData("\n# All os_id_list.\n#\n", "ScmOsIdList", \%os_id_list );
1305
    $fh->DumpData("\n# All os_env_list.\n#\n", "ScmOsEnvList", \%os_env_list );
1306
    $fh->DumpData("\n# All sbom_pvid.\n#\n", "ScmSbomPVID", \%sbom_pvid );
1307
 
1308
    #
1309
    #   Close out the file
1310
    #
1311
    $fh->Close();
1312
 
1313
#    #
1314
#    #   Split up package data into small files for easy consumption
1315
#    #
1316
#
1317
#    foreach ( keys %Packages )
1318
#    {
1319
#        my $file = "cc2svn.raw.${_}.txt";
1320
#        Message ("Create: $file");
1321
#        my $fh = ConfigurationFile::New( $file );
1322
#
1323
#        $fh->DumpData(
1324
#            "\n# Releases.\n#\n",
1325
#            "ScmReleases", \$Packages{$_} );
1326
#        $fh->Close();
1327
#    }
1328
 
1329
}
1330
 
1331
 
1332
#-------------------------------------------------------------------------------
1333
#   Documentation
1334
#
1335
 
1336
=pod
1337
 
1338
=for htmltoc    SYSUTIL::cc2svn::
1339
 
1340
=head1 NAME
1341
 
1342
cc2svn_gendata - Extract CC2SVN Essential Package Data from Release Manager
1343
 
1344
=head1 SYNOPSIS
1345
 
1346
  jats cc2svn_gendata [options]
1347
 
1348
 Options:
1349
    -help              - brief help message
1350
    -help -help        - Detailed help message
1351
    -man               - Full documentation
1352
    -test=version      - Test a version string, then exit
1353
    -limit=n           - Limit packages processed. Test only
1354
 
1355
=head1 OPTIONS
1356
 
1357
=over 8
1358
 
1359
=item B<-help>
1360
 
1361
Print a brief help message and exits.
1362
 
1363
=item B<-help -help>
1364
 
1365
Print a detailed help message with an explanation for each option.
1366
 
1367
=item B<-man>
1368
 
1369
Prints the manual page and exits.
1370
 
1371
=item B<-test=version>
1372
 
1373
Examine a package version string and report how the tool will parse it.
1374
 
1375
=item B<-limit=n>
1376
 
1377
Limit the number of packages processed by the tool. This is only used to
1378
simplify testing of the program
1379
 
1380
=back
1381
 
1382
=head1 DESCRIPTION
1383
 
1384
This program is a tool used in the conversion of ClearCase VOBS to subversion.
1385
It will:
1386
 
1387
=over 8
1388
 
1389
=item *
1390
 
1391
Determine all Releases in Release manager and mark those that
1392
are to be excluded.
1393
 
1394
=item *
1395
 
1396
Determine all the package-versions used by the releases that are
1397
not excluded. These are called 'direct' dependencies.
1398
 
1399
=item *
1400
 
1401
Recursively find all the dependent packages of all packages. New package
1402
versions are called 'indirect' dependencies. They are buried. This process can
1403
take several minutes.
1404
 
1405
=back
1406
 
1407
The data collected is dumped into a text file for later processing.
1408
 
1409
=cut
1410