Subversion Repositories DevTools

Rev

Rev 2026 | Rev 2450 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2026 Rev 2429
Line 31... Line 31...
31
use JatsProperties;
31
use JatsProperties;
32
use JatsEnv;
32
use JatsEnv;
33
use ConfigurationFile;
33
use ConfigurationFile;
34
use JatsSvn qw(:All);
34
use JatsSvn qw(:All);
35
use JatsLocateFiles;
35
use JatsLocateFiles;
-
 
36
use Encode;
36
 
37
 
37
 
38
 
38
#use Data::Dumper;
39
#use Data::Dumper;
39
use Fcntl ':flock'; # import LOCK_* constants
40
use Fcntl ':flock'; # import LOCK_* constants
40
use Cwd;
41
use Cwd;
Line 66... Line 67...
66
my $opt_postimage = 1;
67
my $opt_postimage = 1;
67
my $opt_workDir = '/work';
68
my $opt_workDir = '/work';
68
my $opt_vobMap;
69
my $opt_vobMap;
69
my $opt_preserveProjectBase;
70
my $opt_preserveProjectBase;
70
my $opt_ignoreProjectBaseErrors;
71
my $opt_ignoreProjectBaseErrors;
-
 
72
my $opt_ignoreMakeProjectErrors;
71
my $opt_delete;
73
my $opt_delete;
72
my $opt_recentAge = 14;             # Days
74
my $opt_recentAge = 14;             # Days
-
 
75
my $opt_relabel = 0;
73
 
76
 
74
################################################################################
77
################################################################################
75
#   List of Projects Suffixes and Branch Names to be used within SVN
78
#   List of Projects Suffixes and Branch Names to be used within SVN
76
#
79
#
77
#       Name        - Name of branch for the project
80
#       Name        - Name of branch for the project
Line 102... Line 105...
102
    '.uk'       => { Name => 'UkProject' },
105
    '.uk'       => { Name => 'UkProject' },
103
    '.pmb'      => { Name => 'Pietermaritzburg' },
106
    '.pmb'      => { Name => 'Pietermaritzburg' },
104
    '.vps'      => { Name => 'VixPayments' },
107
    '.vps'      => { Name => 'VixPayments' },
105
    '.ncc'      => { Name => 'NSWClubCard' },
108
    '.ncc'      => { Name => 'NSWClubCard' },
106
    '.rm'       => { Name => 'Rome' },
109
    '.rm'       => { Name => 'Rome' },
-
 
110
    '.vss'      => { Name => 'SmartSite' },
107
    'unknown'   => { Name => 'UnknownProject' },
111
    'unknown'   => { Name => 'UnknownProject' },
108
 
112
 
109
    '.ebr'      => { Name => 'eBrio' , Trunk => 1 },
113
    '.ebr'      => { Name => 'eBrio' , Trunk => 1 },
110
    '.mas'      => { Name => 'Mass'  , Trunk => 1 },
114
    '.mas'      => { Name => 'Mass'  , Trunk => 1 },
111
    '.cr'       => { Name => 'Core'  , Trunk => 1 },
115
    '.cr'       => { Name => 'Core'  , Trunk => 1 },
Line 126... Line 130...
126
    '.pxxx.sydddd'  => '.syd',
130
    '.pxxx.sydddd'  => '.syd',
127
    '.oslo'         => '.oso',
131
    '.oslo'         => '.oso',
128
    '.osl'          => '.oso',
132
    '.osl'          => '.oso',
129
);
133
);
130
 
134
 
-
 
135
my @excludeFromImport = (
-
 
136
 
-
 
137
    # 22-Oct-12: Excluded on request from Kasun Sirikumara
-
 
138
    # Pending VSS work
-
 
139
    'agency_website',
-
 
140
    'alx',
-
 
141
    'alx-api',
-
 
142
    'cardholder_website',
-
 
143
    'loginmodule-ad',
-
 
144
    'ols-enquiry',
-
 
145
    'ols-enquiry-api',
-
 
146
    'olsrpc4j',
-
 
147
    'orca-middleware',
-
 
148
    'orca-middleware-api',
-
 
149
    'orca-salesEngine',
-
 
150
    'orca-web-api',
-
 
151
    'orca-web-utils',
-
 
152
    'TestPaymentGateway',
-
 
153
    'tgen4j',
-
 
154
    'web-cd-client',
-
 
155
 
-
 
156
 
-
 
157
    # 05-Nov-12: Pending fixup for include.txt files that escape the VOB
-
 
158
    #
-
 
159
#    'ddu_app_manager',
-
 
160
#    'ddu_dog',
-
 
161
#    'ddu_dog_lib',
-
 
162
#    'ddu_fim',
-
 
163
#    'ddu_logging_lib',
-
 
164
#    'ddu_management',
-
 
165
#    'ddu_mccain',
-
 
166
#    'ddu_mon',
-
 
167
#    'ddu_rcu',
-
 
168
#    'ddu_status_logging',
-
 
169
    
-
 
170
);
-
 
171
 
131
my %specialPackages = (
172
my %specialPackages = (
132
    'core_devl' =>  ',all,protected,',
173
    'core_devl'           =>  ',all,protected,',
-
 
174
    'daf_utils_mos'       => ',flat,',
133
#    'core_devl' =>  ',all,',
175
    'mos_packager'        => ',all,',
-
 
176
    'cfmgr-cfmgr'         => ',flat,',
134
    'daf_utils_mos' => ',flat,',
177
    'daf_utils_button_st' => ',flat,',
135
    'mos_packager'  => ',all,',
178
    'ReleaseName'         => ',flat,',
-
 
179
    'reports'             => ',utf8,',
-
 
180
    'cda_imports'         => ',utf8,',
-
 
181
    'cdxforms'            => ',utf8,',
-
 
182
    'db_cda'              => ',utf8,',
-
 
183
 
136
 
184
 
137
    # Need to be handled in a special manner
185
    # Need to be handled in a special manner
138
    # Not done by this utility
186
    # Not done by this utility
139
    #
187
    #
140
    'linux_drivers_eb5600'  => ',protected,',
188
    'linux_drivers_eb5600'  => ',protected,',
Line 142... Line 190...
142
    'linux_drivers_cobra'   => ',protected,',
190
    'linux_drivers_cobra'   => ',protected,',
143
    'linux_drivers_bcp4600' => ',protected,',
191
    'linux_drivers_bcp4600' => ',protected,',
144
    'linux_drivers_etx86'   => ',protected,',
192
    'linux_drivers_etx86'   => ',protected,',
145
    'linux_drivers_tp5600'  => ',protected,',
193
    'linux_drivers_tp5600'  => ',protected,',
146
 
194
 
-
 
195
# Not in the ukHops migration at the moment
-
 
196
    'cs'                        => ',protected,',
-
 
197
 
-
 
198
    'DBA-Common'                => ',protected,',
-
 
199
    'DBA-DatabaseInstall'       => ',protected,',
-
 
200
    'DBA-ExternalPerlModules'   => ',protected,',
-
 
201
    'DBA-OraUserBuild'          => ',protected,',
-
 
202
    'DBA-OST'                   => ',protected,',
-
 
203
    'orahops-install'           => ',protected,',
-
 
204
    'orahops-patch'             => ',protected,',
-
 
205
    'orahops-ssw-install'       => ',protected,',
-
 
206
    'orahops-ssw-patch'         => ',protected,',
-
 
207
# End of ukHops migration exclussion
-
 
208
 
147
    'ftp'                   => 'SetProjectBase,',
209
    'ftp'                   => 'SetProjectBase,',
-
 
210
    'ddu_app_manager'       => 'SetProjectBase,',
148
 
211
 
149
    'icl'                   => 'IgnoreProjectBase,',
212
    'icl'                   => 'IgnoreProjectBase,',
150
    'itso'                  => 'IgnoreProjectBase,',
213
    'itso'                  => 'IgnoreProjectBase,',
151
    'daf_osa_mos'           => 'IgnoreProjectBase,',
214
    'daf_osa_mos'           => 'IgnoreProjectBase,',
152
    'daf_utils_mos'         => 'IgnoreProjectBase,',
215
    'daf_utils_mos'         => 'IgnoreProjectBase,',
153
    'itso_ud'               => 'IgnoreProjectBase,',
216
    'itso_ud'               => 'IgnoreProjectBase,',
154
#    'mos_api'               => 'IgnoreProjectBase,',
217
#    'mos_api'               => 'IgnoreProjectBase,',
155
#    'mos_fonts'             => 'IgnoreProjectBase,',
218
#    'mos_fonts'             => 'IgnoreProjectBase,',
156
#    'sntp'                  => 'IgnoreProjectBase,',
219
#    'sntp'                  => 'IgnoreProjectBase,',
157
#    'time_it'               => 'IgnoreProjectBase,',
220
#    'time_it'               => 'IgnoreProjectBase,',
158
 
-
 
159
);
221
);
160
 
222
 
161
my %notCots = (
223
my %notCots = (
162
    'isl'       => 1,
224
    'isl'       => 1,
163
);
225
);
164
 
226
 
-
 
227
my $ukHopsMode = 0;
-
 
228
my %ukHopsReleases = (
-
 
229
    '6222'      => { name => 'MainLine', 'trunk' => 1 },
-
 
230
    '14503'     => { name => 'Hops3' },
-
 
231
    '21864'     => { name => 'Hops3.6' },
-
 
232
    '22303'     => { name => 'Hops3.7' },
-
 
233
    '17223'     => { name => 'Hops4' },
-
 
234
);
-
 
235
 
-
 
236
# The following packages will have the version in the specified release forced to be on the trunk
-
 
237
# A trunk will be forced and the version will be on it.
-
 
238
#   May only work if the version in the release is also a TIP
-
 
239
my %ukHopsTip = (
-
 
240
    'ItsoMessaging'         => '6222',
-
 
241
    'MessageProcessor'      => '6222',
-
 
242
    'StrongNameKey'         => '6222',
-
 
243
);
-
 
244
 
165
################################################################################
245
################################################################################
166
#   Global data
246
#   Global data
167
#
247
#
168
my $VERSION = "1.0.0";
248
my $VERSION = "1.0.0";
169
my $RM_DB;
249
my $RM_DB;
Line 203... Line 283...
203
my $allSvn;
283
my $allSvn;
204
my @multiplePaths;
284
my @multiplePaths;
205
my @badEssentials;
285
my @badEssentials;
206
my %svnData;
286
my %svnData;
207
my $cwd;
287
my $cwd;
-
 
288
my $mustConvertFileNames;
-
 
289
my $workDir;
208
 
290
 
