Subversion Repositories DevTools

Rev

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

Rev 2449 Rev 2757
Line 68... Line 68...
68
my $opt_workDir = '/work';
68
my $opt_workDir = '/work';
69
my $opt_vobMap;
69
my $opt_vobMap;
70
my $opt_preserveProjectBase;
70
my $opt_preserveProjectBase;
71
my $opt_ignoreProjectBaseErrors;
71
my $opt_ignoreProjectBaseErrors;
72
my $opt_ignoreMakeProjectErrors;
72
my $opt_ignoreMakeProjectErrors;
-
 
73
my $opt_forceProjectBase;
-
 
74
my @opt_limitProjectBase;
-
 
75
my $opt_ignoreBadPaths;
73
my $opt_delete;
76
my $opt_delete;
74
my $opt_recentAge = 14;             # Days
77
my $opt_recentAge = 14;             # Days
75
my $opt_relabel = 0;
78
my $opt_relabel = 0;
76
my $opt_protected;
79
my $opt_protected;
77
my $opt_useSvn = 1;
80
my $opt_useSvn = 1;
78
my $opt_testRmDatabase;
81
my $opt_testRmDatabase;
-
 
82
my $opt_extractFromSvn;
-
 
83
my $opt_AllowMuliplePaths = 1;      #29-Nov-2012
-
 
84
my $opt_resume;
79
 
85
 
80
################################################################################
86
################################################################################
81
#   List of Projects Suffixes and Branch Names to be used within SVN
87
#   List of Projects Suffixes and Branch Names to be used within SVN
82
#
88
#
83
#       Name        - Name of branch for the project
89
#       Name        - Name of branch for the project
Line 148... Line 154...
148
    'db_cda'              => ',utf8,',
154
    'db_cda'              => ',utf8,',
149
    'CommandServer'       => ',IgnoreMakeProject,',
155
    'CommandServer'       => ',IgnoreMakeProject,',
150
    'TDSExporterControl'  => ',IgnoreMakeProject,',
156
    'TDSExporterControl'  => ',IgnoreMakeProject,',
151
    'cdagui'              => ',IgnoreMakeProject,',
157
    'cdagui'              => ',IgnoreMakeProject,',
152
 
158
 
153
    'daf_bvt'                 => ',IgnoreMakeProject,',  # Look OK
-
 
154
    'daf_dll'                 => ',IgnoreMakeProject,',  # MakeProject not in used makefile
-
 
155
    'PFTPi'                   => ',IgnoreMakeProject,',  # Looks OK
-
 
156
    'PFTPu'                   => ',IgnoreMakeProject,',  # Looks OK
-
 
157
    'WinCEBlocker'            => ',IgnoreMakeProject,',  # Looks OK
-
 
158
    'WinCEDeviceAutoInject'   => ',IgnoreMakeProject,',  # Looks OK
-
 
159
    'WinCEReboot'             => ',IgnoreMakeProject,',  # Looks OK
-
 
160
 
159
 
-
 
160
    'ftp'                   => ',SetProjectBase,',
-
 
161
    'ddu_app_manager'       => ',SetProjectBase,IgnoreMakeProject,',
-
 
162
    'ddu_afc'               => ',SetProjectBase,IgnoreMakeProject,',
-
 
163
    'ddu_dog'               => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode/projects/seattle/ddu,',
-
 
164
    'ddu_management'        => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode,',
-
 
165
    'ddu_fim'               => ',IgnoreMakeProject,',
-
 
166
    'ddu_mccain'            => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode/projects/seattle/ddu,',
-
 
167
    'ddu_mon'               => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode/projects/seattle,',
-
 
168
    'ddu_rcu'               => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode,',
-
 
169
    'ddu_status_logging'    => ',SetProjectBase,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode/projects/seattle,',
-
 
170
    'ddu_logging_lib'       => ',SetProjectBase,ForceProjectBase=/DPG_SWCode/projects/seattle/ddu,',
-
 
171
    'verifone'              => ',ForceProjectBase=/DPG_SWCode/products/verifone,',
-
 
172
    'dm_devcdfile'          => 'AllowMultiPath',
-
 
173
    'daf_ct_mcr_unified'    => 'AllowMultiPath',
-
 
174
    'cst-rms-db'            => 'AllowMultiPath',
-
 
175
    'daf_common'            => 'IgnoreProjectBase',
-
 
176
    'devcd'                 => 'AllowMultiPath',
-
 
177
    'daf_dll'                   => 'AllowMultiPath,IgnoreMakeProject',  # MakeProject not in used makefile
-
 
178
    'daf_transap_proxyman_edf'  => 'AllowMultiPath,IgnoreProjectBase',
-
 
179
    'devrelease'                => 'AllowMultiPath',
-
 
180
 
-
 
181
    'dm_devrelease'             => 'AllowMultiPath',
-
 
182
    'dm_rtswis'                 => 'AllowMultiPath',
-
 
183
    'dm_devcd'                  => 'AllowMultiPath',
-
 
184
    'dm_documentation'          => 'AllowMultiPath,IgnoreBadPath',
-
 
185
    'dm_eventhdr'               => 'AllowMultiPath',
-
 
186
    'dm_javaenums'              => 'AllowMultiPath',
-
 
187
    'dm_solidbasetypes'         => 'AllowMultiPath',
-
 
188
    'dm_swismetadata'           => 'AllowMultiPath',
-
 
189
    'dm_cuttables'              => 'AllowMultiPath',
-
 
190
    'dm_devudapi'               => 'AllowMultiPath',
-
 
191
    'buscdapi'                  => 'AllowMultiPath',
-
 
192
    'daf_bvt'                   => 'AllowMultiPath,IgnoreMakeProject,',  # Look OK
-
 
193
    'daf_cd_transap'            => 'AllowMultiPath,IgnoreBadPath,IgnoreProjectBase',
-
 
194
    'cdref'                     => 'AllowMultiPath',
-
 
195
    'dm_sysbasetypes'           => 'AllowMultiPath',
-
 
196
    'dm_sysswis'                => 'AllowMultiPath',
-
 
197
    'dm_syscd'                  => 'AllowMultiPath',
-
 
198
    'dm_udtypes'                => 'AllowMultiPath',
-
 
199
    'dm_systemcdtables'         => 'AllowMultiPath',
-
 
200
    'dm_utils'                  => 'AllowMultiPath',
-
 
201
    'dm_udxml'                  => 'AllowMultiPath',
-
 
202
    'HCP5000_resources'         => 'AllowMultiPath',
-
 
203
    'massrtswis'                => 'AllowMultiPath',
-
 
204
    'pcp5000'                   => 'AllowMultiPath,ForceProjectBase=/DPG_SWCode',
-
 
205
    'PFTPi'                     => 'AllowMultiPath,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode',  # Looks OK
-
 
206
    'PFTPu'                     => 'AllowMultiPath,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode',  # Looks OK
-
 
207
    'WinCEBlocker'              => ',IgnoreMakeProject,',  # Looks OK
-
 
208
    'WinCEDeviceAutoInject'     => ',IgnoreMakeProject,',  # Looks OK
-
 
209
    'WinCEReboot'               => ',IgnoreMakeProject,',  # Looks OK
-
 
210
    'rsmaint'                   => 'AllowMultiPath',
-
 
211
    'sysbasetypes'              => 'AllowMultiPath',
-
 
212
    'syscd'                     => 'AllowMultiPath',
-
 
213
    'sysswis'                   => 'AllowMultiPath',
-
 
214
    'udserialiser'              => 'AllowMultiPath',
-
 
215
    'systemcdtables'            => 'AllowMultiPath',
-
 
216
    'udxml'                     => 'AllowMultiPath',
-
 
217
    'ERGoracs'                  => 'AllowMultiPath',
-
 
218
    'daf_cd_desfireparams'      => 'AllowMultiPath',
-
 
219
    'daf_ct_mag_virtual'        => 'AllowMultiPath',
-
 
220
    'daf_br_applets'            => 'AllowMultiPath',
-
 
221
    'daf_paper_variables'       => 'AllowMultiPath',
-
 
222
    'daf_transap_api'           => 'AllowMultiPath,ForceProjectBase=/DPG_SWBase/transap',
-
 
223
    'daf_br_applets'            => 'AllowMultiPath,IgnoreProjectBase',  # Not used
-
 
224
    'daf_udlib_api'             => 'AllowMultiPath,ForceProjectBase=/DPG_SWBase/ud',
-
 
225
    'daf_ct_mcr_14443'          => 'LimitProjectBase=/DPG_SWBase/ct',
-
 
226
 
-
 
227
 
-
 
228
    'daftestcd_sales'               => 'AllowMultiPath,ForceProjectBase=/ProjectCD/seattle',
-
 
229
    'daftestcd_vanpool'             => 'AllowMultiPath,ForceProjectBase=/ProjectCD',
-
 
230
    'daf_transap_edf'               => 'AllowMultiPath,IgnoreProjectBase',
-
 
231
    'daf_transap_extensions'        => 'AllowMultiPath',
-
 
232
    'daf_transap_proxyman_rkf_mag'  => 'AllowMultiPath',
-
 
233
    'daf_utils_appupgrade'          => 'AllowMultiPath',
-
 
234
    'dc5000'                        => 'AllowMultiPath,IgnoreMakeProject,ForceProjectBase=/DPG_SWCode',
-
 
235
    'uiconv'                        => 'AllowMultiPath',
-
 
236
 
-
 
237
    'daf_ct_api'                    => 'AllowMultiPath',
-
 
238
    
-
 
239
 
-
 
240
    'ocpsupport'                    => 'AllowMultiPath,IgnoreMakeProject', # MakeProject Tested on at least one
