Subversion Repositories DevTools

Rev

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

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