209
my $packageNames;
291
my $packageNames;
210
my @packageNames;
292
my @packageNames;
211
my $multiPackages = -1;
293
my $multiPackages = -1;
212
my $visitId = 0;
294
my $visitId = 0;
Line 214... Line 296...
214
my $rippleCount = 0;
296
my $rippleCount = 0;
215
my $svnRepo;
297
my $svnRepo;
216
my $processCount = 0;
298
my $processCount = 0;
217
my $processTotal = 0;
299
my $processTotal = 0;
218
my $recentCount = 0;
300
my $recentCount = 0;
-
 
301
my $packageReLabelCount = 0;
-
 
302
my %saneLabels;
219
 
303
 
220
our $GBE_RM_URL;
304
our $GBE_RM_URL;
221
my $UNIX = $ENV{'GBE_UNIX'};
305
my $UNIX = $ENV{'GBE_UNIX'};
222
 
306
 
223
my $result = GetOptions (
307
my $result = GetOptions (
Line 239... Line 323...
239
                "tip:s"         => \@opt_tip,           # Force tip version(s)
323
                "tip:s"         => \@opt_tip,           # Force tip version(s)
240
                "log!"          => \$opt_log,
324
                "log!"          => \$opt_log,
241
                "delete!"       => \$opt_delete,
325
                "delete!"       => \$opt_delete,
242
                "postimage!"    => \$opt_postimage,
326
                "postimage!"    => \$opt_postimage,
243
                'workdir:s'     => \$opt_workDir,
327
                'workdir:s'     => \$opt_workDir,
-
 
328
                'relabel!'      => \$opt_relabel,
244
                );
329
                );
245
 
330
 
246
#
331
#
247
#   Process help and manual options
332
#   Process help and manual options
248
#
333
#
Line 405... Line 490...
405
    }
490
    }
406
 
491
 
407
    #
492
    #
408
    #   Perform all the work in a package specific subdirectory
493
    #   Perform all the work in a package specific subdirectory
409
    #
494
    #
410
    my $workDir = $opt_workDir . '/' . $packageNames;
495
    $workDir = $opt_workDir . '/' . $packageNames;
411
    mkdir $workDir unless ( -d $workDir );
496
    mkdir $workDir unless ( -d $workDir );
412
    chdir $workDir || Error ("Cannot cd to $workDir");
497
    chdir $workDir || Error ("Cannot cd to $workDir");
413
 
498
 
414
    #
499
    #
415
    #   Process all packages
500
    #   Process all packages
Line 533... Line 618...
533
        $opt_flat = 1 unless defined $opt_flat;
618
        $opt_flat = 1 unless defined $opt_flat;
534
        setPruneMode('none') unless (defined $opt_pruneModeString);
619
        setPruneMode('none') unless (defined $opt_pruneModeString);
535
 
620
 
536
    } elsif ( exists $suffixes{'.tool'} ) {
621
    } elsif ( exists $suffixes{'.tool'} ) {
537
        $packageType = 'TOOL';
622
        $packageType = 'TOOL';
538
        $Projects{'.tool'}{'Trunk'} = 1;
623
        $Projects{'.tool'}{Trunk} = 1;
539
        $singleProject = 1;
624
        $singleProject = 1;
540
        setPruneMode('none') unless (defined $opt_pruneModeString);
625
        setPruneMode('none') unless (defined $opt_pruneModeString);
541
#        $opt_flat = 1;
626
#        $opt_flat = 1;
542
 
627
 
543
    } elsif ( scalar (keys %suffixes ) == 1 ) {
628
    } elsif ( scalar (keys %suffixes ) == 1 ) {
Line 549... Line 634...
549
    }
634
    }
550
 
635
 
551
    #
636
    #
552
    #   Some packages are special
637
    #   Some packages are special
553
    #
638
    #
-
 
639
    if ( $svnRepo =~ m~/Manufacturing(/|$)~ )
-
 
640
    {
-
 
641
        Message ("Set Manufacturing Repo style");
-
 
642
        $opt_flat = 1;
-
 
643
        setPruneMode('none') unless (defined $opt_pruneModeString);
-
 
644
    }
-
 
645
 
554
 
646
 
555
    if ( $packageNames[0] =~ m'^br_applet_' )
647
    if ( $packageNames[0] =~ m'^br_applet_' )
556
    {
648
    {
557
        $opt_flat = 1 unless defined $opt_flat;
649
      $opt_flat = 1 unless defined $opt_flat;
-
 
650
    }
-
 
651
 
-
 
652
    foreach  ( @excludeFromImport )
-
 
653
    {
-
 
654
         $specialPackages{$_} .= 'protected,';
558
    }
655
    }
559
 
656
 
560
    if ( exists $specialPackages{$packageNames[0]} )
657
    if ( exists $specialPackages{$packageNames[0]} )
561
    {
658
    {
562
        my $data = $specialPackages{$packageNames[0]};
659
        my $data = $specialPackages{$packageNames[0]};
Line 581... Line 678...
581
        if ( index( $data, 'IgnoreProjectBase,' ) >= 0) {
678
        if ( index( $data, 'IgnoreProjectBase,' ) >= 0) {
582
            $opt_ignoreProjectBaseErrors = 1;
679
            $opt_ignoreProjectBaseErrors = 1;
583
            Message ("Ignore ProjectBase Errors");
680
            Message ("Ignore ProjectBase Errors");
584
        }
681
        }
585
 
682
 
-
 
683
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
-
 
684
            $opt_ignoreMakeProjectErrors = 1;
-
 
685
            Message ("Ignore MakeProject Usage");
-
 
686
        }
-
 
687
        
-
 
688
 
-
 
689
        if ( index( $data, 'utf8,' ) >= 0) {
-
 
690
            $mustConvertFileNames = 1;
-
 
691
            Message ("Convert filenames to UTF8");
-
 
692
        }
586
    }
693
    }
587
 
694
 
588
    Message("Package Type: $packageType, $pruneModeString");
695
    Message("Package Type: $packageType, $pruneModeString");
589
}
696
}
590
 
697
 
Line 827... Line 934...
827
                    $versions{$entry}{newSuffix} = 1;
934
                    $versions{$entry}{newSuffix} = 1;
828
                }
935
                }
829
            }
936
            }
830
        }
937
        }
831
    }
938
    }
-
 
939
 
-
 
940
    #
-
 
941
    #   Mark UkHops special points
-
 
942
    #
-
 
943
    foreach my $entry ( keys(%versions) ) {
-
 
944
        foreach my $rtag_id ( keys %{$versions{$entry}{Releases}}  ) {
-
 
945
            next unless ( exists $ukHopsReleases{$rtag_id} );
-
 
946
            next unless ( $svnRepo =~ m~/ITSO_TRACS$~ );
-
 
947
 
-
 
948
            #
-
 
949
            #   This package is current in a special ukHops release
-
 
950
            #   Need to handle the differently
-
 
951
            #
-
 
952
            my $ukData =  $ukHopsReleases{$rtag_id};
-
 
953
 
-
 
954
            # Mark version we want on the trunk
-
 
955
            # Will calculate tip later
-
 
956
            if ( $ukData->{trunk} )
-
 
957
            {
-
 
958
                #
-
 
959
                #   Can only place on trunk IFF its a tip
-
 
960
                #   May have a WIP.
-
 
961
                #   Solution. Walk to the tip, but only if there is one
-
 
962
                #             path.
-
 
963
                #
-
 
964
                my $end = $entry;
-
 
965
                my $last;
-
 
966
                while ( $end )
-
 
967
                {
-
 
968
                    $last = $end;
-
 
969
                    if ( @{$versions{$end}{next}} > 1)
-
 
970
                    {
-
 
971
                        Warning ("Uk Release. Preferred trunk is not a tip: $versions{$entry}{vname}");
-
 
972
                        last;
-
 
973
                    }
-
 
974
 
-
 
975
                    $end = @{$versions{$end}{next}}[0];
-
 
976
                }
-
 
977
                $versions{$last}{ukTrunk} = 1 ;
-
 
978
            }
-
 
979
 
-
 
980
            #
-
 
981
            #   What to do if the version is in more than one release
-
 
982
            #
-
 
983
            $versions{$entry}{ukBranch}++;
-
 
984
            if ( $versions{$entry}{ukBranch} > 1 )
-
 
985
            {
-
 
986
                Warning ("Version found in multiple Uk Releases - don't know what to do");
-
 
987
            }
-
 
988
 
-
 
989
            #
-
 
990
            #   What to do if the package has multiple version in a release
-
 
991
            #
-
 
992
            $ukData->{count}++;
-
 
993
            if ( $ukData->{count} > 1 )
-
 
994
            {
-
 
995
                Warning ("Package has multiple versions in the one Uk Release: $versions{$entry}{Releases}{$rtag_id}{rname}");
-
 
996
            }
-
 
997
        }
-
 
998
    }
832
    
999
    
833
    #
1000
    #
834
    #   Prune
1001
    #   Prune
835
    #   Marks paths to root for all essential packages
1002
    #   Marks paths to root for all essential packages
836
    #   Marks the last-N from all essential packages
1003
    #   Marks the last-N from all essential packages
Line 846... Line 1013...
846
            my $entry = $_;
1013
            my $entry = $_;
847
            my $count = 0;
1014
            my $count = 0;
848
            while ( $entry )
1015
            while ( $entry )