-
 
241
    'emv_cs_test_ingenico'          => 'AllowMultiPath,IgnoreMakeProject', # MakeProject Tested on at least one
-
 
242
    'deviceicons'                   => 'AllowMultiPath,LimitProjectBase=/DPG_SWBase/resources:/DPG_SWCode/resources',
-
 
243
    'pcv_final_wce'                 => 'IgnoreMakeProject', # MakeProject Tested on at least one
-
 
244
    'pcv_wce'                       => 'IgnoreMakeProject', # MakeProject Tested on at least one
-
 
245
    'WinCEDeviceUpgrade'            => 'IgnoreMakeProject', # MakeProject Tested on at least one
-
 
246
    'scil'                          => 'LimitProjectBase=/DPG_SWCode/projects/seattle/tvm',
-
 
247
    'daf_br_compiler_support'       => 'ForceProjectBase=/DPG_SWBase/daf_br_compiler/support',
-
 
248
    'daf_br_th'                     => 'IgnoreBadPath,all,IgnoreMakeProject', # MakeProject Tested. Bad Paths not used
-
 
249
    'linux_kernel_bcp4600'          => 'ForceProjectBase=/LMOS/linux/kernel',
-
 
250
    'linux_kernel_viper'            => 'ForceProjectBase=/LMOS/linux/kernel',
-
 
251
    'linux_kernel_cobra'            => 'ForceProjectBase=/LMOS/linux/kernel',
161
 
252
 
162
    'ftp'                   => 'SetProjectBase,',
-
 
163
    'ddu_app_manager'       => 'SetProjectBase,',
-
 
164
 
253
 
165
    'icl'                   => 'IgnoreProjectBase,',
254
    'icl'                   => 'IgnoreProjectBase,',
166
    'itso'                  => 'IgnoreProjectBase,',
255
    'itso'                  => 'IgnoreProjectBase,',
167
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
256
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
168
    'daf_utils_mos'         => 'IgnoreProjectBase,',
257
    'daf_utils_mos'         => 'IgnoreProjectBase,',
Line 251... Line 340...
251
my $processCount = 0;
340
my $processCount = 0;
252
my $processTotal = 0;
341
my $processTotal = 0;
253
my $recentCount = 0;
342
my $recentCount = 0;
254
my $packageReLabelCount = 0;
343
my $packageReLabelCount = 0;
255
my %saneLabels;
344
my %saneLabels;
-
 
345
my $adjustedPath = 0;
-
 
346
my $forceImportFlush = 0;
-
 
347
my %restoreData;
256
 
348
 
257
our $GBE_RM_URL;
349
our $GBE_RM_URL;
258
my $UNIX = $ENV{'GBE_UNIX'};
350
my $UNIX = $ENV{'GBE_UNIX'};
259
 
351
 
260
my $result = GetOptions (
352
my $result = GetOptions (
261
                "help+"         => \$opt_help,          # flag, multiple use allowed
353
                "help+"             => \$opt_help,          # flag, multiple use allowed
262
                "manual:3"      => \$opt_help,
354
                "manual:3"          => \$opt_help,
263
                "verbose:+"     => \$opt_verbose,       # Versose
355
                "verbose:+"         => \$opt_verbose,       # Versose
264
                "repository:s"  => \$opt_repo,          # Name of repository
356
                "repository:s"      => \$opt_repo,          # Name of repository
265
                'rbase:s'       => \$opt_repo_base,     # Base of the repo
357
                'rbase:s'           => \$opt_repo_base,     # Base of the repo
266
                "flat!"         => \$opt_flat,          # Flat structure
358
                "flat!"             => \$opt_flat,          # Flat structure
267
                "test!"         => \$opt_test,          # Test operations
359
                "test!"             => \$opt_test,          # Test operations
268
                "reuse!"        => \$opt_reuse,         # Reuse ClearCase views
360
                "reuse!"            => \$opt_reuse,         # Reuse ClearCase views
269
                "age:i"         => \$opt_age,           # Only recent versions
361
                "age:i"             => \$opt_age,           # Only recent versions
270
                "dump:1"        => \$opt_dump,          # Dump Data
362
                "dump:1"            => \$opt_dump,          # Dump Data
271
                "images:1"      => \$opt_images,        # Create DOT images
363
                "images:1"          => \$opt_images,        # Create DOT images
272
                "retain:i"      => \$opt_retaincount,   # Retain N packages
364
                "retain:i"          => \$opt_retaincount,   # Retain N packages
273
                "pruneMode:s"   => \$opt_pruneModeString,
365
                "pruneMode:s"       => \$opt_pruneModeString,
274
                "listtags:i"    => \$opt_listTags,
366
                "listtags:i"        => \$opt_listTags,
275
                "name:s"        => \$opt_name,          # Alternate output
367
                "name:s"            => \$opt_name,          # Alternate output
276
                "tip:s"         => \@opt_tip,           # Force tip version(s)
368
                "tip:s"             => \@opt_tip,           # Force tip version(s)
277
                "log!"          => \$opt_log,
369
                "log!"              => \$opt_log,
278
                "delete!"       => \$opt_delete,
370
                "delete!"           => \$opt_delete,
279
                "postimage!"    => \$opt_postimage,
371
                "postimage!"        => \$opt_postimage,
280
                'workdir:s'     => \$opt_workDir,
372
                'workdir:s'         => \$opt_workDir,
281
                'relabel!'      => \$opt_relabel,
373
                'relabel!'          => \$opt_relabel,
282
                'svn!'          => \$opt_useSvn,
374
                'svn!'              => \$opt_useSvn,
283
                'testRmDatabase'    => \$opt_testRmDatabase,
375
                'testRmDatabase'    => \$opt_testRmDatabase,
-
 
376
                'fromSvn!'          => \$opt_extractFromSvn,
-
 
377
                'resume'            => \$opt_resume,
284
                );
378
                );
285
 
379
 
286
#
380
#
287
#   Process help and manual options
381
#   Process help and manual options
288
#
382
#
Line 380... Line 474...
380
smartPackageType();                 # Determine special prune mode
474
smartPackageType();                 # Determine special prune mode
381
ReportPathVariance();
475
ReportPathVariance();
382
massageData();
476
massageData();
383
getSvnData();
477
getSvnData();
384
smartPackageType();                 # Have another go
478
smartPackageType();                 # Have another go
-
 
479
restoreData() if ( $opt_resume );
385
 
480
 
386
my @missedTips = keys %tipVersions;
481
my @missedTips = keys %tipVersions;
387
Error ("Specified tip version not found: @missedTips") if ( @missedTips );
482
Error ("Specified tip version not found: @missedTips") if ( @missedTips );
388
 
483
 
389
if ( $opt_flat )
484
if ( $opt_flat )
Line 625... Line 720...
625
      $opt_flat = 1 unless defined $opt_flat;
720
      $opt_flat = 1 unless defined $opt_flat;
626
    }
721
    }
627
 
722
 
628
    if ( exists $specialPackages{$packageNames[0]} )
723
    if ( exists $specialPackages{$packageNames[0]} )
629
    {
724
    {
630
        my $data = $specialPackages{$packageNames[0]};
725
        my $data = ',' . $specialPackages{$packageNames[0]} . ',';
-
 
726
 
631
        if ( index( $data, ',all' ) >= 0) {
727
        if ( index( $data, ',all' ) >= 0) {
632
            setPruneMode('none') unless (defined $opt_pruneModeString);
728
            setPruneMode('none') unless (defined $opt_pruneModeString);
633
        }
729
        }
634
        
730
        
635
        if ( index( $data, 'protected,' ) >= 0) {
731
        if ( index( $data, 'protected,' ) >= 0) {
Line 644... Line 740...
644
            $opt_preserveProjectBase = 1;
740
            $opt_preserveProjectBase = 1;
645
            $opt_ignoreProjectBaseErrors = 1;
741
            $opt_ignoreProjectBaseErrors = 1;
646
            Message ("Preserving ProjectBase");
742
            Message ("Preserving ProjectBase");
647
        }
743
        }
648
 
744
 
-
 
745
        if ( index( $data, 'AllowMultiPath,' ) >= 0) {
-
 
746
            $opt_AllowMuliplePaths = 1;
-
 
747
            Message ("Allowing Multiple Paths");
-
 
748
        }
-
 
749
 
-
 
750
        if ( $data =~ m~,ForceProjectBase=(.*?),~ ) {
-
 
751
            $opt_forceProjectBase = $1;
-
 
752
            $opt_AllowMuliplePaths = 1;
-
 
753
            Message ("Force Project Base: $opt_forceProjectBase");
-
 
754
        }
-
 
755
 
-
 
756
        if ( $data =~ m~,LimitProjectBase=(.*),~ ) {
-
 
757
            $opt_AllowMuliplePaths = 1;
-
 
758
            @opt_limitProjectBase = split(':', $1);
-
 
759
            Message ("Limit Project Base: @opt_limitProjectBase");
-
 
760
        }
-
 
761
        
-
 
762
 
649
        if ( index( $data, 'IgnoreProjectBase,' ) >= 0) {
763
        if ( index( $data, 'IgnoreProjectBase,' ) >= 0) {
650
            $opt_ignoreProjectBaseErrors = 1;
764
            $opt_ignoreProjectBaseErrors = 1;
651
            Message ("Ignore ProjectBase Errors");
765
            Message ("Ignore ProjectBase Errors");
652
        }
766
        }
653
 
767
 
654
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
768
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
655
            $opt_ignoreMakeProjectErrors = 1;
769
            $opt_ignoreMakeProjectErrors = 1;
656
            Message ("Ignore MakeProject Usage");
770
            Message ("Ignore MakeProject Usage");
657
        }
771
        }