849
            {
1016
            {
850
                last if ( $versions{$entry}{KeepMe} );
1017
                last if ( $versions{$entry}{KeepMe} );
851
                unless ( $versions{$entry}{isaRipple} )
1018
#                unless ( $versions{$entry}{isaRipple} )
852
                {
1019
                {
853
                    my $keepFlag = ($count++ < $opt_retaincount);
1020
                    my $keepFlag = ($count++ < $opt_retaincount);
854
                    last unless ( $keepFlag );
1021
                    last unless ( $keepFlag );
855
                    $versions{$entry}{KeepMe} = $keepFlag;
1022
                    $versions{$entry}{KeepMe} = $keepFlag;
856
                }
1023
                }
Line 942... Line 1109...
942
        {
1109
        {
943
            my ($entry) = @_;
1110
            my ($entry) = @_;
944
 
1111
 
945
            return 0 unless ( exists $versions{$entry} );
1112
            return 0 unless ( exists $versions{$entry} );
946
            return 0 unless ( $versions{$entry}{last} );
1113
            return 0 unless ( $versions{$entry}{last} );
947
            return 0 if ( ($pruneMode == 2) && exists $versions{$entry}{KeepMe} );
1114
#            return 0 if ( ($pruneMode == 2) && exists $versions{$entry}{KeepMe} );
-
 
1115
            return 0 if ( exists $versions{$entry}{KeepMe} );
948
            return 0 if ( exists $versions{$entry}{Essential} );
1116
            return 0 if ( exists $versions{$entry}{Essential} );
949
            return 0 if ( $versions{$entry}{newSuffix} );
1117
            return 0 if ( $versions{$entry}{newSuffix} );
950
            return 0 if ( $versions{$entry}{newSuffix} && (exists $versions{$entry}{EssentialPath}) );
1118
            return 0 if ( $versions{$entry}{newSuffix} && (exists $versions{$entry}{EssentialPath}) );
951
#            return 1 if ( exists $versions{$entry}{DeadWood} );
1119
#            return 1 if ( exists $versions{$entry}{DeadWood} );
952
            return 0 if ( exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
1120
            return 0 if ( exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
Line 992... Line 1160...
992
        #
1160
        #
993
        calcRippleGroups();
1161
        calcRippleGroups();
994
    }
1162
    }
995
 
1163
 
996
    #
1164
    #
-
 
1165
    #   Want some versions to be forced to tip trunk
-
 
1166
    #
-
 
1167
    foreach my $name ( keys %ukHopsTip )
-
 
1168
    {
-
 
1169
        foreach my $entry ( keys(%versions) )
-
 
1170
        {
-
 
1171
            next unless ( $versions{$entry}{name} eq $name  );
-
 
1172
            next unless ( exists $versions{$entry}{Releases}{$ukHopsTip{$name}} );
-
 
1173
 
-
 
1174
            #
-
 
1175
            #   Force this suffix to be the trunk
-
 
1176
            #   Remove all others
-
 
1177
            #
-
 
1178
            foreach my $suffix ( keys %Projects )
-
 
1179
            {
-
 
1180
                delete $Projects{$suffix}{Trunk};
-
 
1181
            }
-
 
1182
            my $suffix = $versions{$entry}{suffix};
-
 
1183
            $Projects{$suffix}{Trunk} = 1;
-
 
1184
        }
-
 
1185
    }
-
 
1186
 
-
 
1187
    #
997
    #   Calculate best through-path for branches in the tree
1188
    #   Calculate best through-path for branches in the tree
998
    #   Attempt to keep that 'max' version on the mainline
1189
    #   Attempt to keep that 'max' version on the mainline
999
    #   May be modified by -tip=nnnn
1190
    #   May be modified by -tip=nnnn
1000
    #
1191
    #
1001
    #   For each leaf (end point), walk backwards and mark each node with the
1192
    #   For each leaf (end point), walk backwards and mark each node with the
Line 1007... Line 1198...
1007
    #   be recalculated
1198
    #   be recalculated
1008
    #
1199
    #
1009
 
1200
 
1010
    Message ("Calculate Max Version");
1201
    Message ("Calculate Max Version");
1011
    my $maxVersion;
1202
    my $maxVersion;
1012
 
-
 
1013
    foreach my $entry ( @endPoints )
1203
    foreach my $entry ( @endPoints )
1014
    {
1204
    {
1015
        my $lastSuffix;
1205
        my $lastSuffix;
1016
        my $forceTip;
1206
        my $forceTip;
1017
        while ( $entry )
1207
        while ( $entry )
Line 1019... Line 1209...
1019
            if (!defined($lastSuffix) || ($versions{$entry}{suffix} ne $lastSuffix) )
1209
            if (!defined($lastSuffix) || ($versions{$entry}{suffix} ne $lastSuffix) )
1020
            {
1210
            {
1021
                $maxVersion = '0';
1211
                $maxVersion = '0';
1022
                $visitId++;
1212
                $visitId++;
1023
                $forceTip = ( exists $tipVersions{$versions{$entry}{vname}} );
1213
                $forceTip = ( exists $tipVersions{$versions{$entry}{vname}} );
-
 
1214
                $forceTip = 1 if $versions{$entry}{ukTrunk};
1024
                delete $tipVersions{$versions{$entry}{vname}};
1215
                delete $tipVersions{$versions{$entry}{vname}};
1025
                $maxVersion = '999.999.999.999.zzz' if ( $forceTip );
1216
                $maxVersion = '999.999.999.999.zzz' if ( $forceTip );
1026
                $lastSuffix = $versions{$entry}{suffix};
1217
                $lastSuffix = $versions{$entry}{suffix};
1027
#print "---Tip Found\n" if $forceTip;
1218
#print "---Tip Found\n" if $forceTip;
1028
            }
1219
            }
Line 1447... Line 1638...
1447
    #   Delete the created view
1638
    #   Delete the created view
1448
    #   Its just a directory, so delete it
1639
    #   Its just a directory, so delete it
1449
    #
1640
    #
1450
    if ( $data{ViewRoot} && -d $data{ViewRoot})
1641
    if ( $data{ViewRoot} && -d $data{ViewRoot})
1451
    {
1642
    {
1452
        if ( !$opt_reuse || $rv )
1643
        if ( !$opt_reuse || ($rv && ($rv != 4 && $rv != 12 )) )
1453
        {
1644
        {
1454
            Message ("Delete View: $data{ViewRoot}");
1645
            Message ("Delete View: $data{ViewRoot}");
1455
            RmDirTree ($data{ViewRoot} );
1646
            RmDirTree ($data{ViewRoot} );
1456
        }
1647
        }
1457
        else
1648
        else
Line 1469... Line 1660...
1469
    #
1660
    #
1470
    #   If this version has any 'ripples' then process them while we have the
1661
    #   If this version has any 'ripples' then process them while we have the
1471
    #   main view. Note the ripple list may contain entries that do not
1662
    #   main view. Note the ripple list may contain entries that do not
1472
    #   exist - they will have been pruned.
1663
    #   exist - they will have been pruned.
1473
    #
1664
    #
-
 
1665
if(1) {
1474
    foreach my $rentry ( @{$versions{$entry}{rippleList}} )
1666
    foreach my $rentry ( @{$versions{$entry}{rippleList}} )
1475
    {
1667
    {
1476
        next unless( exists $versions{$rentry} );
1668
        next unless( exists $versions{$rentry} );
1477
 
1669
 
1478
        if ($versions{$rentry}{Processed})
1670
        if ($versions{$rentry}{Processed})
Line 1483... Line 1675...
1483
 
1675
 
1484
        Message ("Proccessing associated Ripple: " . GetVname($rentry));
1676
        Message ("Proccessing associated Ripple: " . GetVname($rentry));
1485
        newPackageVersion($rentry);
1677
        newPackageVersion($rentry);
1486
    }
1678
    }
1487
}
1679
}
-
 
1680
}
1488
 
1681
 
1489
#-------------------------------------------------------------------------------
1682
#-------------------------------------------------------------------------------
1490
# Function        : newPackageVersionBody
1683
# Function        : newPackageVersionBody
1491
#
1684
#
1492
# Description     : Perform the bulk of the work in creating a new PackageVersion
1685
# Description     : Perform the bulk of the work in creating a new PackageVersion
Line 1505... Line 1698...
1505
{
1698
{
1506
    my ($data, $entry) = @_;
1699
    my ($data, $entry) = @_;
1507
    my $rv;
1700
    my $rv;
1508
    my $cc_label;
1701
    my $cc_label;
1509
    my $cc_path;
1702
    my $cc_path;
-
 
1703
    my $cc_path_original;
1510
 
1704
 
1511
    #
1705
    #
1512
    #   Init Data
1706
    #   Init Data
1513
    #
1707
    #
1514
    $data->{rmRef} = 'ERROR';
1708
    $data->{rmRef} = 'ERROR';
Line 1547... Line 1741...
1547
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
1741
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
1548
    $cc_label = $4;
1742
    $cc_label = $4;
1549
    $cc_path = $2;
1743
    $cc_path = $2;
1550
    $cc_path = '/' . $cc_path;
1744
    $cc_path = '/' . $cc_path;
1551
    $cc_path =~ tr~\\/~/~s;
1745
    $cc_path =~ tr~\\/~/~s;
-
 
1746
    $cc_path_original = $cc_path;
1552
 
1747
 
1553
    #
1748
    #
1554
    #   Correct well known path mistakes
1749
    #   Correct well known path mistakes
1555
    #
1750
    #
-
 
1751
    $cc_path =~ s~/build.pl$~~i;
-
 
1752
    $cc_path =~ s~/src$~~i;
-
 
1753
    $cc_path =~ s~/cpp$~~i;
-
 
1754
    $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1755
    $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
1556
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
1756
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
1557
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
1757
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
1558
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
1758
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
1559
    $cc_path =~ s~/MREF_21/MREF_Package/~/MREF_Package/~i;
1759
    $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1760
    $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1761
    $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1762
    $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1763
    $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1764
    $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1765
 
-
 
1766
    $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1767
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1768
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1769
    $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1770
    $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1771
 
-
 
1772
    if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1773
        || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1774
        || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1775
        || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1776
        || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1777
        || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1778
        || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1779
        || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1780
        || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1781
        || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1782
        || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1783
        || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1784
        || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1785
        || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1786
        || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1787
        || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1788
        || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1789
        || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1790
        || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1791
        || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1792
        || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1793
        || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1794
        || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1795
        || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1796
        || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1797
        || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1798
        || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1799
        || $versions{$entry}{name} =~ m/^ERGfinman$/i
-
 
1800
        || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1801
        || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1802
        || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1803
        || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1804
        )
-
 
1805
    {
-
 
1806
        $cc_path = '/MREF_Package';
-
 
1807
    }
1560
 
1808
 
-
 
1809
    if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1810
    {
-
 
1811
        if ( $versions{$entry}{version} =~ m~vtk$~ )
-
 
1812
        {
-
 
1813
            $cc_path = '/MREF_Package';
-
 
1814
        }
-
 
1815
    }
1561
 
1816
 
-
 
1817
    if ( $cc_path_original ne $cc_path )
-
 
1818
    {
-
 
1819
            Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
-
 
1820
    }
-
 
1821
    
1562
#print "--- Path: $cc_path, Label: $cc_label\n";
1822
#print "--- Path: $cc_path, Label: $cc_label\n";
1563
 
1823
 
1564
    #
1824
    #
1565
    #   Create CC view
1825
    #   Create CC view
1566
    #   Import into Subversion View
1826
    #   Import into Subversion View
1567
    #
1827
    #
1568
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
1828
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1569
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
1829
    return $rv if ( $rv );
1570
 
1830
 
1571
    if ( $opt_preserveProjectBase )
-
 
1572
    {
1831
    #
1573
        my $cc_vob = $cc_path;
1832
    #   Developers have been slack
1574
        $cc_vob =~ s~^/~~;
-
 
1575
        $cc_vob =~ s~/.*~~;
-
 
1576
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
1833
    #       Sometime the mark the source path as 'GMTPE2005'
1577
        Message ("Preserving Project Base");
1834
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1578
    }
1835
    #
1579
    $data->{ViewPath} =~  tr~/~/~s;
1836
    #   Attempt to suck up empty directories below the specified
1580
 
-
 
1581
    if ( $opt_reuse && -d $data->{ViewPath}  )
1837
    #   source path
1582
    {
1838
    #
1583
        Message ("Reusing view: $cc_label");
1839
    unless ( $opt_preserveProjectBase )
1584
    }
-
 
1585
    else
-
 
1586
    {
1840
    {
1587
        my @args;
1841
        #
1588
        push (@args, '-view', $opt_name ) if ( defined $opt_name );
-
 
1589
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
-
 
1590
                    "-label=$cc_label" ,
1842
        #   Look in ViewPath
1591
                    "-path=$cc_path",
1843
        #   If it contains only ONE directory then we can suck it up
1592
                    @args
1844
        #
1593
                    );
1845
        my $testDir = findDirWithStuff( $data->{ViewPath} );
1594
 
1846
 
1595
        unless ( -d $data->{ViewPath}  )
1847
        unless ( $data->{ViewPath} eq $testDir  )
1596
        {
1848
        {
-
 
1849
            Message ("Adjust Base Dir: $testDir");
1597
            $data->{errStr} = 'Failed to extract files from CC';
1850
            $data->{adjustedPath} = $data->{ViewPath};
1598
            return 2;
1851
            $data->{ViewPath} = $testDir;
1599
        }
1852
        }
1600
    }
1853
    }
1601
 
-
 
1602
 
1854
    
1603
    #
1855
    #
1604
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1856
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1605
    #   Detect such packages as we will need to handle them differently
1857
    #   Detect such packages as we will need to handle them differently
1606
    #   Can't really handle it on the fly
1858
    #   Can't really handle it on the fly
1607
    #   All we can do is detct it and report it - at the moment
1859
    #   All we can do is detect it and report it - at the moment
1608
    #
1860
    #
1609
    if (detectProjectBaseUsage($data, $cc_path) )
1861
    if (detectProjectBaseUsage($data, $cc_path) )
1610
    {
1862
    {
1611
        unless ( $opt_ignoreProjectBaseErrors )
1863
        unless ( $opt_ignoreProjectBaseErrors )
1612
        {
1864
        {
1613
            $data->{BadProjectBase}++;
1865
            $data->{BadProjectBase}++;
1614
            $data->{errStr} = 'Bad usage of ProjectBase detected';
1866
            $data->{errStr} = 'Bad usage of ProjectBase detected';
-
 
1867
            return 4;           # Lets see what the others look like too
1615
            return 14;
1868
#            return 14;
1616
        }
1869
        }
1617
    }
1870
    }
1618
 
1871
 
1619
 
-
 
1620
    #
1872
    #
-
 
1873
    #   Some really really ugly packgaes make use of the MakeProject directive
-
 
1874
    #   and then use an 'include.txt file to access paths all over the VOB
1621
    #   Developers have been slack
1875
    #   The problem is with lines like
-
 
1876
    #           /I ..\..\..\..\..\..\DPG_SWCode\projects\seattle\ddu\component\DTIApp\dsi\inc
-
 
1877
    #   Two problems:
1622
    #       Sometime the mark the source path as 'GMTPE2005'
1878
    #       Vob Name is not a part of the migration
1623
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1879
    #       If we 'SuckUp' empty directories then this may break
-
 
1880
    #       the pathing.
-
 
1881
    #   All we can do is detect it and report it - at the moment
1624
    #
1882
    #
-
 
1883
    if (detectMakeProjectUsage($data, $cc_path) )
-
 
1884
    {
-
 
1885
        unless ( $opt_ignoreMakeProjectErrors )
-
 
1886
        {
-
 
1887
            $data->{BadMakeProject}++;
-
 
1888
            $data->{errStr} = 'Use of MakeProject detected';
1625
    #   Attempt to suck up empty directories below the specified
1889
            return 4;           # Lets see what the others look like too
1626
    #   source path
1890
#            return 14;
-
 
1891
        }
-
 
1892
    }
-
 
1893
 
1627
    #
1894
    #
-
 
1895
    #   Some packages have filenames that are need to be converted
-
 
1896
    #
1628
    unless ( $opt_preserveProjectBase )
1897
    if ( $mustConvertFileNames  )
1629
    {
1898
    {
-
 
1899
        $rv = system ( '/home/dpurdie/svn/tools/convmv-1.15/convmv',
-
 
1900
                 '-fiso-8859-1',
-
 
1901
                 '-tutf8',
-
 
1902
                 '-r',
-
 
1903
                 '--notest',
-
 
1904
                 $data->{ViewPath} );
-
 
1905
 
-
 
1906
        if ( $rv )
-
 
1907
        {
-
 
1908
            $data->{errStr} = 'Failed to convert filenames to UTF8';
-
 
1909
            return 14;
-
 
1910
        }
-
 
1911
 
1630
        #
1912
        #
1631
        #   Look in ViewPath
1913
        #   Check to see if our ViewPath has been changed
1632
        #   If it contains only ONE directory then we can suck it up
1914
        #   If so, then try to fix it
1633
        #
1915
        #
1634
        my $testDir = findDirWithStuff( $data->{ViewPath} );
-
 
1635
 
-
 
1636
        unless ( $data->{ViewPath} eq $testDir  )
1916
        unless ( -d $data->{ViewPath} )
1637
        {
1917
        {
1638
            Message ("Adjust Base Dir: $testDir");
1918
            Message ("Correct UTF-8 change to ViewPath");
1639
            $data->{adjustedPath} = $data->{ViewPath};
1919
            $data->{ViewPath} = encode('UTF-8', $data->{ViewPath}, Encode::FB_DEFAULT);
1640
            $data->{ViewPath} = $testDir;
1920
            Warning ("Correct UTF-8 change to ViewPath - FAILED") unless ( -d $data->{ViewPath} );
1641
        }
1921
        }
1642
    }
1922
    }
1643
    
1923
    
1644
 
-
 
1645
    #
1924
    #
1646
    #   Have a CC view
1925
    #   Have a CC view
1647
    #   Now we can create the SVN package and branching point before we
1926
    #   Now we can create the SVN package and branching point before we
1648
    #   import the CC data into SVN
1927
    #   import the CC data into SVN
1649
    #
1928
    #
Line 1738... Line 2017...
1738
    {
2017
    {
1739
        $data->{errStr} = 'Failed to determine Rm Reference';
2018
        $data->{errStr} = 'Failed to determine Rm Reference';
1740
        return 13;
2019
        return 13;
1741
    }
2020
    }
1742
 
2021
 
-
 
2022
######################## Deleted ###############################################
-
 
2023
#
1743
 
2024
#
1744
    #
2025
#    #
1745
    #   Add supplemental tags if this version is in a 'Release'
2026
#    #   Add supplemental tags if this version is in a 'Release'
1746
    #   But only for some packages - els looks like a mess
2027
#    #   But only for some packages - else looks like a mess
1747
    #   Just a solution for the ITSO guys
2028
#    #   Just a solution for the ITSO guys
1748
    #
2029
#    #
1749
    foreach my $rtag_id ( keys %{$versions{$entry}{Releases}}  )
2030
#    foreach my $rtag_id ( keys %{$versions{$entry}{Releases}}  )
1750
    {
2031
#    {
1751
        next unless ( $svnRepo =~ m~/ITSO_TRACS(/|$)~);
2032
#        next unless ( $svnRepo =~ m~/ITSO_TRACS(/|$)~);
1752
 
2033
#
1753
        my $prog_id = $versions{$entry}{Releases}{$rtag_id}{proj_id};
2034
#        my $prog_id = $versions{$entry}{Releases}{$rtag_id}{proj_id};
1754
        Message ("Adding Release Tag:$prog_id:$rtag_id");
2035
#        Message ("Adding Release Tag:$prog_id:$rtag_id");
1755
 
2036
#
1756
        my $rtext = 'Release_' . saneString($versions{$entry}{Releases}{$rtag_id}{rname});
2037
#        my $rtext = 'Release_' . saneString($versions{$entry}{Releases}{$rtag_id}{rname});
1757
        my @comment;
2038
#        my @comment;
1758
        push @comment, "Tagged by ClearCase to Subversion import";
2039
#        push @comment, "Tagged by ClearCase to Subversion import";
1759
        push @comment, "Project:$prog_id:$versions{$entry}{Releases}{$rtag_id}{pname}";
2040
#        push @comment, "Project:$prog_id:$versions{$entry}{Releases}{$rtag_id}{pname}";
1760
        push @comment, "Release:$rtag_id:$versions{$entry}{Releases}{$rtag_id}{rname}";
2041
#        push @comment, "Release:$rtag_id:$versions{$entry}{Releases}{$rtag_id}{rname}";
1761
 
2042
#
1762
        $data->{ReleaseTag}{$prog_id}{$rtag_id}{name} = $rtext;
2043
#        $data->{ReleaseTag}{$prog_id}{$rtag_id}{name} = $rtext;
1763
 
2044
#
1764
        $rv = JatsToolPrint ( 'jats_svnlabel' ,
2045
#        $rv = JatsToolPrint ( 'jats_svnlabel' ,
1765
                    '-comment', encode('UTF-8', join("\n", @comment), Encode::FB_DEFAULT),
2046
#                    '-comment', encode('UTF-8', join("\n", @comment), Encode::FB_DEFAULT),
1766
                    $data->{rmRef},
2047
#                    $data->{rmRef},
1767
                    '-clone',
2048
#                    '-clone',
1768
                    $rtext,
2049
#                    $rtext,
1769
#                    @args,
2050
##                    @args,
1770
                    '-author=buildadm',
2051
#                    '-author=buildadm',
1771
                     );
2052
#                     );
1772
        $data->{ReleaseTag}{$prog_id}{$rtag_id}{eState} = $rv;
2053
#        $data->{ReleaseTag}{$prog_id}{$rtag_id}{eState} = $rv;
1773
        $data->{ReleaseTag}{tCount}++;
2054
#        $data->{ReleaseTag}{tCount}++;
1774
 
2055
#
1775
        if ( $rv )
2056
#        if ( $rv )
1776
        {
2057
#        {
1777
            $data->{ReleaseTag}{eCount}++;
2058
#            $data->{ReleaseTag}{eCount}++;
1778
            Warning("Failed to add Release Tag: $rtext");
2059
#            Warning("Failed to add Release Tag: $rtext");
1779
        }
2060
#        }
1780
    }
2061
#    }
1781
 
2062
#
-
 
2063
######################## Deleted ###############################################
1782
 
2064
 
1783
    Message ("RM Ref: $data->{rmRef}");
2065
    Message ("RM Ref: $data->{rmRef}");
1784
    unlink $datafile;
2066
    unlink $datafile;
1785
 
2067
 
1786
    #
2068
    #
Line 2064... Line 2346...
2064
#
2346
#
2065
# Returns         : 
2347
# Returns         : 
2066
#
2348
#
2067
sub endPackage
2349
sub endPackage
2068
{
2350
{
-
 
2351
    Message ("-- Import Summary ------------------------------------------------" );
2069
    RmDirTree ('SvnImportDir');
2352
    RmDirTree ('SvnImportDir');
2070
 
2353
 
2071
    #
2354
    #
2072
    #   Display versions that did get captured
2355
    #   Display versions that did get captured
2073
    #
2356
    #
Line 2083... Line 2366...
2083
    #
2366
    #
2084
    foreach my $entry ( @processOrder )
2367
    foreach my $entry ( @processOrder )
2085
    {
2368
    {
2086
        $versions{$entry}{Scanned} = 1;
2369
        $versions{$entry}{Scanned} = 1;
2087
        next if ( $versions{$entry}{TagCreated} );
2370
        next if ( $versions{$entry}{TagCreated} );
-
 
2371
        my $reason = $versions{$entry}{data}{errStr} || '';
-
 
2372
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2088
        Warning ("Not Processed: " . GetVname($entry) );
2373
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
2089
    }
2374
    }
2090
 
2375
 
2091
    foreach my $entry ( keys(%versions) )
2376
    foreach my $entry ( keys(%versions) )
2092
    {
2377
    {
2093
        next if ( $versions{$entry}{Scanned} );
2378
        next if ( $versions{$entry}{Scanned} );
2094
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2379
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2095
    }
2380
    }
2096
 
2381
 
-
 
2382
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2097
    Message ("All Done");
2383
    Message ("All Done");
2098
}
2384
}
2099
 
2385
 
2100
#-------------------------------------------------------------------------------
2386
#-------------------------------------------------------------------------------
-
 
2387
# Function        : extractFilesFromClearCase
-
 
2388
#
-
 
2389
# Description     : Extract files from ClearCase
-
 
2390
#                   May take a while as we handle nasty errors
-
 
2391
#
-
 
2392
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2393
#                   $cc_path
-
 
2394
#                   $cc_label
-
 
2395
#
-
 
2396
# Returns         : exit code
-
 
2397
#                   Sets up
-
 
2398
#                       $data->{errStr}
-
 
2399
#                       $data->{errCode}
-
 
2400
#                   As per newPackageVersionBody
-
 
2401
#
-
 
2402
sub extractFilesFromClearCase
-
 
2403
{
-
 
2404
    my ($data, $cc_path, $cc_label) = @_;
-
 
2405
    my $tryCount = 0;
-
 
2406
    my $rv = 99;
-
 
2407
 
-
 
2408
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
-
 
2409
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
-
 
2410
    
-
 
2411
    if ( $opt_preserveProjectBase )
-
 
2412
    {
-
 
2413
        my $cc_vob = $cc_path;
-
 
2414
        $cc_vob =~ s~^/~~;
-
 
2415
        $cc_vob =~ s~/.*~~;
-
 
2416
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
-
 
2417
        Message ("Preserving Project Base");
-
 
2418
    }
-
 
2419
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2420
 
-
 
2421
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2422
    {
-
 
2423
        Message ("Reusing view: $cc_label");
-
 
2424
        return 0;
-
 
2425
    }
-
 
2426
 
-
 
2427
    while ( $rv == 99 ) {
-
 
2428
        my @args;
-
 
2429
        push (@args, '-view', $opt_name ) if ( defined $opt_name );
-
 
2430
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
-
 
2431
                    "-label=$cc_label" ,
-
 
2432
                    "-path=$cc_path",
-
 
2433
                    @args
-
 
2434
                    );
-
 
2435
 
-
 
2436
        if ( $rv == 10 ) {
-
 
2437
 
-
 
2438
            #
-
 
2439
            #   No files found
-
 
2440
            #   If this is the first time then try really hard to find them
-
 
2441
            #
-
 
2442
            unless ( $tryCount++ )
-
 
2443
            {
-
 
2444
                if ( $opt_relabel )
-
 
2445
                {
-
 
2446
                    $packageReLabelCount++;
-
 
2447
                    $rv = JatsToolPrint('cc2svn_labeldirs',
-
 
2448
                                            '-vob', $cc_path,
-
 
2449
                                            $cc_label,
-
 
2450
                                            );
-
 
2451
                    $data->{DirsLabled} = 100 + $rv;
-
 
2452
                }
-
 
2453
 
-
 
2454
                #
-
 
2455
                #   Second attempt - massage the users path
-
 
2456
                #   We should have labled up to the VOB root so lets
-
 
2457
                #   just use the VOB and not the path
-
 
2458
                #
-
 
2459
                #   If we are not relabeling then we can still do this
-
 
2460
                #   in an attempt to fix user stupidity
-
 
2461
                #
-
 
2462
                $cc_path =~ s~^/~~;
-
 
2463
                $cc_path =~ s~/.*~~;
-
 
2464
                $cc_path = '/' . $cc_path;
-
 
2465
                $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
-
 
2466
                redo;
-
 
2467
            }
-
 
2468
 
-
 
2469
            $data->{errStr}  = 'No Files in the extracted view';
-
 
2470
            $data->{errCode} = '0';
-
 
2471
            return 2;
-
 
2472
        }
-
 
2473
        elsif ( $rv == 11 ) {
-
 
2474
            $data->{errStr} = 'Label not found';
-
 
2475
            $data->{errCode} = 'L';
-
 
2476
            return 2;
-
 
2477
        }
-
 
2478
 
-
 
2479
        unless ( -d $data->{ViewPath}  )
-
 
2480
        {
-
 
2481
            $data->{errStr} = 'Failed to extract files from CC';
-
 
2482
            return 2;
-
 
2483
        }
-
 
2484
 
-
 
2485
        #
-
 
2486
        #   Looks good
-
 
2487
        #
-
 
2488
        return 0;
-
 
2489
    };
-
 
2490
 
-
 
2491
    $data->{errStr}  = 'No Files in the extracted view after labeling dirs';
-
 
2492
    $data->{errCode} = '0';
-
 
2493
    return 2;
-
 
2494
 
-
 
2495
}
-
 
2496
 
-
 
2497
#-------------------------------------------------------------------------------
-
 
2498
# Function        : detectMakeProjectUsage
-
 
2499
#
-
 
2500
# Description     : etect and report usage of the MakeProject directive
-
 
2501
#
-
 
2502
# Inputs          : $data               - Ref to a hash of bits
-
 
2503
#                   $cc_path            - Packages cc_path
-
 
2504
#
-
 
2505
# Returns         : true    - Bad usage (Really good usage not detected)
-
 
2506
#                   false   - Good usage detected
-
 
2507
#
-
 
2508
sub detectMakeProjectUsage
-
 
2509
{
-
 
2510
    my ($data, $cc_path) = @_;
-
 
2511
    my $retval = 0;
-
 
2512
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
-
 
2513
 
-
 
2514
    #
-
 
2515
    #   Find makefile.pl
-
 
2516
    #
-
 
2517
    Message ("Locate JATS makefiles");
-
 
2518
    my $usesMakeProject = 0;
-
 
2519
    my $badIncludeFile = 0;
-
 
2520
 
-
 
2521
    my $search = JatsLocateFiles->new("--Recurse=1",
-
 
2522
                                       "--FilterIn=makefile.pl",
-
 
2523
                                       );
-
 
2524
    my @makefiles = $search->search($data->{ViewRoot});
-
 
2525
    foreach my $file ( @makefiles )
-
 
2526
    {
-
 
2527
#print "---Reading: $workDir/$data->{ViewRoot}/$file\n";
-
 
2528
        if ( open( my $fh, '<', "$data->{ViewRoot}/$file" ) )
-
 
2529
        {
-
 
2530
            my $eof = 0;
-
 
2531
            my $line = '';
-
 
2532
            until ( $eof )
-
 
2533
            {
-
 
2534
                my $in = <$fh>;
-
 
2535
                unless ( defined $in )
-
 
2536
                {
-
 
2537
                    $eof = 1;
-
 
2538
                }
-
 
2539
                else
-
 
2540
                {
-
 
2541
                $in =~ s~\s+$~~;
-
 
2542
                $in =~ s~^\s+~~;
-
 
2543
                $in =~ s~^#.*$~~;
-
 
2544
                $in =~ s~\s*[^\$]#.*$~~;
-
 
2545
                $line .= ' ' if ( $line );
-
 
2546
                $line .= $in;
-
 
2547
                $line =~ s~\s+~ ~g;
-
 
2548
#print "====== '$line'\n";
-
 
2549
                redo unless ( $line =~ m~;$~  );
-
 
2550
                }
-
 
2551
#print "---- $line\n";
-
 
2552
                if ( $line =~ m~^MakeProject~ )
-
 
2553
                {
-
 
2554
                    $usesMakeProject++;
-
 
2555
                    $data->{UsesMakeProject}++;
-
 
2556
                    Warning ("Package uses MakeProject:",
-
 
2557
                             "Line: " . $line,
-
 
2558
                             "Root: " . "$data->{ViewRoot}",
-
 
2559
                             "File: " . "$data->{ViewRoot}/$file",
-
 
2560
                            );
-
 
2561
 
-
 
2562
                    #
-
 
2563
                    #   Extract out the project name
-
 
2564
                    #
-
 
2565
                    my @myArgs;
-
 
2566
                    my $myProjectDir;
-
 
2567
                    my $myProject = "$data->{ViewRoot}/$file";
-
 
2568
                    $myProject =~ s~/[^/]+$~~;
-
 
2569
                    $line =~ s~MakeProject~push \@myArgs,~;
-
 
2570
                    eval $line;
-
 
2571
                    Error("Line did not compiler: $line", "Err: $@" ) if ($@);
-
 
2572
                    shift @myArgs;
-
 
2573
                    foreach ( @myArgs )
-
 
2574
                    {
-
 
2575
                        next if ( m~^--~ );
-
 
2576
                        $myProject .= '/' . $_;
-
 
2577
                        $myProjectDir = $myProject;
-
 
2578
                        $myProjectDir =~ s~/[^/]+$~~;
-
 
2579
                        last;
-
 
2580
                    }
-
 
2581
                    Error ("No project Found") unless ( defined $myProjectDir);
-
 
2582
                    if ( -f "$myProjectDir/include.txt" )
-
 
2583
                    {
-
 
2584
                        Warning ("Co-located 'include.txt' file also found");
-
 
2585
                    }
-
 
2586
 
-
 
2587
                    # The only problem is if the include.txt file
-
 
2588
                    # escapes from the VOB - or even uses the vob root
-
 
2589
                    #
-
 
2590
                    # Examine the include file
-
 
2591
                    # Expect it to look like
-
 
2592
                    #   /I Path
-
 
2593
                    #
-
 
2594
 
-
 
2595
                    #
-
 
2596
                    #   Determine safe level
-
 
2597
                    #   Relative to the include file
-
 
2598
                    #
-
 
2599
                    my $depthPath = $myProjectDir;
-
 
2600
                    my $depth = 0;
-
 
2601
                    Error ("Expect this to work") unless ( $depthPath =~ s~^$data->{ViewRoot}/~~ );
-
 
2602
                    foreach ( split('/', $depthPath) )
-
 
2603
                    {
-
 
2604
                        if ( $_ eq '..' ) {
-
 
2605
                            $depth--;
-
 
2606
                        } else {
-
 
2607
                            $depth++;
-
 
2608
                        }
-
 
2609
                    }
-
 
2610
#print "Depth: $depth, $depthPath\n";
-
 
2611
 
-
 
2612
                    if ( open( my $if, '<', "$myProjectDir/include.txt" ) )
-
 
2613
                    {
-
 
2614
                        while ( <$if> )
-
 
2615
                        {
-
 
2616
                            s~\s+$~~;
-
 
2617
                            s~^\s+~~;
-
 
2618
                            next unless ( $_ );
-
 
2619
                            if ( m~/I\s+(.*)~ )
-
 
2620
                            {
-
 
2621
                                my $path = $1;
-
 
2622
                                $path =~ tr~\\/~/~s;
-
 
2623
                                $path =~ s~\\~/~g;
-
 
2624
#print "Examine: $path\n";
-
 
2625
                                my $minLevel = 0;
-
 
2626
                                my $level = 0;
-
 
2627
                                foreach ( split('/', $path) )
-
 
2628
                                {
-
 
2629
                                    if ( $_ eq '..' )
-
 
2630
                                    {
-
 
2631
                                        $level--;
-
 
2632
                                        $minLevel = $level if ($level < $minLevel);
-
 
2633
                                    }
-
 
2634
                                    else
-
 
2635
                                    {
-
 
2636
                                        $level++;
-
 
2637
                                    }
-
 
2638
                                }
-
 
2639
#print "Min: $minLevel, $level, ($depth + $minLevel)\n";
-
 
2640
                                if ( $depth + $minLevel <= 0)
-
 
2641
                                {
-
 
2642
                                    $badIncludeFile++;
-
 
2643
                                    Warning ("Included path escapes package:",
-
 
2644
                                             "Line: " . $_,
-
 
2645
                                             "File: " . "$myProjectDir/include.txt",
-
 
2646
                                            );
-
 
2647
                                    last;
-
 
2648
                                }
-
 
2649
                            }
-
 
2650
                        }
-
 
2651
                        close $if;
-
 
2652
                    }
-
 
2653
 
-
 
2654
                }
-
 
2655
                $line = '';
-
 
2656
            }
-
 
2657
            close $fh;
-
 
2658
        }
-
 
2659
        else
-
 
2660
        {
-
 
2661
            Warning ("MakeProject$eSuf - Cannot open makefile: $file");
-
 
2662
            $retval = 1;
-
 
2663
        }
-
 
2664
    }
-
 
2665
 
-
 
2666
    #
-
 
2667
    #   Used
-
 
2668
    #   May be improved latter
-
 
2669
    #
-
 
2670
    if ( $usesMakeProject && $badIncludeFile)
-
 
2671
    {
-
 
2672
        Warning ("MakeProject$eSuf - Problem detected");
-
 
2673
        $retval = 1;
-
 
2674
    }
-
 
2675
 
-
 
2676
    #
-
 
2677
    #   Until we have more faith in the detection algorithm
-
 
2678
    #
-
 
2679
    if ( $usesMakeProject )
-
 
2680
    {
-
 
2681
        Warning ("MakeProject$eSuf - Makeproject used. Must check manually");
-
 
2682
        $retval = 1;
-
 
2683
    }
-
 
2684
    
-
 
2685
    return $retval;
-
 
2686
}
-
 
2687
 
-
 
2688
#-------------------------------------------------------------------------------
2101
# Function        : detectProjectBaseUsage
2689
# Function        : detectProjectBaseUsage
2102
#
2690
#
2103
# Description     : Detect and report usage of the SetProjectBase directive
2691
# Description     : Detect and report usage of the SetProjectBase directive
2104
#
2692
#
2105
# Inputs          : $data               - Ref to a hash of bits
2693
# Inputs          : $data               - Ref to a hash of bits
Line 2145... Line 2733...
2145
 
2733
 
2146
                if ( m~^SetProjectBase~ )
2734
                if ( m~^SetProjectBase~ )
2147
                {
2735
                {
2148
                    $definesProjectBase++;
2736
                    $definesProjectBase++;
2149
                    $data->{DefinesProjectBase}++;
2737
                    $data->{DefinesProjectBase}++;
2150
                    Warning ("Package uses SetProjectBase:",
2738
                    Warning ("Package initialises SetProjectBase:",
2151
                             "Line: " . $_,
2739
                             "Line: " . $_,
2152
                             "Root: " . "$data->{ViewRoot}",
2740
                             "Root: " . "$data->{ViewRoot}",
2153
                             "File: " . "$data->{ViewRoot}/$file",
2741
                             "File: " . "$data->{ViewRoot}/$file",
2154
                            );
2742
                            );
2155
 
2743
 
Line 2177... Line 2765...
2177
                        pop @bpaths;
2765
                        pop @bpaths;
2178
                    }
2766
                    }
2179
                    unless (defined $blevel)
2767
                    unless (defined $blevel)
2180
                    {
2768
                    {
2181
                        Warning ("SetProjectBase$eSuf calculation failed - can't find build.pl");
2769
                        Warning ("SetProjectBase$eSuf calculation failed - can't find build.pl");
2182
                        $retval = 1;
2770
#                        $retval = 1;
-
 
2771
                         $definitionError++;
2183
                    }
2772
                    }
2184
                    else
2773
                    else
2185
                    {
2774
                    {
2186
                        #
2775
                        #
2187
                        #   Determine the depth of the view root
2776
                        #   Determine the depth of the view root
Line 2253... Line 2842...
2253
 
2842
 
2254
#-------------------------------------------------------------------------------
2843
#-------------------------------------------------------------------------------
2255
# Function        : findDirWithStuff
2844
# Function        : findDirWithStuff
2256
#
2845
#
2257
# Description     : Find a directory that contains more than just another subdir
2846
# Description     : Find a directory that contains more than just another subdir
-
 
2847
#                   Note: don't use 'glob' it doesn't work if the name has a space in it.
2258
#
2848
#
2259
# Inputs          : $base               - Start of the scan
2849
# Inputs          : $base               - Start of the scan
2260
#
2850
#
2261
# Returns         : Path to dir with more than just a single dir in it
2851
# Returns         : Path to dir with more than just a single dir in it
2262
#
2852
#
Line 2268... Line 2858...
2268
    {
2858
    {
2269
    my $fileCount = 0;
2859
    my $fileCount = 0;
2270
    my $dirCount = 0;
2860
    my $dirCount = 0;
2271
    my $firstDir;
2861
    my $firstDir;
2272
 
2862
 
-
 
2863
    opendir (my $dh, $base ) || Error ("Cannot opendir $base. $!");
2273
    my @list = glob( $base . '/*');
2864
    my @list =readdir $dh;
-
 
2865
    closedir $dh;
2274
    foreach ( @list )
2866
    foreach ( @list )
2275
    {
2867
    {
2276
        next if ( $_ eq '.' );
2868
        next if ( $_ eq '.' );
2277
        next if ( $_ eq '..' );
2869
        next if ( $_ eq '..' );
-
 
2870
 
-
 
2871
        $_ = $base . '/' . $_;
2278
        if ( -d $_ )
2872
        if ( -d $_ )
2279
        {
2873
        {
2280
            $dirCount++;
2874
            $dirCount++;
2281
            $firstDir = $_ unless ( defined $firstDir );
2875
            $firstDir = $_ unless ( defined $firstDir );
-
 
2876
            return $base
2282
            return $base if ( $dirCount > 1  );
2877
                if ( $dirCount > 1  )
2283
        }
2878
        }
2284
        elsif ( -e $_ )
2879
        elsif ( -e $_ )
2285
        {
2880
        {
2286
            return $base;
2881
            return $base;
2287
        }
2882
        }
2288
 
2883
 
2289
        # else its probably a dead symlink
2884
        # else its probably a dead symlink
2290
    }
2885
    }
-
 
2886
 
-
 
2887
    return $base
2291
    return $base unless ( $dirCount == 1  );
2888
        unless ( $dirCount == 1  );
2292
    $base = $firstDir;
2889
    $base = $firstDir;
2293
    }
2890
    }
2294
}
2891
}
2295
 
2892
 
2296
 
-
 
2297
#-------------------------------------------------------------------------------
2893
#-------------------------------------------------------------------------------
2298
# Function        : JatsToolPrint
2894
# Function        : JatsToolPrint
2299
#
2895
#
2300
# Description     : Print and Execuate a JatsTool command
2896
# Description     : Print and Execuate a JatsTool command
2301
#
2897
#
Line 2323... Line 2919...
2323
        }
2919
        }
2324
    }
2920
    }
2325
    return $me;
2921
    return $me;
2326
}
2922
}
2327
 
2923
 
-
 
2924
#-------------------------------------------------------------------------------
-
 
2925
# Function        : saneLabel
-
 
2926
#
-
 
2927
# Description     : Generate a sane version label
-
 
2928
#                   Handle suplicates (due to character squishing)
-
 
2929
#                   Cache results for repeatability
-
 
2930
#
-
 
2931
# Inputs          : $entry          - Version info
-
 
2932
#                   $pkgname        - Alternate pkgname (branching)
-
 
2933
#
-
 
2934
# Returns         : Sane string
-
 
2935
#
2328
sub saneLabel
2936
sub saneLabel
2329
{
2937
{
2330
    my ($entry, $pkgname) = @_;
2938
    my ($entry, $pkgname) = @_;
2331
    my $me;
2939
    my $me;
2332
    $me = $versions{$entry}{vname};
2940
    $me = $versions{$entry}{vname};
2333
    $pkgname = $versions{$entry}{name} unless ( defined $pkgname );
2941
    $pkgname = $versions{$entry}{name} unless ( defined $pkgname );
2334
 
2942
 
-
 
2943
    #
-
 
2944
    #   If we have calculated it, then reuse it.
-
 
2945
    #
-
 
2946
    if ( exists $versions{$entry}{saneLabel}{$pkgname} )
-
 
2947
    {
-
 
2948
        return $versions{$entry}{saneLabel}{$pkgname};
-
 
2949
    }
-
 
2950
 
-
 
2951
 
2335
    Error ("Package does have a version string: pvid: $entry")
2952
    Error ("Package does have a version string: pvid: $entry")
2336
        unless ( defined $me );
2953
        unless ( defined $me );
2337
 
2954
 
2338
    #
2955
    #
2339
    #   Convert Wip format (xxxx) into a string that can be used for a label
2956
    #   Convert Wip format (xxxx) into a string that can be used for a label
Line 2353... Line 2970...
2353
    $me = $pkgname . '_' . $me;
2970
    $me = $pkgname . '_' . $me;
2354
    $me =~ tr~ ~-~s;
2971
    $me =~ tr~ ~-~s;
2355
    $me =~ tr~-~-~s;
2972
    $me =~ tr~-~-~s;
2356
    $me =~ tr~_~_~s;
2973
    $me =~ tr~_~_~s;
2357
 
2974
 
-
 
2975
    #
-
 
2976
    #   Due to some sillyness ( package version starting with _ )
-
 
2977
    #   we may get duplicates. Detect and allocate different numbers
-
 
2978
    #
-
 
2979
    if ( exists $saneLabels{$me} )
-
 
2980
    {
-
 
2981
        $saneLabels{$me}++;
-
 
2982
        $me = $me . '.' . $saneLabels{$me};
-
 
2983
        Message ("Duplicate SaneLabel resolved as: $me");
-
 
2984
    }
-
 
2985
    else
-
 
2986
    {
-
 
2987
        $saneLabels{$me} = 0;
-
 
2988
    }
-
 
2989
 
-
 
2990
    #
-
 
2991
    #   Cache value
-
 
2992
    #
-
 
2993
    $versions{$entry}{saneLabel}{$pkgname} = $me;
2358
    return $me;
2994
    return $me;
2359
}
2995
}
2360
 