658
        
-
 
659
 
772
 
-
 
773
        if ( index( $data, 'IgnoreBadPath,' ) >= 0) {
-
 
774
            $opt_ignoreBadPaths = 1;
-
 
775
            Message ("Ignore Bad Paths in makefile Usage");
-
 
776
        }
-
 
777
        
660
        if ( index( $data, 'utf8,' ) >= 0) {
778
        if ( index( $data, 'utf8,' ) >= 0) {
661
            $mustConvertFileNames = 1;
779
            $mustConvertFileNames = 1;
662
            Message ("Convert filenames to UTF8");
780
            Message ("Convert filenames to UTF8");
663
        }
781
        }
664
    }
782
    }
Line 968... Line 1086...
968
        }
1086
        }
969
    }
1087
    }
970
    
1088
    
971
    #
1089
    #
972
    #   Prune
1090
    #   Prune
973
    #   Marks paths to root for all essential packages
1091
    #       Marks paths to root for all essential packages
974
    #   Marks the last-N from all essential packages
1092
    #       Marks the last-N from all essential packages
975
    #
1093
    #
976
    if ( $pruneMode )
1094
    if ( $pruneMode )
977
    {
1095
    {
978
        Message ("Prune Tree: $pruneModeString");
1096
        Message ("Prune Tree: $pruneModeString");
979
        foreach ( @EssentialPackages )
1097
        foreach ( @EssentialPackages )
Line 999... Line 1117...
999
        #
1117
        #
1000
        #   Keep recent versions
1118
        #   Keep recent versions
1001
        #       Keep versions created in the last N days
1119
        #       Keep versions created in the last N days
1002
        #       Will keep recent ripples too
1120
        #       Will keep recent ripples too
1003
        #
1121
        #
1004
        if ( $pruneMode == 1 )
1122
        if ( $pruneMode == 1 )                      # 1 == ripple
1005
        {
1123
        {
1006
            foreach my $entry ( keys(%versions) )
1124
            foreach my $entry ( keys(%versions) )
1007
            {
1125
            {
1008
                next unless ( $versions{$entry}{Age} <= $opt_recentAge  );
1126
                next unless ( $versions{$entry}{Age} <= $opt_recentAge  );
1009
                $versions{$entry}{keepRecent} = 1;
1127
                $versions{$entry}{keepRecent} = 1;
1010
                $recentCount++;
1128
                $recentCount++;
1011
#print "--- Recent version $versions{$entry}{vname}, $versions{$entry}{Age} <= $opt_recentAge\n";
1129
#print "--- Recent version $versions{$entry}{vname}, $versions{$entry}{Age} <= $opt_recentAge\n";
1012
            }
1130
            }
1013
 
1131
 
1014
#            #
1132
            #
1015
#            #   Keep the tip of each branch
1133
            #   Keep the tip of each branch
1016
#            #
1134
            #
1017
#            foreach my $entry ( @endPoints )
1135
            foreach my $entry ( @endPoints )
1018
#            {
1136
            {
-
 
1137
#print "--- Tip version $versions{$entry}{vname}\n";
-
 
1138
                my $count = 0;
-
 
1139
                while ( $entry && $count < 2)
-
 
1140
                {
1019
#                next if exists $versions{$entry}{keepRecent};
1141
                    last if ( $versions{$entry}{Essential} );
1020
#                $versions{$entry}{keepRecent} = 1;
1142
                    last if ( $versions{$entry}{keepRecent} );
-
 
1143
 
-
 
1144
                    next if ( $versions{$entry}{locked} eq 'N'  );
-
 
1145
                    next if ( $versions{$entry}{DeadWood} );
-
 
1146
 
1021
##print "--- Tip version $versions{$entry}{vname}\n";
1147
#print "--- Keeping Tip version $versions{$entry}{vname}\n";
-
 
1148
                    $versions{$entry}{keepRecent} = 1;
-
 
1149
                    $count++;
-
 
1150
 
-
 
1151
                } continue {
-
 
1152
                    $entry = $versions{$entry}{last};
-
 
1153
                }
1022
#            }
1154
            }
1023
        }
1155
        }
1024
        
1156
        
1025
        #
1157
        #
1026
        #   Keep versions that are common parents to Essential Versions
1158
        #   Keep versions that are common parents to Essential Versions
1027
        #       Mark paths through the tree to essential versions
1159
        #       Mark paths through the tree to essential versions
Line 1093... Line 1225...
1093
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
1225
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
1094
            return 0 if ( exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
1226
            return 0 if ( exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
1095
            return 1;
1227
            return 1;
1096
        }
1228
        }
1097
 
1229
 
-
 
1230
 
-
 
1231
        #
-
 
1232
        #   Determine a list of entries to be pruned
-
 
1233
        #   Done in two steps so that we can skip the pruning if its only a small number
-
 
1234
        #
-
 
1235
        my @pruneList;
1098
        foreach my $entry ( keys(%versions) )
1236
        foreach my $entry ( keys(%versions) )
1099
        {
1237
        {
-
 
1238
            push ( @pruneList, $entry ) if ( pruneMe($entry) );
-
 
1239
        }
-
 
1240
 
-
 
1241
 
-
 
1242
        #
-
 
1243
        #   If the list is very small then just import all of them
1100
#last;
1244
        #
-
 
1245
        if ( scalar @pruneList < 10 )
-
 
1246
        {
-
 
1247
            Message ("Retaining pruned entries - low count:" . scalar @pruneList );
-
 
1248
            @pruneList = ();
-
 
1249
        } else {
-
 
1250
            my $total = scalar keys %versions;
-
 
1251
 
-
 
1252
            if ( scalar @pruneList < ($total / 15))
-
 
1253
            {
-
 
1254
                Message ("Retaining pruned entries - low percentage of $total:" . scalar @pruneList );
1101
            next unless ( pruneMe($entry) );
1255
                @pruneList = ();
-
 
1256
            }
-
 
1257
        }
-
 
1258
        
-
 
1259
 
-
 
1260
        foreach my $entry (@pruneList )
-
 
1261
        {
1102
#print "--- Prune: $versions{$entry}{vname}\n";
1262
#print "--- Prune: $versions{$entry}{vname}\n";
1103
 
1263
 
1104
            # Delete the current node
1264
            # Delete the current node
1105
            #
1265
            #
1106
            my @newNext;
1266
            my @newNext;
Line 1596... Line 1756...
1596
    logToFile( $cwd . '/importsummary.txt', ";$line;");
1756
    logToFile( $cwd . '/importsummary.txt', ";$line;");
1597
 
1757
 
1598
    #
1758
    #
1599
    #   Sava data
1759
    #   Sava data
1600
    #
1760
    #
-
 
1761
    if ( $rv != 6 )
-
 
1762
    {
1601
    $data{errFlags} = $flags;
1763
        $data{errFlags} = $flags;
1602
    $data{duration} = $duration;
1764
        $data{duration} = $duration;
-
 
1765
    }
1603
    $versions{$entry}{rmRef} = $data{rmRef};
1766
    $versions{$entry}{rmRef} = $data{rmRef};
1604
    delete $data{rmRef};
1767
    delete $data{rmRef};
1605
    delete $data{tag};
1768
    delete $data{tag};
1606
    ##delete $data{ViewRoot};
1769
    ##delete $data{ViewRoot};
1607
    $versions{$entry}{data} = \%data;
1770
    $versions{$entry}{data} = \%data;
Line 1671... Line 1834...
1671
#                                   No Files in the extracted view after labeling dirs
1834
#                                   No Files in the extracted view after labeling dirs
1672
#                               3 - Deadwood
1835
#                               3 - Deadwood
1673
#                               4 - Bad usage of ProjectBase detected
1836
#                               4 - Bad usage of ProjectBase detected
1674
#                                   Use of MakeProject detected
1837
#                                   Use of MakeProject detected
1675
#                               5  - Subversion Import disabled
1838
#                               5  - Subversion Import disabled
-
 
1839
#                               6  - Restored via resume
1676
#                       >10 - Fatal error
1840
#                       >10 - Fatal error
1677
#
1841
#
1678
sub newPackageVersionBody
1842
sub newPackageVersionBody
1679
{
1843
{
1680
    my ($data, $entry) = @_;
1844
    my ($data, $entry) = @_;
1681
    my $rv;
1845
    my $rv;
-
 
1846
    my $vcs_type;
1682
    my $cc_label;
1847
    my $cc_label;
1683
    my $cc_path;
1848
    my $cc_path;
1684
    my $cc_path_original;
1849
    my $cc_path_original;
1685
 
1850
 
1686
    #
1851
    #
Line 1697... Line 1862...
1697
    SystemConfig ('ExitOnError' => 0);
1862
    SystemConfig ('ExitOnError' => 0);
1698
 
1863
 
1699
    push @processOrder, $entry;
1864
    push @processOrder, $entry;
1700
    return 0 if ( $opt_test );
1865
    return 0 if ( $opt_test );
1701
 
1866
 
-
 
1867
    #
-
 
1868
    #   Calculate the label for the target package
-
 
1869
    #   Use format <packageName>_<PackageVersion>
-
 
1870
    #   Need to handle WIPs too.
-
 
1871
    #
-
 
1872
    my $import_label = saneLabel($entry);
-
 
1873
 
-
 
1874
    #
-
 
1875
    #   If resuming - then test existence
-
 
1876
    #
-
 
1877
    if ( $opt_resume )
-
 
1878
    {
-
 
1879
        if ( exists $restoreData{$entry}  )
-
 
1880
        {
-
 
1881
 
-
 
1882
            #
-
 
1883
            #   May be able to test existence by looking at $versions{$entry}{svnVersion}
-
 
1884
            #   The hard work may have been done
-
 
1885
            #
-
 
1886
            my $isInSvn = 0;
-
 
1887
            if ( exists $versions{$entry}{svnVersion} && $versions{$entry}{svnVersion}  )
-
 
1888
            {
-
 
1889
                $isInSvn = 1;
-
 
1890
            }
-
 
1891
            Message("SvnVersion check: $isInSvn");
-
 
1892
 
-
 
1893
            $rv = testSvnLabel( "$svnRepo/$packageNames", $import_label );
-
 
1894
            unless ( $rv )
-
 
1895
            {
-
 
1896
                Message ("Skip import - resume detected presense");
-
 
1897
                $firstVersionCreated = $entry unless ( $firstVersionCreated );
-
 
1898
                $versions{$entry}{TagCreated} = 2;
-
 
1899
                foreach  ( keys %{$restoreData{$entry}} )
-
 
1900
                {
-
 
1901
                    $data->{$_} = $restoreData{$entry}{$_};
-
 
1902
                }
-
 
1903
                $forceImportFlush = 1;
-
 
1904
DebugDumpData('Data', $data );
-
 
1905
                return 6;
-
 
1906
            }
-
 
1907
        }
-
 
1908
        else
-
 
1909
        {
-
 
1910
            Warning ("Resume data missing");
-
 
1911
        }
-
 
1912
    }
-
 
1913
    
1702
#   Keep DeadWood. May be a WIP
1914
#   Keep DeadWood. May be a WIP
1703
#    if ( exists $versions{$entry}{DeadWood} && $versions{$entry}{DeadWood} )
1915
#    if ( exists $versions{$entry}{DeadWood} && $versions{$entry}{DeadWood} )
1704
#    {
1916
#    {
1705
#        $data->{errStr} = 'Package is DeadWood';
1917
#        $data->{errStr} = 'Package is DeadWood';
1706
#        return 3;
1918
#        return 3;
Line 1714... Line 1926...
1714
    {
1926
    {
1715
        Warning ("Error: Bad VcsTag for: " . GetVname($entry),
1927
        Warning ("Error: Bad VcsTag for: " . GetVname($entry),
1716
                 "Tag: $data->{tag}" );
1928
                 "Tag: $data->{tag}" );
1717
        $data->{errStr} = 'VCS Tag Marked as Bad';
1929
        $data->{errStr} = 'VCS Tag Marked as Bad';
1718
        return 1;
1930
        return 1;
-
 
1931
 
1719
    }
1932
    }
1720
 
1933
 
1721
 
1934
 
1722
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
1935
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
-
 
1936
    $vcs_type = $1;
1723
    $cc_label = $4;
1937
    $cc_label = $4;
1724
    $cc_path = $2;
1938
    $cc_path = $2;
1725
    $cc_path = '/' . $cc_path;
1939
    $cc_path = '/' . $cc_path;
1726
    $cc_path =~ tr~\\/~/~s;
1940
    $cc_path =~ tr~\\/~/~s;
1727
    $cc_path_original = $cc_path;
1941
    $cc_path_original = $cc_path;
1728
 
1942
 
1729
    #
1943
    #
1730
    #   Correct well known path mistakes
1944
    #   Correct well known path mistakes in CC paths
1731
    #
1945
    #
1732
    $cc_path =~ s~/build.pl$~~i;
-
 
1733
    $cc_path =~ s~/src$~~i;
-
 
1734
    $cc_path =~ s~/cpp$~~i;
-
 
1735
    $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1736
    $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1737
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1738
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1739
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1740
    $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1741
    $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1742
    $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1743
    $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1744
    $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1745
    $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1746
 
-
 
1747
    $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1748
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1749
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1750
    $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1751
    $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1752
 
-
 
1753
    if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1754
        || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1755
        || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1756
        || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1757
        || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1758
        || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1759
        || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1760
        || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1761
        || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1762
        || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1763
        || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1764
        || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1765
        || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1766
        || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1767
        || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1768
        || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1769
        || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1770
        || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1771
        || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1772
        || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1773
        || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1774
        || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1775
        || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1776
        || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1777
        || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1778
        || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1779
        || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1780
        || $versions{$entry}{name} =~ m/^ERGfinman$/i
-
 
1781
        || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1782
        || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1783
        || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1784
        || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1785
        )
-
 
1786
    {
-
 
1787
        $cc_path = '/MREF_Package';
1946
    if ( $vcs_type eq 'CC' )
1788
    }
-
 
1789
 
-
 
1790
    if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1791
    {
1947
    {
-
 
1948
        $cc_path =~ s~/build.pl$~~i;
-
 
1949
        $cc_path =~ s~/src$~~i;
-
 
1950
        $cc_path =~ s~/cpp$~~i;
-
 
1951
        $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1952
        $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1953
        $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1954
        $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1955
        $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1956
        $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1957
        $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1958
        $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1959
        $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1960
        $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1961
        $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1962
 
-
 
1963
        $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1964
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1965
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1966
        $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1967
        $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1968
 
-
 
1969
        if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1970
            || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1971
            || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1972
            || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1973
            || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1974
            || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1975
            || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1976
            || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1977
            || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1978
            || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1979
            || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1980
            || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1981
            || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1982
            || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1983
            || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1984
            || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1985
            || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1986
            || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1987
            || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1988
            || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1989
            || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1990
            || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1991
            || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1992
            || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1993
            || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1994
            || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1995
            || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1996
            || $versions{$entry}{name} =~ m/^ERGfinman$/i
1792
        if ( $versions{$entry}{version} =~ m~vtk$~ )
1997
            || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1998
            || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1999
            || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
2000
            || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
2001
            )
1793
        {
2002
        {
1794
            $cc_path = '/MREF_Package';
2003
            $cc_path = '/MREF_Package';
1795
        }
2004
        }
1796
    }
-
 
1797
 
2005
 
-
 
2006
        if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
2007
        {
-
 
2008
            if ( $versions{$entry}{version} =~ m~vtk$~ )
-
 
2009
            {
-
 
2010
                $cc_path = '/MREF_Package';
-
 
2011
            }
-
 
2012
        }
-
 
2013
 
-
 
2014
        $cc_path = $opt_forceProjectBase
-
 
2015
            if ( $opt_forceProjectBase );
-
 
2016
 
-
 
2017
        foreach ( @opt_limitProjectBase )
-
 
2018
        {
-
 
2019
            if ( $cc_path =~ m~$_~ )
-
 
2020
            {
-
 
2021
                $cc_path = $_;
-
 
2022
                last;
-
 
2023
            }
-
 
2024
        }
-
 
2025
        
1798
    if ( $cc_path_original ne $cc_path )
2026
        if ( $cc_path_original ne $cc_path )
1799
    {
2027
        {
1800
            Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
2028
                Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
-
 
2029
        }
1801
    }
2030
    }
1802
    
2031
    
1803
#print "--- Path: $cc_path, Label: $cc_label\n";
2032
#print "--- Path: $cc_path, Label: $cc_label\n";
1804
 
2033
 
-
 
2034
    if ( $vcs_type eq 'SVN' )
1805
    #
2035
    {
-
 
2036
        $rv = extractFilesFromSubversion( $data, $entry );
-
 
2037
        return $rv if ( $rv );
-
 
2038
    }
-
 
2039
    else
-
 
2040
    {
-
 
2041
        #
1806
    #   Create CC view
2042
        #   Create CC view
1807
    #   Import into Subversion View
2043
        #   Import into Subversion View
1808
    #
2044
        #
1809
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
2045
        $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1810
    return $rv if ( $rv );
2046
        return $rv if ( $rv );
-
 
2047
    }
1811
 
2048
 
1812
    #
2049
    #
1813
    #   Developers have been slack
2050
    #   Developers have been slack
1814
    #       Sometime the mark the source path as 'GMTPE2005'
2051
    #       Sometime the mark the source path as 'GMTPE2005'
1815
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
2052
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1816
    #
2053
    #
1817
    #   Attempt to suck up empty directories below the specified
2054
    #   Attempt to suck up empty directories below the specified
1818
    #   source path
2055
    #   source path
1819
    #
2056
    #
1820
    unless ( $opt_preserveProjectBase )
2057
    unless ( $opt_preserveProjectBase || $opt_forceProjectBase || @opt_limitProjectBase)
1821
    {
2058
    {
1822
        #
2059
        #
1823
        #   Look in ViewPath
2060
        #   Look in ViewPath
1824
        #   If it contains only ONE directory then we can suck it up
2061
        #   If it contains only ONE directory then we can suck it up
1825
        #
2062
        #
Line 1828... Line 2065...
1828
        unless ( $data->{ViewPath} eq $testDir  )
2065
        unless ( $data->{ViewPath} eq $testDir  )
1829
        {
2066
        {
1830
            Message ("Adjust Base Dir: $testDir");
2067
            Message ("Adjust Base Dir: $testDir");
1831
            $data->{adjustedPath} = $data->{ViewPath};
2068
            $data->{adjustedPath} = $data->{ViewPath};
1832
            $data->{ViewPath} = $testDir;
2069
            $data->{ViewPath} = $testDir;
-
 
2070
            $adjustedPath++;
1833
        }
2071
        }
1834
    }
2072
    }
1835
    Message ("BaseDir: $data->{ViewPath}");
2073
    Message ("BaseDir: $data->{ViewPath}");
-
 
2074
 
1836
    
2075
    #
-
 
2076
    #   Check for bad source paths
-
 
2077
    #
-
 
2078
    if (detectBadMakePaths($data) )
-
 
2079
    {
-
 
2080
        unless ( $opt_ignoreBadPaths )
-
 
2081
        {
-
 
2082
            $data->{BadPath}++;
-
 
2083
            $data->{errStr} = 'Bad Paths in Makefile';
-
 
2084
            return 4;           # Lets see what the others look like too
-
 
2085
#            return 14;
-
 
2086
        }
-
 
2087
    }
-
 
2088
 
1837
    #
2089
    #
1838
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
2090
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1839
    #   Detect such packages as we will need to handle them differently
2091
    #   Detect such packages as we will need to handle them differently
1840
    #   Can't really handle it on the fly
2092
    #   Can't really handle it on the fly
1841
    #   All we can do is detect it and report it - at the moment
2093
    #   All we can do is detect it and report it - at the moment
Line 1844... Line 2096...
1844
    {
2096
    {
1845
        unless ( $opt_ignoreProjectBaseErrors )
2097
        unless ( $opt_ignoreProjectBaseErrors )
1846
        {
2098
        {
1847
            $data->{BadProjectBase}++;
2099
            $data->{BadProjectBase}++;
1848
            $data->{errStr} = 'Bad usage of ProjectBase detected';
2100
            $data->{errStr} = 'Bad usage of ProjectBase detected';
-
 
2101
            Warning ("ProjectBase Error");
1849
            return 4;           # Lets see what the others look like too
2102
            return 4;           # Lets see what the others look like too
1850
#            return 14;
2103
#            return 14;
1851
        }
2104
        }
1852
    }
2105
    }
1853
 
2106
 
Line 1860... Line 2113...
1860
    #       Vob Name is not a part of the migration
2113
    #       Vob Name is not a part of the migration
1861
    #       If we 'SuckUp' empty directories then this may break
2114
    #       If we 'SuckUp' empty directories then this may break
1862
    #       the pathing.
2115
    #       the pathing.
1863
    #   All we can do is detect it and report it - at the moment
2116
    #   All we can do is detect it and report it - at the moment
1864
    #
2117
    #
1865
    if (detectMakeProjectUsage($data, $cc_path) )
2118
    if (detectMakeProjectUsage($data) )
1866
    {
2119
    {
1867
        unless ( $opt_ignoreMakeProjectErrors )
2120
        unless ( $opt_ignoreMakeProjectErrors )
1868
        {
2121
        {
1869
            $data->{BadMakeProject}++;
2122
            $data->{BadMakeProject}++;
1870
            $data->{errStr} = 'Use of MakeProject detected';
2123
            $data->{errStr} = 'Use of MakeProject detected';
Line 1908... Line 2161...
1908
    #   Now we can create the SVN package and branching point before we
2161
    #   Now we can create the SVN package and branching point before we
1909
    #   import the CC data into SVN
2162
    #   import the CC data into SVN
1910
    #
2163
    #
1911
    if ( !$opt_useSvn )
2164
    if ( !$opt_useSvn )
1912
    {
2165
    {
1913
            $data->{errStr} = 'Subversion Import disabled';
2166
            $data->{errStr} = 'Subversion Import disabled' unless $data->{errStr};
1914
            return 5;
2167
            return 5;
1915
    }
2168
    }
1916
 
2169
 
1917
    my @args;
2170
    my @args;
1918
 
2171
 
Line 1947... Line 2200...
1947
        $data->{errStr} = 'Failed to create Package';
2200
        $data->{errStr} = 'Failed to create Package';
1948
        return 10;
2201
        return 10;
1949
    }
2202
    }
1950
 
2203
 
1951
    #
2204
    #
1952
    #   Calculate the label for the target package
-
 
1953
    #   Use format <packageName>_<PackageVersion>
-
 
1954
    #   Need to handle WIPs too.
-
 
1955
    #
-
 
1956
    my $import_label = saneLabel($entry);
-
 
1957
 
-
 
1958
    #
-
 
1959
    #   May need to create the branchpoint
2205
    #   May need to create the branchpoint
1960
    #   The process is delayed until its needed so avoid creating unneeded
2206
    #   The process is delayed until its needed so avoid creating unneeded
1961
    #   branch points
2207
    #   branch points
1962
    #
2208
    #
1963
    if ( $createBranch )
2209
    if ( $createBranch )
Line 1969... Line 2215...
1969
        {
2215
        {
1970
            $data->{errStr} = 'Failed to create Branch Point';
2216
            $data->{errStr} = 'Failed to create Branch Point';
1971
            return 11;
2217
            return 11;
1972
        }
2218
        }
1973
    }
2219
    }
1974
    push @args, "-branch=$currentBranchName" if ( defined $currentBranchName );
-
 
1975
 
2220
 
-
 
2221
    #
-
 
2222
    #   If we are in resume mode then we MUST kill the import directory
-
 
2223
    #   if we have skipped anything
-
 
2224
    #
-
 
2225
    if ( $forceImportFlush )
-
 
2226
    {
-
 
2227
        $forceImportFlush = 0;
-
 
2228
        RmDirTree ('SvnImportDir');
-
 
2229
    }
-
 
2230
 
-
 
2231
    push @args, "-branch=$currentBranchName" if ( defined $currentBranchName );
1976
    my $datafile = "importdata.$import_label.properties";
2232
    my $datafile = "importdata.$import_label.properties";
-
 
2233
 
1977
    $rv = JatsToolPrint ( 'jats_svn', 'import', '-reuse' ,
2234
    $rv = JatsToolPrint ( 'jats_svn', 'import', '-reuse' ,
1978
                    "-package=$svnRepo/$packageNames",
2235
                    "-package=$svnRepo/$packageNames",
1979
                    "-dir=$data->{ViewPath}",
2236
                    "-dir=$data->{ViewPath}",
1980
                    "-label=$import_label",
2237
                    "-label=$import_label",
1981
                    "-datafile=$datafile",
2238
                    "-datafile=$datafile",
Line 1996... Line 2253...
1996
    #   Retain entries in a global file
2253
    #   Retain entries in a global file
1997
    #
2254
    #
1998
    if ( -f $datafile  )
2255
    if ( -f $datafile  )
1999
    {
2256
    {
2000
        my $rmData = JatsProperties::New($datafile);
2257
        my $rmData = JatsProperties::New($datafile);
-
 
2258
        if ( $rmData->getProperty('subversion.tag') )
-
 
2259
        {
2001
        $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
2260
            $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
-
 
2261
        }
-
 
2262
        else
-
 
2263
        {
-
 
2264
            Warning ("Property files has no subversion.tag");
-
 
2265
        }
-
 
2266
        $data->{fileCount}    = $rmData->getProperty('files.base', 0);
-
 
2267
        $data->{filesRemoved} = $rmData->getProperty('files.removed',0);
-
 
2268
        $data->{filesAdded}   = $rmData->getProperty('files.added',0);
2002
    }
2269
    }
2003
 
2270
 
2004
    unless ( $data->{rmRef}  )
2271
    unless ( $data->{rmRef}  )
2005
    {
2272
    {
2006
        $data->{errStr} = 'Failed to determine Rm Reference';
2273
        $data->{errStr} = 'Failed to determine Rm Reference';
Line 2137... Line 2404...
2137
    push (@opts, '-author', $author) if ( $author );
2404
    push (@opts, '-author', $author) if ( $author );
2138
    #
2405
    #
2139
    #   Only do once
2406
    #   Only do once
2140
    #
2407
    #
2141
    return unless ( $createPackageDone );
2408
    return unless ( $createPackageDone );
-
 
2409
    return if ( $opt_resume );
2142
    $createPackageDone = 0;
2410
    $createPackageDone = 0;
2143
 
2411
 
2144
    #
2412
    #
2145
    #   Real import
2413
    #   Real import
2146
    #       Do not Delete package if it exists
2414
    #       Do not Delete package if it exists
Line 2302... Line 2570...
2302
    #
2570
    #
2303
    #   Perform the branch
2571
    #   Perform the branch
2304
    #
2572
    #
2305
    if ( defined $src_label )
2573
    if ( defined $src_label )
2306
    {
2574
    {
-
 
2575
        if ( $opt_resume )
-
 
2576
        {
-
 
2577
            my $rv = JatsToolPrint ( 'jats_svnlabel',
-
 
2578
                        '-check',
-
 
2579
                        '-packagebase', "$svnRepo/$packageNames",
-
 
2580
                        '-branch',
-
 
2581
                        $tgt_label );
-
 
2582
            return unless ( $rv );
-
 
2583
        }
-
 
2584
 
2307
        #
2585
        #
2308
        #   The 'clone' operation will backtrack the branch point
2586
        #   The 'clone' operation will backtrack the branch point
2309
        #   to the source of the label. This will make the output version
2587
        #   to the source of the label. This will make the output version
2310
        #   tree much prettier
2588
        #   tree much prettier
2311
        #
2589
        #
Line 2336... Line 2614...
2336
#
2614
#
2337
sub endPackage
2615
sub endPackage
2338
{
2616
{
2339
    Message ("-- Import Summary ------------------------------------------------" );
2617
    Message ("-- Import Summary ------------------------------------------------" );
2340
    RmDirTree ('SvnImportDir');
2618
    RmDirTree ('SvnImportDir');
-
 
2619
    my $processedCount = 0;
-
 
2620
    my $inernalErrorCount = 0;
-
 
2621
    my $notProcessedCount = 0;
-
 
2622
    my $badPathCount = 0;
-
 
2623
    my $badProjectBaseCount = 0;
-
 
2624
    my $badMakeProjectCount = 0;
2341
 
2625
 
2342
    #
2626
    #
2343
    #   Display versions that did get captured
2627
    #   Display versions that did get captured
2344
    #
2628
    #
2345
    foreach my $entry ( @processOrder )
2629
    foreach my $entry ( @processOrder )
2346
    {
2630
    {
2347
        $versions{$entry}{Scanned} = 1;
2631
        $versions{$entry}{Scanned} = 1;
2348
        next unless ( $versions{$entry}{TagCreated} );
2632
        next unless ( $versions{$entry}{TagCreated} );
-
 
2633
        my $eflag = $versions{$entry}{Essential} ? 'E' : ' ';
2349
        Warning ("Processed: " . GetVname($entry) . ' :: ' . $versions{$entry}{rmRef} || $versions{$entry}{errStr} || '???' );
2634
        Warning ("Processed:$eflag:" . GetVname($entry) . ' :: ' . $versions{$entry}{rmRef} || $versions{$entry}{errStr} || '???' );
2350
    }
2635
    }
2351
 
2636
 
2352
    #
2637
    #
2353
    #   Display versions that did not get created
2638
    #   Display versions that did not get created
2354
    #
2639
    #
2355
    foreach my $entry ( @processOrder )
2640
    foreach my $entry ( @processOrder )
2356
    {
2641
    {
2357
        $versions{$entry}{Scanned} = 1;
2642
        $versions{$entry}{Scanned} = 1;
2358
        next if ( $versions{$entry}{TagCreated} );
2643
        if ( $versions{$entry}{TagCreated} )
-
 
2644
        {
-
 
2645
            $processedCount++;
-
 
2646
            $badPathCount++ if ($versions{$entry}{data}{BadPath} );
-
 
2647
            $badProjectBaseCount++ if ($versions{$entry}{data}{BadProjectBase} );
-
 
2648
            $badMakeProjectCount++ if ($versions{$entry}{data}{BadMakeProject} );
-
 
2649
            next;
-
 
2650
        }
-
 
2651
 
2359
        my $reason = $versions{$entry}{data}{errStr} || '';
2652
        my $reason = $versions{$entry}{data}{errStr} || '';
2360
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2653
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
-
 
2654
        my $eflag = $versions{$entry}{Essential} ? 'E' : ' ';
2361
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
2655
        Warning ("Not Processed:$eflag: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
-
 
2656
        $notProcessedCount++;
2362
    }
2657
    }
2363
 
2658
 
2364
    foreach my $entry ( keys(%versions) )
2659
    foreach my $entry ( keys(%versions) )
2365
    {
2660
    {
2366
        next if ( $versions{$entry}{Scanned} );
2661
        next if ( $versions{$entry}{Scanned} );
2367
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2662
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
-
 
2663
        $inernalErrorCount++;
2368
    }
2664
    }
2369
 
2665
 
-
 
2666
    if ( $adjustedPath || 1 )
-
 
2667
    {
-
 
2668
        Information ("Package Info: Files, Removed, Added, Version, ViewPath");
-
 
2669
        foreach my $entry ( @processOrder )
-
 
2670
        {
-
 
2671
            my $viewPath = $versions{$entry}{data}{ViewPath} || '';
-
 
2672
            Information (sprintf "%4s, %4s, %4s, %20s : %s",
-
 
2673
                        $versions{$entry}{data}{fileCount} || '-',
-
 
2674
                        $versions{$entry}{data}{filesRemoved} || '-',
-
 
2675
                        $versions{$entry}{data}{filesAdded} || '-',
-
 
2676
                        GetVname($entry), $viewPath);
-
 
2677
        }
-
 
2678
    }
-
 
2679
 
-
 
2680
    Message ("Packages processed: $processedCount");
-
 
2681
    Warning ("Packages not processed: $notProcessedCount") if ( $notProcessedCount );
-
 
2682
    Warning ("Internal Errors: $inernalErrorCount") if ( $inernalErrorCount );
-
 
2683
    Warning ("Multiple source paths", @multiplePaths ) if ( scalar @multiplePaths > 1 );
2370
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2684
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
-
 
2685
    Warning ("Packages with Bad Paths: $badPathCount") if ( $badPathCount );
-
 
2686
    Warning ("Packages with Bad ProjectBase: $badProjectBaseCount") if ( $badProjectBaseCount );
-
 
2687
    Warning ("Packages with MakeProjects: $badMakeProjectCount") if ( $badMakeProjectCount );
-
 
2688
    Warning ("Global Error Detected") if ( $globalError );
2371
    Message ("All Done");
2689
    Message ("---- All Done -----");
2372
}
2690
}
2373
 
2691
 
2374
#-------------------------------------------------------------------------------
2692
#-------------------------------------------------------------------------------
2375
# Function        : extractFilesFromClearCase
2693
# Function        : extractFilesFromClearCase
2376
#
2694
#
Line 2394... Line 2712...
2394
    my $rv = 99;
2712
    my $rv = 99;
2395
 
2713
 
2396
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
2714
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
2397
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
2715
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
2398
    
2716
    
2399
    if ( $opt_preserveProjectBase )
2717
    if ( $opt_preserveProjectBase && !$opt_forceProjectBase )
2400
    {
2718
    {
2401
        my $cc_vob = $cc_path;
2719
        my $cc_vob = $cc_path;
2402
        $cc_vob =~ s~^/~~;
2720
        $cc_vob =~ s~^/~~;
2403
        $cc_vob =~ s~/.*~~;
2721
        $cc_vob =~ s~/.*~~;
2404
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
2722
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
Line 2481... Line 2799...
2481
    return 2;
2799
    return 2;
2482
 
2800
 
2483
}
2801
}
2484
 
2802
 
2485
#-------------------------------------------------------------------------------
2803
#-------------------------------------------------------------------------------
-
 
2804
# Function        : extractFilesFromSubversion
-
 
2805
#
-
 
2806
# Description     : Extract files from Subversion
-
 
2807
#                   May take a while as we handle nasty errors
-
 
2808
#
-
 
2809
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2810
#                   $entry          - All the PV information
-
 
2811
#
-
 
2812
# Returns         : exit code
-
 
2813
#                   Sets up
-
 
2814
#                       $data->{errStr}
-
 
2815
#                       $data->{errCode}
-
 
2816
#                   As per newPackageVersionBody
-
 
2817
#
-
 
2818
sub extractFilesFromSubversion
-
 
2819
{
-
 
2820
    my ($data, $entry ) = @_;
-
 
2821
    my $tryCount = 0;
-
 
2822
    my $rv = 99;
-
 
2823
 
-
 
2824
    #
-
 
2825
    #   Create a nice name for the import
-
 
2826
    #
-
 
2827
    my $import_label = saneLabel($entry);
-
 
2828
    
-
 
2829
 
-
 
2830
    $data->{ViewRoot} = $opt_name ? $opt_name : $import_label;
-
 
2831
    $data->{ViewPath} =  $data->{ViewRoot};
-
 
2832
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2833
 
-
 
2834
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2835
    {
-
 
2836
        Message ("Reusing view: $import_label");
-
 
2837
        return 0;
-
 
2838
    }
-
 
2839
 
-
 
2840
    #
-
 
2841
    #   Only allow import from SVN if asked nicely
-
 
2842
    #   May be used if we are correcting a package - and some have been
-
 
2843
    #   placed in SVN
-
 
2844
    #
-
 
2845
    unless ( $opt_extractFromSvn )
-
 
2846
    {
-
 
2847
        $data->{errStr} = 'Some Packages are in SVN';
-
 
2848
        return 15;
-
 
2849
    }
-
 
2850
    
-
 
2851
 
-
 
2852
#print "--- ViewRoot: $data->{ViewPath}\n";
-
 
2853
    $rv = JatsToolPrint ( 'jats_svnrelease',
-
 
2854
                          '-extractfiles',
-
 
2855
                          '-root=.' ,
-
 
2856
                          '-noprefix',
-
 
2857
                          '-DevMode=escrow',
-
 
2858
                          '-label', $data->{tag},
-
 
2859
                          '-view', $data->{ViewPath},
-
 
2860
                );
-
 
2861
 
-
 
2862
    if ( $rv == 10 ) {
-
 
2863
        $data->{errStr}  = 'No Files in the extracted view';
-
 
2864
        $data->{errCode} = '0';
-
 
2865
        return 2;
-
 
2866
 
-
 
2867
    } elsif ( $rv == 11 ) {
-
 
2868
        $data->{errStr} = 'Label not found';
-
 
2869
        $data->{errCode} = 'L';
-
 
2870
        return 2;
-
 
2871
    } elsif ( $rv ) {
-
 
2872
        $data->{errStr} = 'Subversion reported error';
-
 
2873
        return 2;
-
 
2874
    }
-
 
2875
 
-
 
2876
    unless ( -d $data->{ViewPath}  )
-
 
2877
    {
-
 
2878
        $data->{errStr} = 'Failed to extract files from Subversion';
-
 
2879
        return 2;
-
 
2880
    }
-
 
2881
 
-
 
2882
    #
-
 
2883
    #   Looks good
-
 
2884
    #
-
 
2885
    return 0;
-
 
2886
}
-
 
2887
 
-
 
2888
#-------------------------------------------------------------------------------
2486
# Function        : detectMakeProjectUsage
2889
# Function        : detectMakeProjectUsage
2487
#
2890
#
2488
# Description     : etect and report usage of the MakeProject directive
2891
# Description     : etect and report usage of the MakeProject directive
2489
#
2892
#
2490
# Inputs          : $data               - Ref to a hash of bits
2893
# Inputs          : $data               - Ref to a hash of bits
2491
#                   $cc_path            - Packages cc_path
-
 
2492
#
2894
#
2493
# Returns         : true    - Bad usage (Really good usage not detected)
2895
# Returns         : true    - Bad usage (Really good usage not detected)
2494
#                   false   - Good usage detected
2896
#                   false   - Good usage detected
2495
#
2897
#
2496
sub detectMakeProjectUsage
2898
sub detectMakeProjectUsage
2497
{
2899
{
2498
    my ($data, $cc_path) = @_;
2900
    my ($data) = @_;
2499
    my $retval = 0;
2901
    my $retval = 0;
2500
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2902
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2501
 
2903
 
2502
    #
2904
    #
2503
    #   Find makefile.pl
2905
    #   Find makefile.pl
2504
    #
2906
    #
2505
    Message ("Locate JATS makefiles");
2907
    Message ("Detect MakeProject Usage");
2506
    my $usesMakeProject = 0;
2908
    my $usesMakeProject = 0;
2507
    my $badIncludeFile = 0;
2909
    my $badIncludeFile = 0;
2508
 
2910
 
2509
    my $search = JatsLocateFiles->new("--Recurse=1",
2911
    my $search = JatsLocateFiles->new("--Recurse=1",
2510
                                       "--FilterIn=makefile.pl",
2912
                                       "--FilterIn=makefile.pl",
Line 2552... Line 2954...
2552
                    #
2954
                    #
2553
                    my @myArgs;
2955
                    my @myArgs;
2554
                    my $myProjectDir;
2956
                    my $myProjectDir;
2555
                    my $myProject = "$data->{ViewRoot}/$file";
2957
                    my $myProject = "$data->{ViewRoot}/$file";
2556
                    $myProject =~ s~/[^/]+$~~;
2958
                    $myProject =~ s~/[^/]+$~~;
-
 
2959
 
2557
                    $line =~ s~MakeProject~push \@myArgs,~;
2960
                    unless ($line =~ m~\s*(\w+)\s*\((.*)\)\s*;\s*$~ )
2558
                    eval $line;
2961
                    {
2559
                    Error("Line did not compiler: $line", "Err: $@" ) if ($@);
2962
                        Error("Could not detect arguments: $line");
-
 
2963
                    }
-
 
2964
                    my $args = $2;
-
 
2965
                    $args =~ tr~'" ~ ~s;
-
 
2966
                    @myArgs = split (/\s*,\s*/, $args);
2560
                    shift @myArgs;
2967
                    shift @myArgs;
2561
                    foreach ( @myArgs )
2968
                    foreach ( @myArgs )
2562
                    {
2969
                    {
2563
                        next if ( m~^--~ );
2970
                        next if ( m~^--~ );
2564
                        $myProject .= '/' . $_;
2971
                        $myProject .= '/' . $_;
2565
                        $myProjectDir = $myProject;
2972
                        $myProjectDir = $myProject;
2566
                        $myProjectDir =~ s~/[^/]+$~~;
2973
                        $myProjectDir =~ s~/[^/]+$~~;
2567
                        last;
2974
                        last;
2568
                    }
2975
                    }
2569
                    Error ("No project Found") unless ( defined $myProjectDir);
2976
                    Error ("No project Found") unless ( defined $myProjectDir);
-
 
2977
 
-
 
2978
                    #
-
 
2979
                    #   Look for 'include.txt' that may be bwteen the makefile and the project
-
 
2980
                    #
-
 
2981
 
-
 
2982
 
2570
                    if ( -f "$myProjectDir/include.txt" )
2983
                    if ( -f "$myProjectDir/include.txt" )
2571
                    {
2984
                    {
2572
                        Warning ("Co-located 'include.txt' file also found");
2985
                        Warning ("Co-located 'include.txt' file also found");
2573
                    }
2986
                    }
2574
 
2987
 
Line 2672... Line 3085...
2672
    
3085
    
2673
    return $retval;
3086
    return $retval;
2674
}
3087
}
2675
 
3088
 
2676
#-------------------------------------------------------------------------------
3089
#-------------------------------------------------------------------------------
-
 
3090
# Function        : detectBadMakePaths
-
 
3091
#
-
 
3092
# Description     : Detect and report bad usage of some directives
-
 
3093
#
-
 
3094
# Inputs          : $data               - Ref to a hash of bits
-
 
3095
#
-
 
3096
# Returns         : true    - Bad usage (Really good usage not detected)
-
 
3097
#                   false   - Good usage detected
-
 
3098
#
-
 
3099
sub detectBadMakePaths
-
 
3100
{
-
 
3101
    my ($data) = @_;
-
 
3102
    my $retval = 0;
-
 
3103
    my $eSuf = $opt_ignoreBadPaths ? '' : 'Error';
-
 
3104
 
-
 
3105
    #
-
 
3106
    #   Find makefile.pl
-
 
3107
    #
-
 
3108
    Message ("Detect Bad Source Paths");
-
 
3109
    my $badPath = 0;
-
 
3110
 
-
 
3111
    my $search = JatsLocateFiles->new("--Recurse=1",
-
 
3112
                                       "--FilterIn=makefile.pl",
-
 
3113
                                       );
-
 
3114
    my @makefiles = $search->search($data->{ViewPath});
-
 
3115
    foreach my $file ( @makefiles )
-
 
3116
    {
-
 
3117
        $file =~ tr~/~/~s;
-
 
3118
        my $max_up = ($file =~ tr~/~/~);
-
 
3119
        my $shownPath;
-
 
3120
#print "---Reading: $workDir/$data->{ViewPath}/$file\n";
-
 
3121
        if ( open( my $fh, '<', "$data->{ViewPath}/$file" ) )
-
 
3122
        {
-
 
3123
            my $eof = 0;
-
 
3124
            my $line = '';
-
 
3125
 
-
 
3126
            until ( $eof )
-
 
3127
            {
-
 
3128
                my $in = <$fh>;
-
 
3129
                unless ( defined $in )
-
 
3130
                {
-
 
3131
                    $eof = 1;
-
 
3132
                }
-
 
3133
                else
-
 
3134
                {
-
 
3135
                $in =~ s~\s+$~~;
-
 
3136
                $in =~ s~^\s+~~;
-
 
3137
                $in =~ s~^#.*$~~;
-
 
3138
                $in =~ s~\s*[^\$]#.*$~~;
-
 
3139
                $line .= ' ' if ( $line );
-
 
3140
                $line .= $in;
-
 
3141
                $line =~ s~\s+~ ~g;
-
 
3142
#print "====== '$line'\n";
-
 
3143
                redo unless ( $line =~ m~;$~  );
-
 
3144
                }
-
 
3145
                if ( $line =~ m~^AddDir~ || $line =~ m~^AddSrcDir~ || $line =~ m~^AddIncDir~ || $line =~ m~^Src~ )
-
 
3146
                {
-
 
3147
                    #
-
 
3148
                    #   Extract out the arguments
-
 
3149
                    #
-
 
3150
                    my @myArgs;
-
 
3151
                    my $myProjectDir;
-
 
3152
                    my $myProject = "$data->{ViewRoot}/$file";
-
 
3153
                    $myProject =~ s~/[^/]+$~~;
-
 
3154
 
-
 
3155
                    unless ($line =~ m~\s*(\w+)\s*\((.*)\)\s*;\s*$~ )
-
 
3156
                    {
-
 
3157
                        Error("Could not detect arguments: $line");
-
 
3158
                    }
-
 
3159
                    my $args = $2;
-
 
3160
                    $args =~ tr~'" ~ ~s;
-
 
3161
                    @myArgs = split (/\s*,\s*/, $args);
-
 
3162
                    shift @myArgs;
-
 
3163
                    foreach ( @myArgs )
-
 
3164
                    {
-
 
3165
                        next if ( m~^--~ );
-
 
3166
                        next unless ( m~^\.\./~ );
-
 
3167
                        my $tmp = $_;
-
 
3168
                        $tmp =~ s~Z~z~g;
-
 
3169
                        $tmp =~ s~\.\./~Z~g;
-
 
3170
                        my $upCount = ( $tmp =~ tr~Z~Z~ );
-
 
3171
                        if ( $upCount > $max_up )
-
 
3172
                        {
-
 
3173
                            Warning ("Makefile Path: $file ") unless $shownPath;
-
 
3174
                            Warning ("Path escapes view: $max_up, $upCount, $_");
-
 
3175
                            $badPath++;
-
 
3176
                            $shownPath = 1;
-
 
3177
                        }
-
 
3178
#print "---x Path : $max_up, $upCount, $_\n";
-
 
3179
                    }
-
 
3180
                }
-
 
3181
                $line = '';
-
 
3182
            }
-
 
3183
            close $fh;
-
 
3184
        }
-
 
3185
        else
-
 
3186
        {
-
 
3187
            Warning ("detectBadMakePaths$eSuf - Cannot open makefile: $file");
-
 
3188
            $retval = 1;
-
 
3189
        }
-
 
3190
    }
-
 
3191
 
-
 
3192
    #
-
 
3193
    #   Used
-
 
3194
    #   May be improved latter
-
 
3195
    #
-
 
3196
    if ( $badPath )
-
 
3197
    {
-
 
3198
        Warning ("detectBadMakePaths$eSuf - Bad Path seen. Must check manually");
-
 
3199
        $retval = 1;
-
 
3200
    }
-
 
3201
    
-
 
3202
    return $retval;
-
 
3203
}
-
 
3204
 
-
 
3205
 
-
 
3206
#-------------------------------------------------------------------------------
2677
# Function        : detectProjectBaseUsage
3207
# Function        : detectProjectBaseUsage
2678
#
3208
#
2679
# Description     : Detect and report usage of the SetProjectBase directive
3209
# Description     : Detect and report usage of the SetProjectBase directive
2680
#
3210
#
2681
# Inputs          : $data               - Ref to a hash of bits
3211
# Inputs          : $data               - Ref to a hash of bits
Line 2690... Line 3220...
2690
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
3220
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2691
 
3221
 
2692
    #
3222
    #
2693
    #   Find makefile.pl
3223
    #   Find makefile.pl
2694
    #
3224
    #
2695
    Message ("Locate JATS makefiles");
3225
    Message ("Detect ProjectBase Usage");
2696
    my $usesProjectBase = 0;
3226
    my $usesProjectBase = 0;
2697
    my $definesProjectBase = 0;
3227
    my $definesProjectBase = 0;
2698
    my $definitionError = 0;
3228
    my $definitionError = 0;
2699
 
3229
 
2700
    my $search = JatsLocateFiles->new("--Recurse=1",
3230
    my $search = JatsLocateFiles->new("--Recurse=1",
Line 3435... Line 3965...
3435
# Returns         : Cleaned up vcs tag
3965
# Returns         : Cleaned up vcs tag
3436
#
3966
#
3437
sub vcsCleanup
3967
sub vcsCleanup
3438
{
3968
{
3439
    my ($tag) = @_;
3969
    my ($tag) = @_;
3440
    $tag =~ tr~\\/~/~;
3970
    $tag =~ tr~\\/~/~;                              # Force use of /
-
 
3971
    $tag =~ s~/+$~~;                                # Trailing /
3441
    if ( $tag =~ m~^CC::~ )
3972
    if ( $tag =~ m~^CC::~ )
3442
    {
3973
    {
-
 
3974
        $tag =~ s~CC::/VOB:/~CC::/~;                # Kill stuff
3443
        $tag =~ s~CC::load\s+~CC::~;                # Load rule
3975
        $tag =~ s~CC::load\s+~CC::~;                # Load rule
3444
        $tag =~ s~CC::\s+~CC::~;                    # Leading white space
3976
        $tag =~ s~CC::\s+~CC::~;                    # Leading white space
3445
        $tag =~ s~CC::[A-Za-z]\:/~CC::/~;           # Leading driver letter
3977
        $tag =~ s~CC::[A-Za-z]\:/~CC::/~;           # Leading driver letter
3446
        $tag =~ s~CC::/+~CC::/~;                    # Multiple initial /'s
3978
        $tag =~ s~CC::/+~CC::/~;                    # Multiple initial /'s
3447
        $tag =~ s~/build.pl::~::~i;
3979
        $tag =~ s~/build.pl::~::~i;
Line 3491... Line 4023...
3491
        $bad = 1 if ( $path =~ m~^/devl/~ || $path  =~ m~^devl/~ );
4023
        $bad = 1 if ( $path =~ m~^/devl/~ || $path  =~ m~^devl/~ );
3492
        $bad = 1 if ( $path =~ m~^CVS~ );
4024
        $bad = 1 if ( $path =~ m~^CVS~ );
3493
        $bad = 1 if ( $path =~ m~^http:~i );
4025
        $bad = 1 if ( $path =~ m~^http:~i );
3494
        $bad = 1 if ( $path =~ m~^[A-Za-z]\:~ );
4026
        $bad = 1 if ( $path =~ m~^[A-Za-z]\:~ );
3495
        $bad = 1 if ( $path =~ m~^//~ );
4027
        $bad = 1 if ( $path =~ m~^//~ );
-
 
4028
        $bad = 1 if ( $path =~ m~^/blade1/~ );
-
 
4029
        $bad = 1 if ( $path =~ m~^/devl/~ );
3496
        $bad = 1 if ( $path =~ m~^/*none~i );
4030
        $bad = 1 if ( $path =~ m~^/*none~i );
3497
        $bad = 1 if ( $path =~ m~^/*NoWhere~i );
4031
        $bad = 1 if ( $path =~ m~^/*NoWhere~i );
3498
        $bad = 1 if ( $path =~ m~^-$~i );
4032
        $bad = 1 if ( $path =~ m~^-$~i );
3499
        $bad = 1 if ( $path =~ m~^cvsserver:~ );
4033
        $bad = 1 if ( $path =~ m~^cvsserver:~ );
3500
        $bad = 1 if ( $path =~ m~,\s*module:~ );
4034
        $bad = 1 if ( $path =~ m~,\s*module:~ );
-
 
4035
        $bad = 1 if ( $path =~ m~[()]~ );
3501
#        $bad = 1 unless ( $path =~ m~^/~ );
4036
#        $bad = 1 unless ( $path =~ m~^/~ );
3502
    }
4037
    }
3503
    else
4038
    else
3504
    {
4039
    {
3505
        $bad = 1;
4040
        $bad = 1;
Line 4059... Line 4594...
4059
        my $vcsType = $1;
4594
        my $vcsType = $1;
4060
        my $cc_label = $4;
4595
        my $cc_label = $4;
4061
        my $cc_path = $2;
4596
        my $cc_path = $2;
4062
        $cc_path = '/' . $cc_path;
4597
        $cc_path = '/' . $cc_path;
4063
        $cc_path =~ tr~\\/~/~s;
4598
        $cc_path =~ tr~\\/~/~s;
-
 
4599
        $cc_path =~ s~/+$~~;
4064
 
4600
 
4065
        $VobPaths{$cc_path}++;
4601
        $VobPaths{$cc_path}++;
4066
    }
4602
    }
4067
 
4603
 
4068
    @multiplePaths = sort keys %VobPaths;
4604
    @multiplePaths = sort keys %VobPaths;
4069
    if ( scalar @multiplePaths > 1 )
4605
    if ( scalar @multiplePaths > 1 )
4070
    {
4606
    {
4071
        Warning ("Multiple Paths:" . $_ ) foreach (@multiplePaths);
4607
        Warning ("Multiple Paths:" . $_ ) foreach (@multiplePaths);
-
 
4608
 
-
 
4609
        # Kill SVN import
-
 
4610
        # User will need to configure one path
-
 
4611
        unless ( $opt_AllowMuliplePaths )
-
 
4612
        {
-
 
4613
            Warning ("Multiple Paths detected: Import supressed");
-
 
4614
            $opt_useSvn = 0
-
 
4615
        }
-
 
4616
        else
-
 
4617
        {
-
 
4618
            Message ("Multiple Paths detected: Allowed");
-
 
4619
        }
4072
    }
4620
    }
4073
}
4621
}
4074
 
4622
 
4075
sub isSet
4623
sub isSet
4076
{
4624
{
Line 4296... Line 4844...
4296
    #   Close out the file
4844
    #   Close out the file
4297
    #
4845
    #
4298
    $fh->Close();
4846
    $fh->Close();
4299
}
4847
}
4300
 
4848
 
-
 
4849
#-------------------------------------------------------------------------------
-
 
4850
# Function        : restoreData
-
 
4851
#
-
 
4852
# Description     : Read in essential information
-
 
4853
#                   Used during a resume operation
-
 
4854
#
-
 
4855
# Inputs          : 
-
 
4856
#
-
 
4857
# Returns         : 
-
 
4858
#
-
 
4859
our %ScmVersions;
-
 
4860
sub restoreData
-
 
4861
{
-
 
4862
    my $file = $cwd . "/${packageNames}.data";
-
 
4863
    Message ("Restoring: $file");
-
 
4864
    Error "Cannot locate restoration file: $file" unless ( -f $file );
-
 
4865
    require $file;
-
 
4866
 
-
 
4867
    Error "Resume Data in $file is not valid\n"
-
 
4868
        unless ( keys(%ScmVersions) >= 0 );
-
 
4869
 
-
 
4870
    foreach  ( keys %ScmVersions )
-
 
4871
    {
-
 
4872
        $restoreData{$_} = $ScmVersions{$_}{data};
-
 
4873
        $restoreData{$_}{rmRef} = $ScmVersions{$_}{rmRef};
-
 
4874
    }
-
 
4875
    %ScmVersions = ();
-
 
4876
}
-
 
4877
 
-
 
4878
#-------------------------------------------------------------------------------
-
 
4879
# Function        : testSvnLabel
-
 
4880
#
-
 
4881
# Description     : Test existence of an SVN label
-
 
4882
#
-
 
4883
# Inputs          :     Package
-
 
4884
#                       Label to test
-
 
4885
#
-
 
4886
# Returns         : 0   - Tag in place
-
 
4887
#                   1   - Not in place
-
 
4888
#
-
 
4889
sub testSvnLabel
-
 
4890
{
-
 
4891
    my ($svnPkg, $svnTag) = @_;
-
 
4892
 
-
 
4893
    my $rv = JatsToolPrint ( 'jats_svnlabel',
-
 
4894
                    '-check',
-
 
4895
                    "-packagebase=$svnPkg",
-
 
4896
                    "$svnTag",
-
 
4897
                     );
-
 
4898
    Message ("testSvnLabel: $svnTag - $rv");
-
 
4899
    return $rv;
-
 
4900
}
-
 
4901
 
4301
 
4902
 
4302
#-------------------------------------------------------------------------------
4903
#-------------------------------------------------------------------------------
4303
#   Documentation
4904
#   Documentation
4304
#
4905
#
4305
 
4906
 
Line 4333... Line 4934...
4333
    -[no]postimage     - Create image after transger: Def: -post
4934
    -[no]postimage     - Create image after transger: Def: -post
4334
    -workdir=path      - Use for temp storage (def:/work)
4935
    -workdir=path      - Use for temp storage (def:/work)
4335
    -delete            - Delete SVN package before test
4936
    -delete            - Delete SVN package before test
4336
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4937
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4337
    -testRmDatabase    - Use test database
4938
    -testRmDatabase    - Use test database
-
 
4939
    -[no]fromSvn       - Also extract packages from SVN
4338
 
4940
 
4339
=head1 OPTIONS
4941
=head1 OPTIONS
4340
 
4942
 
4341
=over 8
4943
=over 8
4342
 
4944