2996
 
2361
sub saneString
2997
sub saneString
2362
{
2998
{
Line 2459... Line 3095...
2459
    connectRM(\$RM_DB) unless ( $RM_DB );
3095
    connectRM(\$RM_DB) unless ( $RM_DB );
2460
 
3096
 
2461
    #
3097
    #
2462
    #   Extract data from Release Manager
3098
    #   Extract data from Release Manager
2463
    #
3099
    #
-
 
3100
    my $m_sqlstr = "SELECT " .
-
 
3101
                       "pkg.PKG_NAME, " .                                       # row[0]
-
 
3102
                       "pv.PKG_VERSION, " .                                     # row[1]
-
 
3103
                       "pkg.PKG_ID, " .                                         # row[2]
-
 
3104
                       "pv.PV_ID, " .                                           # row[3]
-
 
3105
                       "pv.LAST_PV_ID, " .                                      # row[4]
-
 
3106
                       "pv.MODIFIED_STAMP, " .                                  # row[5]
2464
    my $m_sqlstr = "SELECT pkg.PKG_NAME, pv.PKG_VERSION, pkg.PKG_ID, pv.PV_ID, pv.LAST_PV_ID, pv.MODIFIED_STAMP, release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), amu.USER_NAME, pv.COMMENTS, pv.DLOCKED, pv.CREATOR_ID ".
3107
                       "release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID), " .  # row[6]
2465
                   " FROM RELEASE_MANAGER.PACKAGES pkg, RELEASE_MANAGER.PACKAGE_VERSIONS pv, ACCESS_MANAGER.USERS amu" .
3108
                       "amu.USER_NAME, " .                                      # row[7]
-
 
3109
                       "pv.COMMENTS, " .                                        # row[8]
-
 
3110
                       "pv.DLOCKED, " .                                         # row[9]
-
 
3111
                       "pv.CREATOR_ID, ".                                       # row[10]
2466
                   " WHERE pv.PKG_ID = \'$pkg_id\' AND pkg.PKG_ID = pv.PKG_ID AND amu.USER_ID (+) = pv.CREATOR_ID";
3112
                       "pv.BUILD_TYPE ".                                        # row[11]
2467
                   
3113
                   " FROM " .
-
 
3114
                        "RELEASE_MANAGER.PACKAGES pkg, " .
-
 
3115
                        "RELEASE_MANAGER.PACKAGE_VERSIONS pv, " .
-
 
3116
                        "ACCESS_MANAGER.USERS amu" .
2468
                   
3117
                   " WHERE " .
-
 
3118
                        "pv.PKG_ID = \'$pkg_id\' " .
-
 
3119
                        "AND pkg.PKG_ID = pv.PKG_ID " .
-
 
3120
                        "AND amu.USER_ID (+) = pv.CREATOR_ID";
-
 
3121
 
2469
    my $sth = $RM_DB->prepare($m_sqlstr);
3122
    my $sth = $RM_DB->prepare($m_sqlstr);
2470
    if ( defined($sth) )
3123
    if ( defined($sth) )
2471
    {
3124
    {
2472
        if ( $sth->execute( ) )
3125
        if ( $sth->execute( ) )
2473
        {
3126
        {
Line 2486... Line 3139...
2486
                    my $vcstag =  $row[6] || 'Unknown';
3139
                    my $vcstag =  $row[6] || 'Unknown';
2487
 
3140
 
2488
                    my $created_id =  $row[7] || ($row[10] ? "Userid_$row[10]" :'Unknown');
3141
                    my $created_id =  $row[7] || ($row[10] ? "Userid_$row[10]" :'Unknown');
2489
                    my $comment =  $row[8] || '';
3142
                    my $comment =  $row[8] || '';
2490
                    my $locked =  $row[9] || 'N';
3143
                    my $locked =  $row[9] || 'N';
-
 
3144
                    my $manual = $row[11] || 'M';
2491
 
3145
 
2492
                    #
3146
                    #
2493
                    #   Some developers have a 'special' package version
3147
                    #   Some developers have a 'special' package version
2494
                    #   We really need to ignore them
3148
                    #   We really need to ignore them
2495
                    #
3149
                    #
Line 2509... Line 3163...
2509
                    $versions{$pv_id}{comment} = $comment;
3163
                    $versions{$pv_id}{comment} = $comment;
2510
                    $versions{$pv_id}{locked} = $locked;
3164
                    $versions{$pv_id}{locked} = $locked;
2511
                    $versions{$pv_id}{TimeStamp} = str2time( $created );
3165
                    $versions{$pv_id}{TimeStamp} = str2time( $created );
2512
                    $versions{$pv_id}{Age} = ($now - $versions{$pv_id}{TimeStamp}) / (60 * 60 * 24);
3166
                    $versions{$pv_id}{Age} = ($now - $versions{$pv_id}{TimeStamp}) / (60 * 60 * 24);
2513
                    $versions{$pv_id}{TooOld} = 1 if ( $opt_age && $opt_age <= $versions{$pv_id}{Age} );
3167
                    $versions{$pv_id}{TooOld} = 1 if ( $opt_age && $opt_age <= $versions{$pv_id}{Age} );
-
 
3168
                    $versions{$pv_id}{BuildType} = $manual;
2514
                    examineVcsTag($pv_id);
3169
                    examineVcsTag($pv_id);
2515
 
3170
 
2516
                    #
3171
                    #
2517
                    #   Process version number
3172
                    #   Process version number
2518
                    #
3173
                    #
2519
                    my ($suffix, $version, $isaR, $isaWip, $buildVersion ) = massageVersion($pkg_ver, $pkg_name);
3174
                    my ($suffix, $version, $isaR, $isaWip, $buildVersion ) = massageVersion($pkg_ver, $pkg_name);
2520
 
3175
 
2521
                    $versions{$pv_id}{version} = $version;
3176
                    $versions{$pv_id}{version} = $version;
2522
                    $versions{$pv_id}{buildVersion} = $buildVersion;
3177
                    $versions{$pv_id}{buildVersion} = $buildVersion;
2523
                    $versions{$pv_id}{isaRipple} = 1 if ( $isaR );
-
 
2524
                    $versions{$pv_id}{isaWip} = 1 if ( $isaWip );
3178
                    $versions{$pv_id}{isaWip} = 1 if ( $isaWip );
2525
 
3179
 
2526
                    #
3180
                    #
-
 
3181
                    #   New methof for detecting a ripple
-
 
3182
                    #       Don't look at the version number
-
 
3183
                    #       Use RM data
-
 
3184
                    #       Inlude the comment - there are some cases where the comment
-
 
3185
                    #       appears to have been user modified.
-
 
3186
                    #
-
 
3187
#                    $versions{$pv_id}{isaRipple} = 1 if ( $isaR );
-
 
3188
#                    $versions{$pv_id}{isaRipple} = 1 if ( uc($manual) eq 'Y' );
-
 
3189
                    $versions{$pv_id}{isaRipple} = ( $comment =~ m~^Rippled Build~i && ( uc($manual) eq 'Y' ));
-
 
3190
 
-
 
3191
                    #
2527
                    #   Process suffix
3192
                    #   Process suffix
2528
                    #
3193
                    #
2529
                    $suffix = 'Unknown' unless ( $suffix );
3194
                    $suffix = 'Unknown' unless ( $suffix );
2530
                    $suffix = lc ($suffix);
3195
                    $suffix = lc ($suffix);
2531
                    $versions{$pv_id}{suffix} = $suffix;
3196
                    $versions{$pv_id}{suffix} = $suffix;
Line 2785... Line 3450...
2785
{
3450
{
2786
    my ($tag) = @_;
3451
    my ($tag) = @_;
2787
    $tag =~ tr~\\/~/~;
3452
    $tag =~ tr~\\/~/~;
2788
    if ( $tag =~ m~^CC::~ )
3453
    if ( $tag =~ m~^CC::~ )
2789
    {
3454
    {
-
 
3455
        $tag =~ s~CC::load\s+~CC::~;                # Load rule
-
 
3456
        $tag =~ s~CC::\s+~CC::~;                    # Leading white space
-
 
3457
        $tag =~ s~CC::[A-Za-z]\:/~CC::/~;           # Leading driver letter
-
 
3458
        $tag =~ s~CC::/+~CC::/~;                    # Multiple initial /'s
-
 
3459
        $tag =~ s~/build.pl::~::~i;
2790
        $tag =~ s~CC::\s+~CC::~;
3460
        $tag =~ s~/src::~::~i;
2791
        $tag =~ s~MASS_Dev_Bus/Cbp/~MASS_Dev_Bus/CBP/~i;
3461
        $tag =~ s~MASS_Dev_Bus/Cbp/~MASS_Dev_Bus/CBP/~i;
2792
        $tag =~ s~MASS_Dev_Bus~MASS_Dev_Bus~i;
3462
        $tag =~ s~MASS_Dev_Bus~MASS_Dev_Bus~i;
2793
        $tag =~ s~/MASS_Dev/Infra~MASS_Dev_Infra~i;
3463
        $tag =~ s~/MASS_Dev/Infra~MASS_Dev_Infra~i;
2794
        $tag =~ s~/MASS_Dev/Bus/web~/MASS_Dev_Bus/web~i;
3464
        $tag =~ s~/MASS_Dev/Bus/web~/MASS_Dev_Bus/web~i;
2795
 
3465
 
Line 2964... Line 3634...
2964
            push @text, '|';
3634
            push @text, '|';
2965
            push @text, 'Subversion';
3635
            push @text, 'Subversion';
2966
            push @text, 'Trunk used' if exists $svnData{branches}{trunk} ;
3636
            push @text, 'Trunk used' if exists $svnData{branches}{trunk} ;
2967
            push @text, 'Labels: ' . scalar keys %{$svnData{tags}} ;
3637
            push @text, 'Labels: ' . scalar keys %{$svnData{tags}} ;
2968
            push @text, 'Branches: ' . scalar keys %{$svnData{branches}} ;
3638
            push @text, 'Branches: ' . scalar keys %{$svnData{branches}} ;
-
 
3639
            push @text, 'Relabled Packages : ' . $packageReLabelCount;
2969
        }
3640
        }
2970
 
3641
 
2971
        push @text, '';
3642
        push @text, '';
2972
        my $text = join '\l', @text;
3643
        my $text = join '\l', @text;
2973
        $text =~ s~\|\\l~|~g;
3644
        $text =~ s~\|\\l~|~g;
Line 3000... Line 3671...
3000
        push @text, '|{N: Not Locked';
3671
        push @text, '|{N: Not Locked';
3001
        push @text, 'b: Bad Singleton';
3672
        push @text, 'b: Bad Singleton';
3002
        push @text, 'B: Bad VCS Tag';
3673
        push @text, 'B: Bad VCS Tag';
3003
        push @text, 'D: DeadWood';
3674
        push @text, 'D: DeadWood';
3004
        push @text, 'E: Essential Release Version';
3675
        push @text, 'E: Essential Release Version';
-
 
3676
        push @text, 'F: Package directories labled';
3005
        push @text, 'G: Glued into Version Tree';
3677
        push @text, 'G: Glued into Version Tree';
-
 
3678
        push @text, 'L: Label not in VOB';
3006
        push @text, 'r: Recent version';
3679
        push @text, 'r: Recent version';
3007
        push @text, 'R: Ripple';
3680
        push @text, 'R: Ripple';
3008
        push @text, 'S: Splitpoint';
3681
        push @text, 'S: Splitpoint';
3009
        push @text, 't: Glued into Project Tree';
3682
        push @text, 't: Glued into Project Tree';
3010
        push @text, 'T: Tip version';
3683
        push @text, 'T: Tip version';
3011
        push @text, 'V: In SVN';
3684
        push @text, 'V: In SVN';
3012
        push @text, '+: In Subversion';
3685
        push @text, '+: In Subversion';
-
 
3686
        push @text, '0: Zero files extracted';
3013
        push @text, '}}';
3687
        push @text, '}}';
3014
 
3688
 
3015
        push @text, '|';
3689
        push @text, '|';
3016
        push @text, 'Outline';
3690
        push @text, 'Outline';
3017
        push @text, 'Red: Dead or Bad VCS Tag';
3691
        push @text, 'Red: Dead or Bad VCS Tag';
3018
        push @text, 'Orange: Project Branch Root';
3692
        push @text, 'Orange: Project Branch Root';
3019
        push @text, 'Green: Ripple Build Version';
3693
        push @text, 'Green: Ripple Build Version';
3020
        push @text, 'Blue: Essential Version';
3694
        push @text, 'Blue: Essential Version';
3021
        push @text, 'Darkmagenta: Entry Glued into tree';
3695
        push @text, 'Darkmagenta: Entry Glued into tree';
3022
        push @text, 'Magenta: Entry added to project tree';
3696
        push @text, 'Magenta: Entry added to project tree';
-
 
3697
        push @text, 'DeepPink: Label not in VOB';
-
 
3698
        push @text, 'DarkViolet: Zero files extracted';
3023
 
3699
 
3024
 
3700
 
3025
        push @text, '|';
3701
        push @text, '|';
3026
        push @text, 'Fill';
3702
        push @text, 'Fill';
3027
        push @text, 'PowderBlue: Essential Version';
3703
        push @text, 'PowderBlue: Essential Version';
Line 3080... Line 3756...
3080
        $stateText .= 'r' if (exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
3756
        $stateText .= 'r' if (exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
3081
        $stateText .= 'S' if (exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
3757
        $stateText .= 'S' if (exists $versions{$entry}{EssentialSplitPoint} && $versions{$entry}{EssentialSplitPoint} > 1 );
3082
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
3758
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
3083
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
3759
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
3084
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
3760
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
-
 
3761
        $stateText .= '0' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq '0');
-
 
3762
        $stateText .= 'L' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq 'L');
-
 
3763
        $stateText .= 'F' if ($versions{$entry}{data}{DirsLabled});
-
 
3764
 
-
 
3765
 
3085
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );
3766
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );
3086
#        $stateText .= ' T='. $versions{$entry}{threadId} if (exists $versions{$entry}{threadId});
3767
#        $stateText .= ' T='. $versions{$entry}{threadId} if (exists $versions{$entry}{threadId});
3087
#        $stateText .= ' EssentalPath' if (exists $versions{$entry}{EssentialPath});
3768
#        $stateText .= ' EssentalPath' if (exists $versions{$entry}{EssentialPath});
3088
#        $stateText .= ' Count='. $versions{$entry}{EssentialSplitPoint} if (exists $versions{$entry}{EssentialSplitPoint});
3769
#        $stateText .= ' Count='. $versions{$entry}{EssentialSplitPoint} if (exists $versions{$entry}{EssentialSplitPoint});
3089
#        $stateText .= ' M='. $versions{$entry}{maxVersion} if (exists $versions{$entry}{maxVersion});
3770
#        $stateText .= ' M='. $versions{$entry}{maxVersion} if (exists $versions{$entry}{maxVersion});
3090
 
3771
 
3091
        push @label, "(${stateText})" if ( $stateText );
3772
        push @label, "(${stateText})" if ( length($stateText) );
3092
 
3773
 
3093
##       Insert Release Names
3774
##       Insert Release Names
3094
#        foreach my $rtag_id ( keys %{$versions{$entry}{Releases}}  ) {
3775
        foreach my $rtag_id ( keys %{$versions{$entry}{Releases}}  ) {
-
 
3776
            next unless ( exists $ukHopsReleases{$rtag_id} );
3095
#            push @label, "Release: $versions{$entry}{Releases}{$rtag_id}{rname}";
3777
            push @label, "Release: $versions{$entry}{Releases}{$rtag_id}{rname}";
3096
#        }
3778
        }
3097
 
3779
 
3098
        return join ('\n', @label );
3780
        return join ('\n', @label );
3099
    }
3781
    }
3100
 
3782
 
3101
    sub genAttributes
3783
    sub genAttributes
Line 3120... Line 3802...
3120
           $color = 'color=orange style=bold' if ( $versions{$entry}{newSuffix} );
3802
           $color = 'color=orange style=bold' if ( $versions{$entry}{newSuffix} );
3121
           $color = 'color=red style=bold' if ( $versions{$entry}{DeadWood} || $versions{$entry}{badVcsTag} );
3803
           $color = 'color=red style=bold' if ( $versions{$entry}{DeadWood} || $versions{$entry}{badVcsTag} );
3122
           $color = 'color=blue style=bold' if ( $versions{$entry}{Essential} );
3804
           $color = 'color=blue style=bold' if ( $versions{$entry}{Essential} );
3123
           $color = 'color=darkmagenta style=bold' if ( $versions{$entry}{GluedIn} );
3805
           $color = 'color=darkmagenta style=bold' if ( $versions{$entry}{GluedIn} );
3124
           $color = 'color=magenta style=bold' if ( $versions{$entry}{MakeTree} );
3806
           $color = 'color=magenta style=bold' if ( $versions{$entry}{MakeTree} );
-
 
3807
           $color = 'color=DeepPink style=bold' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq 'L');
-
 
3808
           $color = 'color=DarkViolet style=bold' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq '0');
3125
 
3809
 
3126
           $fill = 'style=filled fillcolor=powderblue' if ( $versions{$entry}{Essential} );
3810
           $fill = 'style=filled fillcolor=powderblue' if ( $versions{$entry}{Essential} );
3127
           $fill = 'style=filled fillcolor=red' if ( $versions{$entry}{Essential} && $versions{$entry}{badVcsTag} );
3811
           $fill = 'style=filled fillcolor=red' if ( $versions{$entry}{Essential} && $versions{$entry}{badVcsTag} );
3128
           $fill = 'style=filled fillcolor="#99FF99"' if ( exists $versions{$entry}{svnVersion} );
3812
           $fill = 'style=filled fillcolor="#99FF99"' if ( exists $versions{$entry}{svnVersion} );
3129
 
3813
 
Line 3345... Line 4029...
3345
        }
4029
        }
3346
        
4030
        
3347
        #print "ESSENTIAL: $versions{$_}{name} $versions{$_}{vname}\n";
4031
        #print "ESSENTIAL: $versions{$_}{name} $versions{$_}{vname}\n";
3348
    }
4032
    }
3349
 
4033
 
3350
 
-
 
3351
    #
4034
    #
3352
    #   Free memory
4035
    #   Free memory
3353
    #
4036
    #
3354
    %ScmReleases = ();
4037
    %ScmReleases = ();
3355
    %ScmPackages = ();
4038
    %ScmPackages = ();
Line 3657... Line 4340...
3657
    -name=aaa          - Alternate output package name. Test Only
4340
    -name=aaa          - Alternate output package name. Test Only
3658
    -[no]log           - Write output to log file. Def: -nolog
4341
    -[no]log           - Write output to log file. Def: -nolog
3659
    -[no]postimage     - Create image after transger: Def: -post
4342
    -[no]postimage     - Create image after transger: Def: -post
3660
    -workdir=path      - Use for temp storage (def:/work)
4343
    -workdir=path      - Use for temp storage (def:/work)
3661
    -delete            - Delete SVN package before test
4344
    -delete            - Delete SVN package before test
-
 
4345
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
3662
 
4346
 
3663
=head1 OPTIONS
4347
=head1 OPTIONS
3664
 
4348
 
3665
=over 8
4349
=over 8
3666
 
4350