Subversion Repositories DevTools

Rev

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

Rev 2450 Rev 2764
Line 53... Line 53...
53
my $opt_repo_base = 'AUPERASVN01/';
53
my $opt_repo_base = 'AUPERASVN01/';
54
my $opt_repo = '';
54
my $opt_repo = '';
55
my $opt_repoSubdir = '';
55
my $opt_repoSubdir = '';
56
my $opt_flat;
56
my $opt_flat;
57
my $opt_test;
57
my $opt_test;
58
my $opt_reuse;
58
my $opt_reuse = 0;
59
my $opt_age;
59
my $opt_age;
60
my $opt_dump = 0;
60
my $opt_dump = 0;
61
my $opt_images = 0;
61
my $opt_images = 0;
62
my $opt_retaincount = 2;
62
my $opt_retaincount = 2;
63
my $opt_pruneModeString;
63
my $opt_pruneModeString;
Line 67... Line 67...
67
my @opt_tip;
67
my @opt_tip;
68
my $opt_postimage = 1;
68
my $opt_postimage = 1;
69
my $opt_workDir = '/work';
69
my $opt_workDir = '/work';
70
my $opt_vobMap;
70
my $opt_vobMap;
71
my $opt_fileList;
71
my $opt_fileList;
-
 
72
my $opt_ccbase;
72
my $opt_preserveProjectBase;
73
my $opt_preserveProjectBase;
73
my $opt_ignoreProjectBaseErrors;
74
my $opt_ignoreProjectBaseErrors;
74
my $opt_resume;
-
 
75
my $opt_ignoreMakeProjectErrors;
75
my $opt_ignoreMakeProjectErrors;
-
 
76
my $opt_forceProjectBase;
-
 
77
my @opt_limitProjectBase;
-
 
78
my @opt_mergePaths;
-
 
79
my $opt_ignoreBadPaths;
76
my $opt_delete;
80
my $opt_delete;
77
my $opt_recentAge = 14;             # Days
81
my $opt_recentAge = 14;             # Days
78
my $opt_relabel = 1;
82
my $opt_relabel = 0;
-
 
83
my $opt_protected;
-
 
84
my $opt_useSvn = 1;
-
 
85
my $opt_testRmDatabase;
-
 
86
my $opt_extractFromSvn;
-
 
87
my $opt_AllowMuliplePaths = 1;      #29-Nov-2012
-
 
88
my $opt_resume;
-
 
89
my $opt_processRipples = 1;
-
 
90
my $opt_mergePackages;
79
 
91
 
80
################################################################################
92
################################################################################
81
#   List of Projects Suffixes and Branch Names to be used within SVN
93
#   List of Projects Suffixes and Branch Names to be used within SVN
82
#
94
#
83
#       Name        - Name of branch for the project
95
#       Name        - Name of branch for the project
Line 133... Line 145...
133
    '.pxxx.sydddd'  => '.syd',
145
    '.pxxx.sydddd'  => '.syd',
134
    '.oslo'         => '.oso',
146
    '.oslo'         => '.oso',
135
    '.osl'          => '.oso',
147
    '.osl'          => '.oso',
136
);
148
);
137
 
149
 
138
my @excludeFromImport = (
-
 
139
 
-
 
140
    # 22-Oct-12: Excluded on request from Kasun Sirikumara
-
 
141
    # Pending VSS work
-
 
142
    'agency_website',
-
 
143
    'alx',
-
 
144
    'alx-api',
-
 
145
    'cardholder_website',
-
 
146
    'loginmodule-ad',
-
 
147
    'ols-enquiry',
-
 
148
    'ols-enquiry-api',
-
 
149
    'olsrpc4j',
-
 
150
    'orca-middleware',
-
 
151
    'orca-middleware-api',
-
 
152
    'orca-salesEngine',
-
 
153
    'orca-web-api',
-
 
154
    'orca-web-utils',
-
 
155
    'TestPaymentGateway',
-
 
156
    'tgen4j',
-
 
157
    'web-cd-client',
-
 
158
 
-
 
159
 
-
 
160
    # 05-Nov-12: Pending fixup for include.txt files that escape the VOB
-
 
161
    #
-
 
162
#    'ddu_app_manager',
-
 
163
#    'ddu_dog',
-
 
164
#    'ddu_dog_lib',
-
 
165
#    'ddu_fim',
-
 
166
#    'ddu_logging_lib',
-
 
167
#    'ddu_management',
-
 
168
#    'ddu_mccain',
-
 
169
#    'ddu_mon',
-
 
170
#    'ddu_rcu',
-
 
171
#    'ddu_status_logging',
-
 
172
    
-
 
173
);
-
 
174
 
-
 
175
my %specialPackages = (
150
my %specialPackages = (
176
    'core_devl'           =>  ',all,protected,',
151
    'core_devl'           =>  ',all,protected,',
177
    'daf_utils_mos'       => ',flat,',
152
    'daf_utils_mos'       => ',flat,',
178
    'mos_packager'        => ',all,',
153
    'mos_packager'        => ',all,',
179
    'cfmgr-cfmgr'         => ',flat,',
154
    'cfmgr-cfmgr'         => ',flat,',
Line 187... Line 162...
187
    'CommandServer'       => ',IgnoreMakeProject,',
162
    'CommandServer'       => ',IgnoreMakeProject,',
188
    'TDSExporterControl'  => ',IgnoreMakeProject,',
163
    'TDSExporterControl'  => ',IgnoreMakeProject,',
189
    'cdagui'              => ',IgnoreMakeProject,',
164
    'cdagui'              => ',IgnoreMakeProject,',
190
 
165
 
191
 
166
 
192
    # Need to be handled in a special manner
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,',
193
    # Not done by this utility
172
    'ddu_fim'               => ',IgnoreMakeProject,',
194
    #
-
 
-
 
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,',
195
    'linux_drivers_eb5600'  => ',protected,',
179
    'dm_devcdfile'          => 'AllowMultiPath',
196
    'linux_drivers_viper'   => ',protected,',
180
    'daf_ct_mcr_unified'    => 'AllowMultiPath',
197
    'linux_drivers_cobra'   => ',protected,',
181
    'cst-rms-db'            => 'AllowMultiPath',
198
    'linux_drivers_bcp4600' => ',protected,',
182
    'daf_common'            => 'IgnoreProjectBase',
199
    'linux_drivers_etx86'   => ',protected,',
183
    'devcd'                 => 'AllowMultiPath',
-
 
184
    'daf_dll'                   => 'AllowMultiPath,IgnoreMakeProject',  # MakeProject not in used makefile
-
 
185
    'daf_transap_proxyman_edf'  => 'AllowMultiPath,IgnoreProjectBase',
200
    'linux_drivers_tp5600'  => ',protected,',
186
    'devrelease'                => 'AllowMultiPath',
201
 
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',
202
# Not in the ukHops migration at the moment
197
    'dm_devudapi'               => 'AllowMultiPath',
-
 
198
    'buscdapi'                  => 'AllowMultiPath',
-
 
199
    'daf_bvt'                   => 'AllowMultiPath,IgnoreMakeProject,',  # Look OK
-
 
200
    'daf_cd_transap'            => 'AllowMultiPath,IgnoreBadPath,IgnoreProjectBase',
203
    'cs'                        => ',protected,',
201
    'cdref'                     => 'AllowMultiPath',
204
 
-
 
-
 
202
    'dm_sysbasetypes'           => 'AllowMultiPath',
-
 
203
    'dm_sysswis'                => 'AllowMultiPath',
-
 
204
    'dm_syscd'                  => 'AllowMultiPath',
205
    'DBA-Common'                => ',protected,',
205
    'dm_udtypes'                => 'AllowMultiPath',
206
    'DBA-DatabaseInstall'       => ',protected,',
206
    'dm_systemcdtables'         => 'AllowMultiPath',
-
 
207
    'dm_utils'                  => 'AllowMultiPath',
207
    'DBA-ExternalPerlModules'   => ',protected,',
208
    'dm_udxml'                  => 'AllowMultiPath',
208
    'DBA-OraUserBuild'          => ',protected,',
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',
209
    'DBA-OST'                   => ',protected,',
220
    'sysswis'                   => 'AllowMultiPath',
210
    'orahops-install'           => ',protected,',
221
    'udserialiser'              => 'AllowMultiPath',
-
 
222
    'systemcdtables'            => 'AllowMultiPath',
-
 
223
    'udxml'                     => 'AllowMultiPath',
211
    'orahops-patch'             => ',protected,',
224
    'ERGoracs'                  => 'AllowMultiPath',
-
 
225
    'daf_cd_desfireparams'      => 'AllowMultiPath',
212
    'orahops-ssw-install'       => ',protected,',
226
    'daf_ct_mag_virtual'        => 'AllowMultiPath',
213
    'orahops-ssw-patch'         => ',protected,',
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',
214
# End of ukHops migration exclussion
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
 
-
 
256
    'LinuxDrivers'                  => 'flatTime,LimitProjectBase=/LMOS/linux/drivers'.
-
 
257
                                       ',mergePaths=modules:bcp4600:cobra:eb5600:etx86:tp5600:viper',
-
 
258
 
-
 
259
    'flashCopier'              => 'flatTime,LimitProjectBase=/LMOS/tools/flashCopier'.
-
 
260
                                       ',mergePaths=+:src:pcp5700:eb5600:tp5600',
-
 
261
 
-
 
262
 
215
 
263
 
216
    'ftp'                   => 'SetProjectBase,',
-
 
217
    'ddu_app_manager'       => 'SetProjectBase,',
-
 
218
 
264
 
219
    'icl'                   => 'IgnoreProjectBase,',
265
    'icl'                   => 'IgnoreProjectBase,',
220
    'itso'                  => 'IgnoreProjectBase,',
266
    'itso'                  => 'IgnoreProjectBase,',
221
    'daf_osa_mos'           => 'IgnoreProjectBase,',
267
#    'daf_osa_mos'           => 'IgnoreProjectBase,',
222
    'daf_utils_mos'         => 'IgnoreProjectBase,',
268
    'daf_utils_mos'         => 'IgnoreProjectBase,',
223
    'itso_ud'               => 'IgnoreProjectBase,',
269
    'itso_ud'               => 'IgnoreProjectBase,',
224
#    'mos_api'               => 'IgnoreProjectBase,',
270
#    'mos_api'               => 'IgnoreProjectBase,',
225
#    'mos_fonts'             => 'IgnoreProjectBase,',
271
#    'mos_fonts'             => 'IgnoreProjectBase,',
226
#    'sntp'                  => 'IgnoreProjectBase,',
272
#    'sntp'                  => 'IgnoreProjectBase,',
Line 280... Line 326...
280
my $globalError;
326
my $globalError;
281
my @unknownProjects;
327
my @unknownProjects;
282
my %knownProjects;
328
my %knownProjects;
283
my $badSingletonCount = 0;
329
my $badSingletonCount = 0;
284
my @flatOrder;
330
my @flatOrder;
-
 
331
my $flatMode;
285
my $pruneMode;
332
my $pruneMode;
286
my $pruneModeString;
333
my $pruneModeString;
287
my $threadId = 0;
334
my $threadId = 0;
288
my $threadCount;
335
my $threadCount;
289
my %tipVersions;
336
my %tipVersions;
Line 305... Line 352...
305
my $processCount = 0;
352
my $processCount = 0;
306
my $processTotal = 0;
353
my $processTotal = 0;
307
my $recentCount = 0;
354
my $recentCount = 0;
308
my $packageReLabelCount = 0;
355
my $packageReLabelCount = 0;
309
my %saneLabels;
356
my %saneLabels;
-
 
357
my $adjustedPath = 0;
-
 
358
my $forceImportFlush = 0;
-
 
359
my %restoreData;
310
 
360
 
311
our $GBE_RM_URL;
361
our $GBE_RM_URL;
312
my $UNIX = $ENV{'GBE_UNIX'};
362
my $UNIX = $ENV{'GBE_UNIX'};
313
 
363
 
314
my $result = GetOptions (
364
my $result = GetOptions (
315
                "help+"         => \$opt_help,          # flag, multiple use allowed
365
                "help+"         => \$opt_help,          # flag, multiple use allowed
316
                "manual:3"      => \$opt_help,
366
                "manual:3"      => \$opt_help,
317
                "verbose:+"     => \$opt_verbose,       # Versose
367
                "verbose:+"     => \$opt_verbose,       # Versose
318
                "repository:s"  => \$opt_repo,          # Name of repository
368
                "repository:s"  => \$opt_repo,          # Name of repository
319
                'subdir:s'      => \$opt_repoSubdir,    # Subdir within repo
-
 
320
                'rbase:s'       => \$opt_repo_base,     # Base of the repo
369
                'rbase:s'       => \$opt_repo_base,     # Base of the repo
321
                "flat!"         => \$opt_flat,          # Flat structure
370
                "flat!"         => \$opt_flat,          # Flat structure
322
                "test!"         => \$opt_test,          # Test operations
371
                "test!"         => \$opt_test,          # Test operations
323
                "reuse!"        => \$opt_reuse,         # Reuse ClearCase views
372
                "reuse:1"       => \$opt_reuse,         # Reuse ClearCase views 0:None, 1=Retain, 2=Use+Delete
324
                "age:i"         => \$opt_age,           # Only recent versions
373
                "age:i"         => \$opt_age,           # Only recent versions
325
                "dump:1"        => \$opt_dump,          # Dump Data
374
                "dump:1"        => \$opt_dump,          # Dump Data
326
                "images:1"      => \$opt_images,        # Create DOT images
375
                "images:1"      => \$opt_images,        # Create DOT images
327
                "retain:i"      => \$opt_retaincount,   # Retain N packages
376
                "retain:i"      => \$opt_retaincount,   # Retain N packages
328
                "pruneMode:s"   => \$opt_pruneModeString,
377
                "pruneMode:s"   => \$opt_pruneModeString,
Line 330... Line 379...
330
                "name:s"        => \$opt_name,          # Alternate output
379
                "name:s"        => \$opt_name,          # Alternate output
331
                "tip:s"         => \@opt_tip,           # Force tip version(s)
380
                "tip:s"         => \@opt_tip,           # Force tip version(s)
332
                "log!"          => \$opt_log,
381
                "log!"          => \$opt_log,
333
                "delete!"       => \$opt_delete,
382
                "delete!"       => \$opt_delete,
334
                "postimage!"    => \$opt_postimage,
383
                "postimage!"    => \$opt_postimage,
335
                'workdir:s'     => \$opt_workDir,
384
                'workdir:s'         => \$opt_workDir,
-
 
385
                'relabel!'          => \$opt_relabel,
-
 
386
                'svn!'              => \$opt_useSvn,
-
 
387
                'testRmDatabase'    => \$opt_testRmDatabase,
-
 
388
                'fromSvn!'          => \$opt_extractFromSvn,
-
 
389
                'resume'            => \$opt_resume,
-
 
390
                'mergePackages:s'   => \$opt_mergePackages,
-
 
391
 
-
 
392
                # File list support
336
                'filelist:s'    => \$opt_fileList,      # A list of CC tags
393
                'filelist:s'    => \$opt_fileList,      # A list of CC tags
337
                'resume:s'      => \$opt_resume,
394
                'subdir:s'      => \$opt_repoSubdir,    # Subdir within repo
338
                'relabel!'      => \$opt_relabel,
395
                'ccbase:s'      => \$opt_ccbase,        # ClearCase Base for CC Tags
-
 
396
                
339
                );
397
                );
340
 
398
 
341
#
399
#
342
#   Process help and manual options
400
#   Process help and manual options
343
#
401
#
Line 353... Line 411...
353
             'verbose' => $opt_verbose,
411
             'verbose' => $opt_verbose,
354
              );
412
              );
355
 
413
 
356
Error("Workdir does not exist" ) unless ( -d $opt_workDir );
414
Error("Workdir does not exist" ) unless ( -d $opt_workDir );
357
Error("Specify a package as 'name'" ) unless ( defined $ARGV[0] );
415
Error("Specify a package as 'name'" ) unless ( defined $ARGV[0] );
-
 
416
Error("-Filelist requires -ccbase") unless ( !$opt_fileList || ($opt_fileList && $opt_ccbase) );
-
 
417
 
358
EnvImport('GBE_RM_URL');
418
EnvImport('GBE_RM_URL');
359
$cwd = Getcwd();
419
$cwd = Getcwd();
360
 
420
 
361
#
421
#
-
 
422
#   Allow use of the test database
-
 
423
#   Defaut is live data, but some error recovery stuff can be done via
-
 
424
#   the test database.
-
 
425
#
-
 
426
if ( $opt_testRmDatabase )
-
 
427
{
-
 
428
    Warning ("Using Test Database");
-
 
429
    $ENV{GBE_RM_USERNAME} = 'RELEASE_MANAGER';
-
 
430
    $ENV{GBE_RM_PASSWORD} = 'RELEASE_MANAGER';
-
 
431
    $ENV{GBE_RM_LOCATION} = 'jdbc:oracle:thin:@auperaora07.vix.local:1521:RELMANU1';
-
 
432
}
-
 
433
 
-
 
434
#
362
#   Init the pruning mode
435
#   Init the pruning mode
363
#
436
#
364
setPruneMode( $opt_pruneModeString || 'ripple');
437
setPruneMode( $opt_pruneModeString || 'ripple');
365
 
438
 
-
 
439
#
-
 
440
#   Detect Merge Package Request
-
 
441
#   These use pre-configured bits
-
 
442
#
-
 
443
if ( $opt_mergePackages )
-
 
444
{
-
 
445
    if ( $opt_mergePackages eq 'LinuxDrivers' )
-
 
446
    {
-
 
447
        @ARGV = qw (linux_drivers_eb5600
-
 
448
                    linux_drivers_viper
-
 
449
                    linux_drivers_cobra
-
 
450
                    linux_drivers_etx86
-
 
451
                    linux_drivers_tp5600);
-
 
452
#                    linux_drivers_bcp4600
-
 
453
                    
-
 
454
        $opt_name = $opt_mergePackages;
-
 
455
 
-
 
456
    } elsif ( $opt_mergePackages eq 'flashCopier' )
-
 
457
    {
-
 
458
        @ARGV = qw (
-
 
459
                flash_copier_eb5600
-
 
460
                flash_copier_pcp5700
-
 
461
                flash_copier_tp5600
-
 
462
                );
-
 
463
 
-
 
464
        $opt_name = $opt_mergePackages;
-
 
465
 
-
 
466
    } else
-
 
467
    {
-
 
468
        Error ("Unknown Merge Package Name: $opt_mergePackages");
-
 
469
    }
-
 
470
}
-
 
471
 
-
 
472
 
366
if ( $opt_fileList )
473
if ( $opt_fileList )
367
{
474
{
368
    GetData_by_filelist( $opt_fileList );
475
    GetData_by_filelist( $opt_fileList );
369
    push @packageNames, $ARGV[0];
476
    push @packageNames, $ARGV[0];
370
    $multiPackages++;
477
    $multiPackages++;
Line 432... Line 539...
432
smartPackageType();                 # Determine special prune mode
539
smartPackageType();                 # Determine special prune mode
433
ReportPathVariance();
540
ReportPathVariance();
434
massageData();
541
massageData();
435
getSvnData();
542
getSvnData();
436
smartPackageType();                 # Have another go
543
smartPackageType();                 # Have another go
-
 
544
restoreData() if ( $opt_resume );
437
 
545
 
438
my @missedTips = keys %tipVersions;
546
my @missedTips = keys %tipVersions;
439
Error ("Specified tip version not found: @missedTips") if ( @missedTips );
547
Error ("Specified tip version not found: @missedTips") if ( @missedTips );
440
 
548
 
441
if ( $opt_flat )
549
if ( $opt_flat )
442
{
550
{
443
#    @flatOrder = sort {$versions{$a}{version} cmp $versions{$b}{version}} keys(%versions);
551
#    @flatOrder = sort {$versions{$a}{version} cmp $versions{$b}{version}} keys(%versions);
444
#    @flatOrder = sort {$versions{$a}{created} cmp $versions{$b}{created}} keys(%versions);
552
#    @flatOrder = sort {$versions{$a}{created} cmp $versions{$b}{created}} keys(%versions);
-
 
553
 
-
 
554
    if ( $flatMode == 1 ) {
-
 
555
        Message ("Flat import. Sorted by TimeStamp");
-
 
556
        @flatOrder = sort {$versions{$a}{TimeStamp} cmp $versions{$b}{TimeStamp}} keys(%versions);
-
 
557
    } else {
445
    @flatOrder = sort {$a <=> $b} keys(%versions);
558
        @flatOrder = sort {$a <=> $b} keys(%versions);
-
 
559
    }
446
    my $tip = $flatOrder[-1];
560
    my $tip = $flatOrder[-1];
447
    $versions{$tip}{Tip} = 1 if $tip;
561
    $versions{$tip}{Tip} = 1 if $tip;
448
}
562
}
449
 
563
 
450
#
564
#
Line 501... Line 615...
501
 
615
 
502
    #
616
    #
503
    #   Going to do serious work
617
    #   Going to do serious work
504
    #   Need to ensure we have more arguments
618
    #   Need to ensure we have more arguments
505
    #
619
    #
-
 
620
    if ( $opt_protected )
-
 
621
    {
-
 
622
        Warning("Protected Package not transferred: $packageNames - $opt_protected",
-
 
623
                "See cc2svn_protected.txt for details");
-
 
624
        exit 0;
-
 
625
    }
-
 
626
 
506
    if ( $noTransfer )
627
    if ( $noTransfer )
507
    {
628
    {
508
        Warning("Protected Package not transferred: $packageNames[0]");
629
        Warning("Protected Package not transferred: $packageNames",
-
 
630
                "Configured within this program");
509
        exit 0;
631
        exit 0;
510
    }
632
    }
511
 
633
 
512
    #
634
    #
513
    #   Perform all the work in a package specific subdirectory
635
    #   Perform all the work in a package specific subdirectory
Line 526... Line 648...
526
    {
648
    {
527
        newProject();
649
        newProject();
528
        foreach my $entry (@flatOrder )
650
        foreach my $entry (@flatOrder )
529
        {
651
        {
530
            newPackageVersion( $entry, $versions{$entry}{suffix} );
652
            newPackageVersion( $entry, $versions{$entry}{suffix} );
-
 
653
            unless ( $globalError )
-
 
654
            {
-
 
655
                getSvnData();
-
 
656
                createImages();
-
 
657
            }
531
        }
658
        }
532
    }
659
    }
533
    else
660
    else
534
    {
661
    {
535
        processBranch(@allStartPoints);
662
        processBranch(@allStartPoints);
Line 662... Line 789...
662
        $opt_flat = 1;
789
        $opt_flat = 1;
663
        setPruneMode('none') unless (defined $opt_pruneModeString);
790
        setPruneMode('none') unless (defined $opt_pruneModeString);
664
    }
791
    }
665
 
792
 
666
 
793
 
667
    if ( $packageNames[0] =~ m'^br_applet_' )
794
    if ( $packageNames =~ m'^br_applet_' )
668
    {
795
    {
669
      $opt_flat = 1 unless defined $opt_flat;
796
      $opt_flat = 1 unless defined $opt_flat;
670
    }
797
    }
671
 
798
 
672
    foreach  ( @excludeFromImport )
799
    if ( exists $specialPackages{$packageNames} )
673
    {
800
    {
674
         $specialPackages{$_} .= 'protected,';
801
        my $data = ',' . $specialPackages{$packageNames} . ',';
675
    }
-
 
676
 
802
 
677
    if ( exists $specialPackages{$packageNames[0]} )
-
 
678
    {
-
 
679
        my $data = $specialPackages{$packageNames[0]};
-
 
680
        if ( index( $data, ',all' ) >= 0) {
803
        if ( index( $data, ',all' ) >= 0) {
681
            setPruneMode('none') unless (defined $opt_pruneModeString);
804
            setPruneMode('none') unless (defined $opt_pruneModeString);
682
        }
805
        }
683
        
806
        
684
        if ( index( $data, 'protected,' ) >= 0) {
807
        if ( index( $data, ',protected,' ) >= 0) {
685
            $noTransfer = 1;
808
            $noTransfer = 1;
686
        }
809
        }
687
 
810
 
688
        if ( index( $data, 'flat,' ) >= 0) {
811
        if ( index( $data, ',flat,' ) >= 0) {
-
 
812
            $opt_flat = 1;
-
 
813
        }
-
 
814
 
-
 
815
        if ( index( $data, ',flatTime,' ) >= 0) {
-
 
816
            Message ("Flatten import tree. Sort by Time");
689
            $opt_flat = 1;
817
            $opt_flat = 1;
-
 
818
            $flatMode = 1;          # By Time
-
 
819
            $opt_processRipples = 0;
690
        }
820
        }
-
 
821
        
691
 
822
 
692
        if ( index( $data, 'SetProjectBase,' ) >= 0) {
823
        if ( index( $data, ',SetProjectBase,' ) >= 0) {
693
            $opt_preserveProjectBase = 1;
824
            $opt_preserveProjectBase = 1;
694
            $opt_ignoreProjectBaseErrors = 1;
825
            $opt_ignoreProjectBaseErrors = 1;
695
            Message ("Preserving ProjectBase");
826
            Message ("Preserving ProjectBase");
696
        }
827
        }
697
 
828
 
-
 
829
        if ( index( $data, ',AllowMultiPath,' ) >= 0) {
-
 
830
            $opt_AllowMuliplePaths = 1;
-
 
831
            Message ("Allowing Multiple Paths");
-
 
832
        }
-
 
833
 
-
 
834
        if ( $data =~ m~,ForceProjectBase=(.*?),~ ) {
-
 
835
            $opt_forceProjectBase = $1;
-
 
836
            $opt_AllowMuliplePaths = 1;
-
 
837
            Message ("Force Project Base: $opt_forceProjectBase");
-
 
838
        }
-
 
839
 
-
 
840
        if ( $data =~ m~,LimitProjectBase=(.*?),~ ) {
-
 
841
            $opt_AllowMuliplePaths = 1;
-
 
842
            @opt_limitProjectBase = split(':', $1);
-
 
843
            Message ("Limit Project Base: @opt_limitProjectBase");
-
 
844
        }
-
 
845
 
-
 
846
        if ( $data =~ m~,mergePaths=(.*?),~ ) {
-
 
847
            @opt_mergePaths = split(':', $1);
-
 
848
            Message ("Merge Paths: @opt_mergePaths");
-
 
849
        }
-
 
850
 
698
        if ( index( $data, 'IgnoreProjectBase,' ) >= 0) {
851
        if ( index( $data, ',IgnoreProjectBase,' ) >= 0) {
699
            $opt_ignoreProjectBaseErrors = 1;
852
            $opt_ignoreProjectBaseErrors = 1;
700
            Message ("Ignore ProjectBase Errors");
853
            Message ("Ignore ProjectBase Errors");
701
        }
854
        }
702
 
855
 
703
        if ( index( $data, 'IgnoreMakeProject,' ) >= 0) {
856
        if ( index( $data, ',IgnoreMakeProject,' ) >= 0) {
704
            $opt_ignoreMakeProjectErrors = 1;
857
            $opt_ignoreMakeProjectErrors = 1;
705
            Message ("Ignore MakeProject Usage");
858
            Message ("Ignore MakeProject Usage");
706
        }
859
        }
707
        
-
 
708
 
860
 
-
 
861
        if ( index( $data, ',IgnoreBadPath,' ) >= 0) {
-
 
862
            $opt_ignoreBadPaths = 1;
-
 
863
            Message ("Ignore Bad Paths in makefile Usage");
-
 
864
        }
-
 
865
        
709
        if ( index( $data, 'utf8,' ) >= 0) {
866
        if ( index( $data, ',utf8,' ) >= 0) {
710
            $mustConvertFileNames = 1;
867
            $mustConvertFileNames = 1;
711
            Message ("Convert filenames to UTF8");
868
            Message ("Convert filenames to UTF8");
712
        }
869
        }
713
    }
870
    }
714
 
871
 
Line 1017... Line 1174...
1017
        }
1174
        }
1018
    }
1175
    }
1019
    
1176
    
1020
    #
1177
    #
1021
    #   Prune
1178
    #   Prune
1022
    #   Marks paths to root for all essential packages
1179
    #       Marks paths to root for all essential packages
1023
    #   Marks the last-N from all essential packages
1180
    #       Marks the last-N from all essential packages
1024
    #
1181
    #
1025
    if ( $pruneMode )
1182
    if ( $pruneMode )
1026
    {
1183
    {
1027
        Message ("Prune Tree: $pruneModeString");
1184
        Message ("Prune Tree: $pruneModeString");
1028
        foreach ( @EssentialPackages )
1185
        foreach ( @EssentialPackages )
Line 1048... Line 1205...
1048
        #
1205
        #
1049
        #   Keep recent versions
1206
        #   Keep recent versions
1050
        #       Keep versions created in the last N days
1207
        #       Keep versions created in the last N days
1051
        #       Will keep recent ripples too
1208
        #       Will keep recent ripples too
1052
        #
1209
        #
1053
        if ( $pruneMode == 1 )
1210
        if ( $pruneMode == 1 )                      # 1 == ripple
1054
        {
1211
        {
1055
            foreach my $entry ( keys(%versions) )
1212
            foreach my $entry ( keys(%versions) )
1056
            {
1213
            {
1057
                next unless ( $versions{$entry}{Age} <= $opt_recentAge  );
1214
                next unless ( $versions{$entry}{Age} <= $opt_recentAge  );
1058
                $versions{$entry}{keepRecent} = 1;
1215
                $versions{$entry}{keepRecent} = 1;
1059
                $recentCount++;
1216
                $recentCount++;
1060
#print "--- Recent version $versions{$entry}{vname}, $versions{$entry}{Age} <= $opt_recentAge\n";
1217
#print "--- Recent version $versions{$entry}{vname}, $versions{$entry}{Age} <= $opt_recentAge\n";
1061
            }
1218
            }
1062
 
1219
 
1063
#            #
1220
            #
1064
#            #   Keep the tip of each branch
1221
            #   Keep the tip of each branch
1065
#            #
1222
            #
1066
#            foreach my $entry ( @endPoints )
1223
            foreach my $entry ( @endPoints )
1067
#            {
1224
            {
-
 
1225
#print "--- Tip version $versions{$entry}{vname}\n";
-
 
1226
                my $count = 0;
-
 
1227
                while ( $entry && $count < 2)
-
 
1228
                {
1068
#                next if exists $versions{$entry}{keepRecent};
1229
                    last if ( $versions{$entry}{Essential} );
1069
#                $versions{$entry}{keepRecent} = 1;
1230
                    last if ( $versions{$entry}{keepRecent} );
-
 
1231
 
-
 
1232
                    next if ( $versions{$entry}{locked} eq 'N'  );
-
 
1233
                    next if ( $versions{$entry}{DeadWood} );
-
 
1234
 
1070
##print "--- Tip version $versions{$entry}{vname}\n";
1235
#print "--- Keeping Tip version $versions{$entry}{vname}\n";
-
 
1236
                    $versions{$entry}{keepRecent} = 1;
-
 
1237
                    $count++;
-
 
1238
 
-
 
1239
                } continue {
-
 
1240
                    $entry = $versions{$entry}{last};
-
 
1241
                }
1071
#            }
1242
            }
1072
        }
1243
        }
1073
        
1244
        
1074
        #
1245
        #
1075
        #   Keep versions that are common parents to Essential Versions
1246
        #   Keep versions that are common parents to Essential Versions
1076
        #       Mark paths through the tree to essential versions
1247
        #       Mark paths through the tree to essential versions
Line 1142... Line 1313...
1142
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
1313
            return 0 if ( ($pruneMode == 1) && ! $versions{$entry}{isaRipple} );
1143
            return 0 if ( exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
1314
            return 0 if ( exists $versions{$entry}{keepRecent} && $versions{$entry}{keepRecent} );
1144
            return 1;
1315
            return 1;
1145
        }
1316
        }
1146
 
1317
 
-
 
1318
 
-
 
1319
        #
-
 
1320
        #   Determine a list of entries to be pruned
-
 
1321
        #   Done in two steps so that we can skip the pruning if its only a small number
-
 
1322
        #
-
 
1323
        my @pruneList;
1147
        foreach my $entry ( keys(%versions) )
1324
        foreach my $entry ( keys(%versions) )
1148
        {
1325
        {
-
 
1326
            push ( @pruneList, $entry ) if ( pruneMe($entry) );
-
 
1327
        }
-
 
1328
 
-
 
1329
 
-
 
1330
        #
-
 
1331
        #   If the list is very small then just import all of them
1149
#last;
1332
        #
-
 
1333
        if ( scalar @pruneList < 10 )
-
 
1334
        {
-
 
1335
            Message ("Retaining pruned entries - low count:" . scalar @pruneList );
-
 
1336
            @pruneList = ();
-
 
1337
        } else {
-
 
1338
            my $total = scalar keys %versions;
-
 
1339
 
-
 
1340
            if ( scalar @pruneList < ($total / 15))
-
 
1341
            {
-
 
1342
                Message ("Retaining pruned entries - low percentage of $total:" . scalar @pruneList );
1150
            next unless ( pruneMe($entry) );
1343
                @pruneList = ();
-
 
1344
            }
-
 
1345
        }
-
 
1346
        
-
 
1347
 
-
 
1348
        foreach my $entry (@pruneList )
-
 
1349
        {
1151
#print "--- Prune: $versions{$entry}{vname}\n";
1350
#print "--- Prune: $versions{$entry}{vname}\n";
1152
 
1351
 
1153
            # Delete the current node
1352
            # Delete the current node
1154
            #
1353
            #
1155
            my @newNext;
1354
            my @newNext;
Line 1594... Line 1793...
1594
    if ( -f $cwd . '/stopfile' )
1793
    if ( -f $cwd . '/stopfile' )
1595
    {
1794
    {
1596
        $globalError = 1;
1795
        $globalError = 1;
1597
        Message ("Stop file located");
1796
        Message ("Stop file located");
1598
    }
1797
    }
1599
    if ( $opt_resume )
-
 
1600
    {
-
 
1601
        return
-
 
1602
        unless ( $opt_resume eq $versions{$entry}{vcsTag} );
-
 
1603
        $opt_resume = '';
-
 
1604
    }
-
 
1605
 
1798
 
1606
    #
1799
    #
1607
    #   If we have a global error,then we pretend to process, but we
1800
    #   If we have a global error,then we pretend to process, but we
1608
    #   report errors for the logging system
1801
    #   report errors for the logging system
1609
    #
1802
    #
Line 1657... Line 1850...
1657
    logToFile( $cwd . '/importsummary.txt', ";$line;");
1850
    logToFile( $cwd . '/importsummary.txt', ";$line;");
1658
 
1851
 
1659
    #
1852
    #
1660
    #   Sava data
1853
    #   Sava data
1661
    #
1854
    #
-
 
1855
    if ( $rv != 6 )
-
 
1856
    {
1662
    $data{errFlags} = $flags;
1857
        $data{errFlags} = $flags;
1663
    $data{duration} = $duration;
1858
        $data{duration} = $duration;
-
 
1859
    }
1664
    $versions{$entry}{rmRef} = $data{rmRef};
1860
    $versions{$entry}{rmRef} = $data{rmRef};
1665
    delete $data{rmRef};
1861
    delete $data{rmRef};
1666
    delete $data{tag};
1862
    delete $data{tag};
1667
    ##delete $data{ViewRoot};
1863
    ##delete $data{ViewRoot};
1668
    $versions{$entry}{data} = \%data;
1864
    $versions{$entry}{data} = \%data;
Line 1671... Line 1867...
1671
    #   Delete the created view
1867
    #   Delete the created view
1672
    #   Its just a directory, so delete it
1868
    #   Its just a directory, so delete it
1673
    #
1869
    #
1674
    if ( $data{ViewRoot} && -d $data{ViewRoot})
1870
    if ( $data{ViewRoot} && -d $data{ViewRoot})
1675
    {
1871
    {
1676
        if ( !$opt_reuse || ($rv && ($rv != 4 && $rv != 12 )) )
1872
        if ( $opt_reuse == 0 || $opt_reuse == 2 || ($rv && ($rv != 4 && $rv != 12 && $rv != 5 )) )
1677
        {
1873
        {
1678
            Message ("Delete View: $data{ViewRoot}");
1874
            Message ("Delete View: $data{ViewRoot}");
1679
            RmDirTree ($data{ViewRoot} );
1875
            RmDirTree ($data{ViewRoot} );
1680
        }
1876
        }
1681
        else
1877
        else
Line 1688... Line 1884...
1688
    {
1884
    {
1689
        Message ("No view to delete");
1885
        Message ("No view to delete");
1690
    }
1886
    }
1691
 
1887
 
1692
 
1888
 
1693
    #
-
 
1694
    #   If this version has any 'ripples' then process them while we have the
-
 
1695
    #   main view. Note the ripple list may contain entries that do not
-
 
1696
    #   exist - they will have been pruned.
1889
    if($opt_processRipples)
1697
    #
-
 
1698
if(1) {
-
 
1699
    foreach my $rentry ( @{$versions{$entry}{rippleList}} )
-
 
1700
    {
1890
    {
-
 
1891
        #
-
 
1892
        #   If this version has any 'ripples' then process them while we have the
-
 
1893
        #   main view. Note the ripple list may contain entries that do not
1701
        next unless( exists $versions{$rentry} );
1894
        #   exist - they will have been pruned.
1702
 
1895
        #
1703
        if ($versions{$rentry}{Processed})
1896
        foreach my $rentry ( @{$versions{$entry}{rippleList}} )
1704
        {
1897
        {
-
 
1898
            next unless( exists $versions{$rentry} );
-
 
1899
 
-
 
1900
            if ($versions{$rentry}{Processed})
-
 
1901
            {
1705
            Warning ("Ripple Processed before main entry");
1902
                Warning ("Ripple Processed before main entry");
1706
            $versions{$rentry}{rippleProcessed} = 1;
1903
                $versions{$rentry}{rippleProcessed} = 1;
1707
        }
1904
            }
1708
 
1905
 
1709
        Message ("Proccessing associated Ripple: " . GetVname($rentry));
1906
            Message ("Proccessing associated Ripple: " . GetVname($rentry));
1710
        newPackageVersion($rentry);
1907
            newPackageVersion($rentry);
-
 
1908
        }
1711
    }
1909
    }
1712
}
1910
}
1713
}
-
 
1714
 
1911
 
1715
#-------------------------------------------------------------------------------
1912
#-------------------------------------------------------------------------------
1716
# Function        : newPackageVersionBody
1913
# Function        : newPackageVersionBody
1717
#
1914
#
1718
# Description     : Perform the bulk of the work in creating a new PackageVersion
1915
# Description     : Perform the bulk of the work in creating a new PackageVersion
Line 1723... Line 1920...
1723
#                   $entry              - Package entry to process
1920
#                   $entry              - Package entry to process
1724
#
1921
#
1725
# Returns         : Error Code
1922
# Returns         : Error Code
1726
#                         0 - All is well
1923
#                         0 - All is well
1727
#                       <10 - Recoverable error
1924
#                       <10 - Recoverable error
-
 
1925
#                               1 - Bad VCS Tag
-
 
1926
#                               2 - No Files in the extracted view
-
 
1927
#                                   Label not found
-
 
1928
#                                   Failed to extract files from CC
-
 
1929
#                                   No Files in the extracted view after labeling dirs
-
 
1930
#                               3 - Deadwood
-
 
1931
#                               4 - Bad usage of ProjectBase detected
-
 
1932
#                                   Use of MakeProject detected
-
 
1933
#                               5  - Subversion Import disabled
-
 
1934
#                               6  - Restored via resume
1728
#                       >10 - Fatal error
1935
#                       >10 - Fatal error
1729
#
1936
#
1730
sub newPackageVersionBody
1937
sub newPackageVersionBody
1731
{
1938
{
1732
    my ($data, $entry) = @_;
1939
    my ($data, $entry) = @_;
1733
    my $rv;
1940
    my $rv;
-
 
1941
    my $vcs_type;
1734
    my $cc_label;
1942
    my $cc_label;
1735
    my $cc_path;
1943
    my $cc_path;
1736
    my $cc_path_original;
1944
    my $cc_path_original;
1737
 
1945
 
1738
    #
1946
    #
Line 1749... Line 1957...
1749
    SystemConfig ('ExitOnError' => 0);
1957
    SystemConfig ('ExitOnError' => 0);
1750
 
1958
 
1751
    push @processOrder, $entry;
1959
    push @processOrder, $entry;
1752
    return 0 if ( $opt_test );
1960
    return 0 if ( $opt_test );
1753
 
1961
 
-
 
1962
    #
-
 
1963
    #   Calculate the label for the target package
-
 
1964
    #   Use format <packageName>_<PackageVersion>
-
 
1965
    #   Need to handle WIPs too.
-
 
1966
    #
-
 
1967
    my $import_label = saneLabel($entry);
-
 
1968
 
-
 
1969
    #
-
 
1970
    #   If resuming - then test existence
-
 
1971
    #
-
 
1972
    if ( $opt_resume )
-
 
1973
    {
-
 
1974
        if ( exists $restoreData{$entry}  )
-
 
1975
        {
-
 
1976
 
-
 
1977
            #
-
 
1978
            #   May be able to test existence by looking at $versions{$entry}{svnVersion}
-
 
1979
            #   The hard work may have been done
-
 
1980
            #
-
 
1981
            my $isInSvn = 0;
-
 
1982
            if ( exists $versions{$entry}{svnVersion} && $versions{$entry}{svnVersion}  )
-
 
1983
            {
-
 
1984
                $isInSvn = 1;
-
 
1985
            }
-
 
1986
            Message("SvnVersion check: $isInSvn");
-
 
1987
 
-
 
1988
            $rv = testSvnLabel( "$svnRepo/$packageNames", $import_label );
-
 
1989
            unless ( $rv )
-
 
1990
            {
-
 
1991
                Message ("Skip import - resume detected presense");
-
 
1992
                $firstVersionCreated = $entry unless ( $firstVersionCreated );
-
 
1993
                $versions{$entry}{TagCreated} = 2;
-
 
1994
                foreach  ( keys %{$restoreData{$entry}} )
-
 
1995
                {
-
 
1996
                    $data->{$_} = $restoreData{$entry}{$_};
-
 
1997
                }
-
 
1998
                $forceImportFlush = 1;
-
 
1999
DebugDumpData('Data', $data );
-
 
2000
                return 6;
-
 
2001
            }
-
 
2002
        }
-
 
2003
        else
-
 
2004
        {
-
 
2005
            Warning ("Resume data missing");
-
 
2006
        }
-
 
2007
    }
-
 
2008
    
1754
#   Keep DeadWood. May be a WIP
2009
#   Keep DeadWood. May be a WIP
1755
#    if ( exists $versions{$entry}{DeadWood} && $versions{$entry}{DeadWood} )
2010
#    if ( exists $versions{$entry}{DeadWood} && $versions{$entry}{DeadWood} )
1756
#    {
2011
#    {
1757
#        $data->{errStr} = 'Package is DeadWood';
2012
#        $data->{errStr} = 'Package is DeadWood';
1758
#        return 3;
2013
#        return 3;
Line 1766... Line 2021...
1766
    {
2021
    {
1767
        Warning ("Error: Bad VcsTag for: " . GetVname($entry),
2022
        Warning ("Error: Bad VcsTag for: " . GetVname($entry),
1768
                 "Tag: $data->{tag}" );
2023
                 "Tag: $data->{tag}" );
1769
        $data->{errStr} = 'VCS Tag Marked as Bad';
2024
        $data->{errStr} = 'VCS Tag Marked as Bad';
1770
        return 1;
2025
        return 1;
-
 
2026
 
1771
    }
2027
    }
1772
 
2028
 
1773
 
2029
 
1774
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
2030
    $data->{tag} =~ m~^(.+?)::(.*?)(::(.+))?$~;
-
 
2031
    $vcs_type = $1;
1775
    $cc_label = $4;
2032
    $cc_label = $4;
1776
    $cc_path = $2;
2033
    $cc_path = $2;
1777
    $cc_path = '/' . $cc_path;
2034
    $cc_path = '/' . $cc_path;
1778
    $cc_path =~ tr~\\/~/~s;
2035
    $cc_path =~ tr~\\/~/~s;
1779
    $cc_path_original = $cc_path;
2036
    $cc_path_original = $cc_path;
1780
 
2037
 
1781
    #
2038
    #
1782
    #   Correct well known path mistakes
2039
    #   Correct well known path mistakes in CC paths
1783
    #
2040
    #
1784
    $cc_path =~ s~/build.pl$~~i;
-
 
1785
    $cc_path =~ s~/src$~~i;
-
 
1786
    $cc_path =~ s~/cpp$~~i;
-
 
1787
    $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
1788
    $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
1789
    $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
1790
    $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
1791
    $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
1792
    $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
1793
    $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
1794
    $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
1795
    $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
1796
    $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
1797
    $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
1798
 
-
 
1799
    $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
1800
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
1801
    $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
1802
    $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
1803
    $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
1804
 
-
 
1805
    if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
1806
        || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
1807
        || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
1808
        || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
1809
        || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
1810
        || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
1811
        || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
1812
        || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
1813
        || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
1814
        || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
1815
        || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
1816
        || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
1817
        || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
1818
        || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
1819
        || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
1820
        || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
1821
        || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
1822
        || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
1823
        || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
1824
        || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
1825
        || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
1826
        || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
1827
        || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
1828
        || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
1829
        || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
1830
        || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
1831
        || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
1832
        || $versions{$entry}{name} =~ m/^ERGfinman$/i
-
 
1833
        || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
1834
        || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
1835
        || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
1836
        || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
1837
        )
-
 
1838
    {
-
 
1839
        $cc_path = '/MREF_Package';
2041
    if ( $vcs_type eq 'CC' )
1840
    }
-
 
1841
 
-
 
1842
    if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
1843
    {
2042
    {
-
 
2043
        $cc_path =~ s~/build.pl$~~i;
-
 
2044
        $cc_path =~ s~/src$~~i;
-
 
2045
        $cc_path =~ s~/cpp$~~i;
-
 
2046
        $cc_path =~ s~/MASS_Dev/Infra/~/MASS_Dev_Infra/~i;
-
 
2047
        $cc_path =~ s~/MASS_Dev/Tools/~/MASS_Dev_Tools/~i;
-
 
2048
        $cc_path =~ s~/MASS_Dev/Bus/~/MASS_Dev_Bus/~i;
-
 
2049
        $cc_path =~ s~/MASS_Dev_Bus/Cbp/~/MASS_Dev_Bus/CBP/~i;
-
 
2050
        $cc_path =~ s~/MREF_Package/ergpostmongui$~/MREF_Package/ergpostmongui~i;
-
 
2051
        $cc_path =~ s~/MREF_../MREF_Package/~/MREF_Package/~i;
-
 
2052
        $cc_path =~ s~/MREF_Package/mass_ergocdp/~/MREF_Package/ergocdp/~i;
-
 
2053
        $cc_path =~ s~/MASS_Dev_Bus/CBP/systemCD.ejb~/MASS_Dev_Bus/CBP/systemCD/ejb~i;
-
 
2054
        $cc_path =~ s~/MASS_Dev_Bus/Financial/cpp/paymentmanager~/MASS_Dev_Bus/Financial/cpp/paymentmanager~i;
-
 
2055
        $cc_path =~ s~/MASS_Dev_Bus/WebServices~/MASS_Dev_Bus/WebServices~i;
-
 
2056
        $cc_path =~ s~/MASS_Dev_Bus/CBP/nullAdapter~//MASS_Dev_Bus/CBP/nullAdaptor~i;
-
 
2057
 
-
 
2058
        $cc_path = '/MASS_Dev_Bus' if ( $cc_path =~ m~/MASS_Dev_Bus/ImageCapture(/|$)~i );
-
 
2059
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'EJBEnqPxyConnector');
-
 
2060
        $cc_path = '/MASS_Dev_Bus/CBP/enquiry' if ( $versions{$entry}{name} eq 'proxyif4j');
-
 
2061
        $cc_path = '/MASS_Dev_Bus' if ( $versions{$entry}{name} eq 'ImageCaptureTomcatDeployment');
-
 
2062
        $cc_path = '/MASS_Dev_Bus/WebServices/MassWS' if ( $versions{$entry}{name} eq 'MassWebServicesImpl');
-
 
2063
 
-
 
2064
        if (   $versions{$entry}{name} =~ m/^ERGagency$/i
-
 
2065
            || $versions{$entry}{name} =~ m/^ERGavm$/i
-
 
2066
            || $versions{$entry}{name} =~ m/^ERGboi$/i
-
 
2067
            || $versions{$entry}{name} =~ m/^ERGcallcenter$/i
-
 
2068
            || $versions{$entry}{name} =~ m/^ERGcardholder$/i
-
 
2069
            || $versions{$entry}{name} =~ m/^ERGcdaimports$/i
-
 
2070
            || $versions{$entry}{name} =~ m/^ERGcda$/i
-
 
2071
            || $versions{$entry}{name} =~ m/^ERGcscedit$/i
-
 
2072
            || $versions{$entry}{name} =~ m/^ERGcs$/i
-
 
2073
            || $versions{$entry}{name} =~ m/^ERGofs$/i
-
 
2074
            || $versions{$entry}{name} =~ m/^ERGols$/i
-
 
2075
            || $versions{$entry}{name} =~ m/^ERGtpf$/i
-
 
2076
            || $versions{$entry}{name} =~ m/^ERGorasys$/i
-
 
2077
            || $versions{$entry}{name} =~ m/^ERGoracs$/i
-
 
2078
            || $versions{$entry}{name} =~ m/^ERGpxyif$/i
-
 
2079
            || $versions{$entry}{name} =~ m/^ERGtp5upg$/i
-
 
2080
            || $versions{$entry}{name} =~ m/^ERGinstitutional$/i
-
 
2081
            || $versions{$entry}{name} =~ m/^ERGinfra$/i
-
 
2082
            || $versions{$entry}{name} =~ m/^ERGcrrpts$/i
-
 
2083
            || $versions{$entry}{name} =~ m/^ERGmiddle$/i
-
 
2084
            || $versions{$entry}{name} =~ m/^ERGmiddleapi$/i
-
 
2085
            || $versions{$entry}{name} =~ m/^ERGwebapi$/i
-
 
2086
            || $versions{$entry}{name} =~ m/^ERGwebtestui$/i
-
 
2087
            || $versions{$entry}{name} =~ m/^ERGwebesbui$/i
-
 
2088
            || $versions{$entry}{name} =~ m/^ERGwspiv$/i
-
 
2089
            || $versions{$entry}{name} =~ m/^ERGwscst$/i
-
 
2090
            || $versions{$entry}{name} =~ m/^sposMUG$/i
-
 
2091
            || $versions{$entry}{name} =~ m/^ERGfinman$/i
1844
        if ( $versions{$entry}{version} =~ m~vtk$~ )
2092
            || $versions{$entry}{name} =~ m/^ERGkm$/i
-
 
2093
            || $versions{$entry}{name} =~ m/^ERGxml$/i
-
 
2094
            || $versions{$entry}{name} =~ m/^ERGoradacw$/i
-
 
2095
            || $versions{$entry}{name} =~ m/^ERGtru$/i
-
 
2096
            )
1845
        {
2097
        {
1846
            $cc_path = '/MREF_Package';
2098
            $cc_path = '/MREF_Package';
1847
        }
2099
        }
1848
    }
-
 
1849
 
2100
 
-
 
2101
        if (   $versions{$entry}{name} =~ m/^tp5000_MUG$/i )
-
 
2102
        {
-
 
2103
            if ( $versions{$entry}{version} =~ m~vtk$~ )
-
 
2104
            {
-
 
2105
                $cc_path = '/MREF_Package';
-
 
2106
            }
-
 
2107
        }
-
 
2108
 
-
 
2109
        $cc_path = $opt_forceProjectBase
-
 
2110
            if ( $opt_forceProjectBase );
-
 
2111
 
-
 
2112
        foreach ( @opt_limitProjectBase )
-
 
2113
        {
-
 
2114
            if ( $cc_path =~ m~$_~ )
-
 
2115
            {
-
 
2116
                $cc_path = $_;
-
 
2117
                last;
-
 
2118
            }
-
 
2119
        }
-
 
2120
        
1850
    if ( $cc_path_original ne $cc_path )
2121
        if ( $cc_path_original ne $cc_path )
1851
    {
2122
        {
1852
            Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
2123
                Message ("Package: $versions{$entry}{name}. Forcing CC path to: $cc_path" );
-
 
2124
        }
1853
    }
2125
    }
1854
    
2126
    
1855
#print "--- Path: $cc_path, Label: $cc_label\n";
2127
#print "--- Path: $cc_path, Label: $cc_label\n";
1856
 
2128
 
-
 
2129
    if ( $vcs_type eq 'SVN' )
1857
    #
2130
    {
-
 
2131
        $rv = extractFilesFromSubversion( $data, $entry );
-
 
2132
        return $rv if ( $rv );
-
 
2133
    }
-
 
2134
    else
-
 
2135
    {
-
 
2136
        #
1858
    #   Create CC view
2137
        #   Create CC view
1859
    #   Import into Subversion View
2138
        #   Import into Subversion View
1860
    #
2139
        #
1861
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
2140
        $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1862
    return $rv if ( $rv );
2141
        return $rv if ( $rv );
-
 
2142
    }
1863
 
2143
 
1864
    #
2144
    #
1865
    #   Developers have been slack
2145
    #   Developers have been slack
1866
    #       Sometime the mark the source path as 'GMTPE2005'
2146
    #       Sometime the mark the source path as 'GMTPE2005'
1867
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
2147
    #       Sometimes as 'GMTPE2005/Package/Fred/Jill/Harry'
1868
    #
2148
    #
1869
    #   Attempt to suck up empty directories below the specified
2149
    #   Attempt to suck up empty directories below the specified
1870
    #   source path
2150
    #   source path
1871
    #
2151
    #
1872
    unless ( $opt_preserveProjectBase )
2152
    unless ( $opt_preserveProjectBase || $opt_forceProjectBase || @opt_limitProjectBase)
1873
    {
2153
    {
1874
        #
2154
        #
1875
        #   Look in ViewPath
2155
        #   Look in ViewPath
1876
        #   If it contains only ONE directory then we can suck it up
2156
        #   If it contains only ONE directory then we can suck it up
1877
        #
2157
        #
Line 1880... Line 2160...
1880
        unless ( $data->{ViewPath} eq $testDir  )
2160
        unless ( $data->{ViewPath} eq $testDir  )
1881
        {
2161
        {
1882
            Message ("Adjust Base Dir: $testDir");
2162
            Message ("Adjust Base Dir: $testDir");
1883
            $data->{adjustedPath} = $data->{ViewPath};
2163
            $data->{adjustedPath} = $data->{ViewPath};
1884
            $data->{ViewPath} = $testDir;
2164
            $data->{ViewPath} = $testDir;
-
 
2165
            $adjustedPath++;
1885
        }
2166
        }
1886
    }
2167
    }
-
 
2168
    Message ("BaseDir: $data->{ViewPath}");
-
 
2169
 
-
 
2170
    #
-
 
2171
    #   Check for bad source paths
1887
    
2172
    #
-
 
2173
    if (detectBadMakePaths($data) )
-
 
2174
    {
-
 
2175
        unless ( $opt_ignoreBadPaths )
-
 
2176
        {
-
 
2177
            $data->{BadPath}++;
-
 
2178
            $data->{errStr} = 'Bad Paths in Makefile';
-
 
2179
            return 4;           # Lets see what the others look like too
-
 
2180
#            return 14;
-
 
2181
        }
-
 
2182
    }
-
 
2183
 
1888
    #
2184
    #
1889
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
2185
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1890
    #   Detect such packages as we will need to handle them differently
2186
    #   Detect such packages as we will need to handle them differently
1891
    #   Can't really handle it on the fly
2187
    #   Can't really handle it on the fly
1892
    #   All we can do is detect it and report it - at the moment
2188
    #   All we can do is detect it and report it - at the moment
1893
    #
2189
    #
1894
    if (detectProjectBaseUsage($data, $cc_path) )
2190
    if (detectProjectBaseUsage($data) )
1895
    {
2191
    {
1896
        unless ( $opt_ignoreProjectBaseErrors )
2192
        unless ( $opt_ignoreProjectBaseErrors )
1897
        {
2193
        {
1898
            $data->{BadProjectBase}++;
2194
            $data->{BadProjectBase}++;
1899
            $data->{errStr} = 'Bad usage of ProjectBase detected';
2195
            $data->{errStr} = 'Bad usage of ProjectBase detected';
-
 
2196
            Warning ("ProjectBase Error");
1900
            return 4;           # Lets see what the others look like too
2197
            return 4;           # Lets see what the others look like too
1901
#            return 14;
2198
#            return 14;
1902
        }
2199
        }
1903
    }
2200
    }
1904
 
2201
 
Line 1911... Line 2208...
1911
    #       Vob Name is not a part of the migration
2208
    #       Vob Name is not a part of the migration
1912
    #       If we 'SuckUp' empty directories then this may break
2209
    #       If we 'SuckUp' empty directories then this may break
1913
    #       the pathing.
2210
    #       the pathing.
1914
    #   All we can do is detect it and report it - at the moment
2211
    #   All we can do is detect it and report it - at the moment
1915
    #
2212
    #
1916
    if (detectMakeProjectUsage($data, $cc_path) )
2213
    if (detectMakeProjectUsage($data) )
1917
    {
2214
    {
1918
        unless ( $opt_ignoreMakeProjectErrors )
2215
        unless ( $opt_ignoreMakeProjectErrors )
1919
        {
2216
        {
1920
            $data->{BadMakeProject}++;
2217
            $data->{BadMakeProject}++;
1921
            $data->{errStr} = 'Use of MakeProject detected';
2218
            $data->{errStr} = 'Use of MakeProject detected';
Line 1957... Line 2254...
1957
    #
2254
    #
1958
    #   Have a CC view
2255
    #   Have a CC view
1959
    #   Now we can create the SVN package and branching point before we
2256
    #   Now we can create the SVN package and branching point before we
1960
    #   import the CC data into SVN
2257
    #   import the CC data into SVN
1961
    #
2258
    #
-
 
2259
    if ( !$opt_useSvn )
-
 
2260
    {
-
 
2261
            $data->{errStr} = 'Subversion Import disabled' unless $data->{errStr};
-
 
2262
            return 5;
-
 
2263
    }
-
 
2264
 
1962
    my @args;
2265
    my @args;
1963
 
2266
 
1964
    #
2267
    #
1965
    #   Calculate args for functions
2268
    #   Calculate args for functions
1966
    #
2269
    #
Line 1992... Line 2295...
1992
        $data->{errStr} = 'Failed to create Package';
2295
        $data->{errStr} = 'Failed to create Package';
1993
        return 10;
2296
        return 10;
1994
    }
2297
    }
1995
 
2298
 
1996
    #
2299
    #
1997
    #   Calculate the label for the target package
-
 
1998
    #   Use format <packageName>_<PackageVersion>
-
 
1999
    #   Need to handle WIPs too.
-
 
2000
    #
-
 
2001
    my $import_label = saneLabel($entry);
-
 
2002
 
-
 
2003
    #
-
 
2004
    #   May need to create the branchpoint
2300
    #   May need to create the branchpoint
2005
    #   The process is delayed until its needed so avoid creating unneeded
2301
    #   The process is delayed until its needed so avoid creating unneeded
2006
    #   branch points
2302
    #   branch points
2007
    #
2303
    #
2008
    if ( $createBranch )
2304
    if ( $createBranch )
Line 2014... Line 2310...
2014
        {
2310
        {
2015
            $data->{errStr} = 'Failed to create Branch Point';
2311
            $data->{errStr} = 'Failed to create Branch Point';
2016
            return 11;
2312
            return 11;
2017
        }
2313
        }
2018
    }
2314
    }
2019
    push @args, "-branch=$currentBranchName" if ( defined $currentBranchName );
-
 
2020
 
2315
 
-
 
2316
    #
-
 
2317
    #   If we are in resume mode then we MUST kill the import directory
-
 
2318
    #   if we have skipped anything
-
 
2319
    #
-
 
2320
    if ( $forceImportFlush )
-
 
2321
    {
-
 
2322
        $forceImportFlush = 0;
-
 
2323
        RmDirTree ('SvnImportDir');
-
 
2324
    }
-
 
2325
 
-
 
2326
    push @args, "-branch=$currentBranchName" if ( defined $currentBranchName );
2021
    my $datafile = "importdata.$import_label.properties";
2327
    my $datafile = "importdata.$import_label.properties";
-
 
2328
    push (@args, "-mergePaths", join(',', @opt_mergePaths) ) if ( @opt_mergePaths );
-
 
2329
 
2022
    $rv = JatsToolPrint ( 'jats_svn', 'import', '-reuse' ,
2330
    $rv = JatsToolPrint ( 'jats_svn', 'import', '-reuse' ,
2023
                    "-package=$svnRepo/$packageNames",
2331
                    "-package=$svnRepo/$packageNames",
2024
                    "-dir=$data->{ViewPath}",
2332
                    "-dir=$data->{ViewPath}",
2025
                    "-label=$import_label",
2333
                    "-label=$import_label",
2026
                    "-datafile=$datafile",
2334
                    "-datafile=$datafile",
Line 2041... Line 2349...
2041
    #   Retain entries in a global file
2349
    #   Retain entries in a global file
2042
    #
2350
    #
2043
    if ( -f $datafile  )
2351
    if ( -f $datafile  )
2044
    {
2352
    {
2045
        my $rmData = JatsProperties::New($datafile);
2353
        my $rmData = JatsProperties::New($datafile);
-
 
2354
        if ( $rmData->getProperty('subversion.tag') )
-
 
2355
        {
2046
        $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
2356
            $data->{rmRef} = 'SVN::' . $rmData->getProperty('subversion.tag');
-
 
2357
        }
-
 
2358
        else
-
 
2359
        {
-
 
2360
            Warning ("Property files has no subversion.tag");
-
 
2361
        }
-
 
2362
        $data->{fileCount}    = $rmData->getProperty('files.base', 0);
-
 
2363
        $data->{filesRemoved} = $rmData->getProperty('files.removed',0);
-
 
2364
        $data->{filesAdded}   = $rmData->getProperty('files.added',0);
2047
    }
2365
    }
2048
 
2366
 
2049
    unless ( $data->{rmRef}  )
2367
    unless ( $data->{rmRef}  )
2050
    {
2368
    {
2051
        $data->{errStr} = 'Failed to determine Rm Reference';
2369
        $data->{errStr} = 'Failed to determine Rm Reference';
Line 2182... Line 2500...
2182
    push (@opts, '-author', $author) if ( $author );
2500
    push (@opts, '-author', $author) if ( $author );
2183
    #
2501
    #
2184
    #   Only do once
2502
    #   Only do once
2185
    #
2503
    #
2186
    return unless ( $createPackageDone );
2504
    return unless ( $createPackageDone );
-
 
2505
    return if ( $opt_resume );
2187
    $createPackageDone = 0;
2506
    $createPackageDone = 0;
2188
 
2507
 
2189
    #
2508
    #
2190
    #   Real import
2509
    #   Real import
2191
    #       Do not Delete package if it exists
2510
    #       Do not Delete package if it exists
Line 2347... Line 2666...
2347
    #
2666
    #
2348
    #   Perform the branch
2667
    #   Perform the branch
2349
    #
2668
    #
2350
    if ( defined $src_label )
2669
    if ( defined $src_label )
2351
    {
2670
    {
-
 
2671
        if ( $opt_resume )
-
 
2672
        {
-
 
2673
            my $rv = JatsToolPrint ( 'jats_svnlabel',
-
 
2674
                        '-check',
-
 
2675
                        '-packagebase', "$svnRepo/$packageNames",
-
 
2676
                        '-branch',
-
 
2677
                        $tgt_label );
-
 
2678
            return unless ( $rv );
-
 
2679
        }
-
 
2680
 
2352
        #
2681
        #
2353
        #   The 'clone' operation will backtrack the branch point
2682
        #   The 'clone' operation will backtrack the branch point
2354
        #   to the source of the label. This will make the output version
2683
        #   to the source of the label. This will make the output version
2355
        #   tree much prettier
2684
        #   tree much prettier
2356
        #
2685
        #
Line 2381... Line 2710...
2381
#
2710
#
2382
sub endPackage
2711
sub endPackage
2383
{
2712
{
2384
    Message ("-- Import Summary ------------------------------------------------" );
2713
    Message ("-- Import Summary ------------------------------------------------" );
2385
    RmDirTree ('SvnImportDir');
2714
    RmDirTree ('SvnImportDir');
-
 
2715
    my $processedCount = 0;
-
 
2716
    my $inernalErrorCount = 0;
-
 
2717
    my $notProcessedCount = 0;
-
 
2718
    my $badPathCount = 0;
-
 
2719
    my $badProjectBaseCount = 0;
-
 
2720
    my $badMakeProjectCount = 0;
2386
 
2721
 
2387
    #
2722
    #
2388
    #   Display versions that did get captured
2723
    #   Display versions that did get captured
2389
    #
2724
    #
2390
    foreach my $entry ( @processOrder )
2725
    foreach my $entry ( @processOrder )
2391
    {
2726
    {
2392
        $versions{$entry}{Scanned} = 1;
2727
        $versions{$entry}{Scanned} = 1;
2393
        next unless ( $versions{$entry}{TagCreated} );
2728
        next unless ( $versions{$entry}{TagCreated} );
-
 
2729
        my $eflag = $versions{$entry}{Essential} ? 'E' : ' ';
2394
        Warning ("Processed: " . GetVname($entry) . ' :: ' . $versions{$entry}{rmRef} || $versions{$entry}{errStr} || '???' );
2730
        Warning ("Processed:$eflag:" . GetVname($entry) . ' :: ' . $versions{$entry}{rmRef} || $versions{$entry}{errStr} || '???' );
2395
    }
2731
    }
2396
 
2732
 
2397
    #
2733
    #
2398
    #   Display versions that did not get created
2734
    #   Display versions that did not get created
2399
    #
2735
    #
2400
    foreach my $entry ( @processOrder )
2736
    foreach my $entry ( @processOrder )
2401
    {
2737
    {
2402
        $versions{$entry}{Scanned} = 1;
2738
        $versions{$entry}{Scanned} = 1;
2403
        next if ( $versions{$entry}{TagCreated} );
2739
        if ( $versions{$entry}{TagCreated} )
-
 
2740
        {
-
 
2741
            $processedCount++;
-
 
2742
            $badPathCount++ if ($versions{$entry}{data}{BadPath} );
-
 
2743
            $badProjectBaseCount++ if ($versions{$entry}{data}{BadProjectBase} );
-
 
2744
            $badMakeProjectCount++ if ($versions{$entry}{data}{BadMakeProject} );
-
 
2745
            next;
-
 
2746
        }
-
 
2747
 
2404
        my $reason = $versions{$entry}{data}{errStr} || '';
2748
        my $reason = $versions{$entry}{data}{errStr} || '';
2405
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
2749
        my $tag = $versions{$entry}{vcsTag}|| 'No Tag';
-
 
2750
        my $eflag = $versions{$entry}{Essential} ? 'E' : ' ';
2406
        Warning ("Not Processed: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
2751
        Warning ("Not Processed:$eflag: " . GetVname($entry) . ':' . $tag . ' : ' . $reason );
-
 
2752
        $notProcessedCount++;
2407
    }
2753
    }
2408
 
2754
 
2409
    foreach my $entry ( keys(%versions) )
2755
    foreach my $entry ( keys(%versions) )
2410
    {
2756
    {
2411
        next if ( $versions{$entry}{Scanned} );
2757
        next if ( $versions{$entry}{Scanned} );
2412
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2758
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
-
 
2759
        $inernalErrorCount++;
2413
    }
2760
    }
2414
 
2761
 
-
 
2762
    if ( $adjustedPath || 1 )
-
 
2763
    {
-
 
2764
        Information ("Package Info: Files, Removed, Added, Version, ViewPath");
-
 
2765
        foreach my $entry ( @processOrder )
-
 
2766
        {
-
 
2767
            my $viewPath = $versions{$entry}{data}{ViewPath} || '';
-
 
2768
            Information (sprintf "%4s, %4s, %4s, %20s : %s",
-
 
2769
                        $versions{$entry}{data}{fileCount} || '-',
-
 
2770
                        $versions{$entry}{data}{filesRemoved} || '-',
-
 
2771
                        $versions{$entry}{data}{filesAdded} || '-',
-
 
2772
                        GetVname($entry), $viewPath);
-
 
2773
        }
-
 
2774
    }
-
 
2775
 
-
 
2776
    Message ("Packages processed: $processedCount");
-
 
2777
    Warning ("Packages not processed: $notProcessedCount") if ( $notProcessedCount );
-
 
2778
    Warning ("Internal Errors: $inernalErrorCount") if ( $inernalErrorCount );
-
 
2779
    Warning ("Multiple source paths", @multiplePaths ) if ( scalar @multiplePaths > 1 );
2415
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2780
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
-
 
2781
    Warning ("Packages with Bad Paths: $badPathCount") if ( $badPathCount );
-
 
2782
    Warning ("Packages with Bad ProjectBase: $badProjectBaseCount") if ( $badProjectBaseCount );
-
 
2783
    Warning ("Packages with MakeProjects: $badMakeProjectCount") if ( $badMakeProjectCount );
-
 
2784
    Warning ("Global Error Detected") if ( $globalError );
2416
    Message ("All Done");
2785
    Message ("---- All Done -----");
2417
}
2786
}
2418
 
2787
 
2419
#-------------------------------------------------------------------------------
2788
#-------------------------------------------------------------------------------
2420
# Function        : extractFilesFromClearCase
2789
# Function        : extractFilesFromClearCase
2421
#
2790
#
Line 2436... Line 2805...
2436
{
2805
{
2437
    my ($data, $cc_path, $cc_label) = @_;
2806
    my ($data, $cc_path, $cc_label) = @_;
2438
    my $tryCount = 0;
2807
    my $tryCount = 0;
2439
    my $rv = 99;
2808
    my $rv = 99;
2440
 
2809
 
2441
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
2810
    $data->{ViewRoot} = ( defined $opt_name && ! defined $opt_mergePackages )? $opt_name : "$cc_label";
2442
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
2811
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
2443
    
2812
    
2444
    if ( $opt_preserveProjectBase )
2813
    if ( $opt_preserveProjectBase && !$opt_forceProjectBase )
2445
    {
2814
    {
2446
        my $cc_vob = $cc_path;
2815
        my $cc_vob = $cc_path;
2447
        $cc_vob =~ s~^/~~;
2816
        $cc_vob =~ s~^/~~;
2448
        $cc_vob =~ s~/.*~~;
2817
        $cc_vob =~ s~/.*~~;
2449
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
2818
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
Line 2457... Line 2826...
2457
        return 0;
2826
        return 0;
2458
    }
2827
    }
2459
 
2828
 
2460
    while ( $rv == 99 ) {
2829
    while ( $rv == 99 ) {
2461
        my @args;
2830
        my @args;
2462
        push (@args, '-view', $opt_name ) if ( defined $opt_name );
2831
        push (@args, '-view', $opt_name ) if ( defined $opt_name && ! defined $opt_mergePackages );
2463
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
2832
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
2464
                    "-label=$cc_label" ,
2833
                    "-label=$cc_label" ,
2465
                    "-path=$cc_path",
2834
                    "-path=$cc_path",
2466
                    @args
2835
                    @args
2467
                    );
2836
                    );
Line 2526... Line 2895...
2526
    return 2;
2895
    return 2;
2527
 
2896
 
2528
}
2897
}
2529
 
2898
 
2530
#-------------------------------------------------------------------------------
2899
#-------------------------------------------------------------------------------
-
 
2900
# Function        : extractFilesFromSubversion
-
 
2901
#
-
 
2902
# Description     : Extract files from Subversion
-
 
2903
#                   May take a while as we handle nasty errors
-
 
2904
#
-
 
2905
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2906
#                   $entry          - All the PV information
-
 
2907
#
-
 
2908
# Returns         : exit code
-
 
2909
#                   Sets up
-
 
2910
#                       $data->{errStr}
-
 
2911
#                       $data->{errCode}
-
 
2912
#                   As per newPackageVersionBody
-
 
2913
#
-
 
2914
sub extractFilesFromSubversion
-
 
2915
{
-
 
2916
    my ($data, $entry ) = @_;
-
 
2917
    my $tryCount = 0;
-
 
2918
    my $rv = 99;
-
 
2919
 
-
 
2920
    #
-
 
2921
    #   Create a nice name for the import
-
 
2922
    #
-
 
2923
    my $import_label = saneLabel($entry);
-
 
2924
    
-
 
2925
 
-
 
2926
    $data->{ViewRoot} = $opt_name ? $opt_name : $import_label;
-
 
2927
    $data->{ViewPath} =  $data->{ViewRoot};
-
 
2928
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2929
 
-
 
2930
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2931
    {
-
 
2932
        Message ("Reusing view: $import_label");
-
 
2933
        return 0;
-
 
2934
    }
-
 
2935
 
-
 
2936
    #
-
 
2937
    #   Only allow import from SVN if asked nicely
-
 
2938
    #   May be used if we are correcting a package - and some have been
-
 
2939
    #   placed in SVN
-
 
2940
    #
-
 
2941
    unless ( $opt_extractFromSvn )
-
 
2942
    {
-
 
2943
        $data->{errStr} = 'Some Packages are in SVN';
-
 
2944
        return 15;
-
 
2945
    }
-
 
2946
    
-
 
2947
 
-
 
2948
#print "--- ViewRoot: $data->{ViewPath}\n";
-
 
2949
    $rv = JatsToolPrint ( 'jats_svnrelease',
-
 
2950
                          '-extractfiles',
-
 
2951
                          '-root=.' ,
-
 
2952
                          '-noprefix',
-
 
2953
                          '-DevMode=escrow',
-
 
2954
                          '-label', $data->{tag},
-
 
2955
                          '-view', $data->{ViewPath},
-
 
2956
                );
-
 
2957
 
-
 
2958
    if ( $rv == 10 ) {
-
 
2959
        $data->{errStr}  = 'No Files in the extracted view';
-
 
2960
        $data->{errCode} = '0';
-
 
2961
        return 2;
-
 
2962
 
-
 
2963
    } elsif ( $rv == 11 ) {
-
 
2964
        $data->{errStr} = 'Label not found';
-
 
2965
        $data->{errCode} = 'L';
-
 
2966
        return 2;
-
 
2967
    } elsif ( $rv ) {
-
 
2968
        $data->{errStr} = 'Subversion reported error';
-
 
2969
        return 2;
-
 
2970
    }
-
 
2971
 
-
 
2972
    unless ( -d $data->{ViewPath}  )
-
 
2973
    {
-
 
2974
        $data->{errStr} = 'Failed to extract files from Subversion';
-
 
2975
        return 2;
-
 
2976
    }
-
 
2977
 
-
 
2978
    #
-
 
2979
    #   Looks good
-
 
2980
    #
-
 
2981
    return 0;
-
 
2982
}
-
 
2983
 
-
 
2984
#-------------------------------------------------------------------------------
2531
# Function        : detectMakeProjectUsage
2985
# Function        : detectMakeProjectUsage
2532
#
2986
#
2533
# Description     : etect and report usage of the MakeProject directive
2987
# Description     : etect and report usage of the MakeProject directive
2534
#
2988
#
2535
# Inputs          : $data               - Ref to a hash of bits
2989
# Inputs          : $data               - Ref to a hash of bits
2536
#                   $cc_path            - Packages cc_path
-
 
2537
#
2990
#
2538
# Returns         : true    - Bad usage (Really good usage not detected)
2991
# Returns         : true    - Bad usage (Really good usage not detected)
2539
#                   false   - Good usage detected
2992
#                   false   - Good usage detected
2540
#
2993
#
2541
sub detectMakeProjectUsage
2994
sub detectMakeProjectUsage
2542
{
2995
{
2543
    my ($data, $cc_path) = @_;
2996
    my ($data) = @_;
2544
    my $retval = 0;
2997
    my $retval = 0;
2545
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2998
    my $eSuf = $opt_ignoreMakeProjectErrors ? '' : 'Error';
2546
 
2999
 
2547
    #
3000
    #
2548
    #   Find makefile.pl
3001
    #   Find makefile.pl
2549
    #
3002
    #
2550
    Message ("Locate JATS makefiles");
3003
    Message ("Detect MakeProject Usage");
2551
    my $usesMakeProject = 0;
3004
    my $usesMakeProject = 0;
2552
    my $badIncludeFile = 0;
3005
    my $badIncludeFile = 0;
2553
 
3006
 
2554
    my $search = JatsLocateFiles->new("--Recurse=1",
3007
    my $search = JatsLocateFiles->new("--Recurse=1",
2555
                                       "--FilterIn=makefile.pl",
3008
                                       "--FilterIn=makefile.pl",
Line 2597... Line 3050...
2597
                    #
3050
                    #
2598
                    my @myArgs;
3051
                    my @myArgs;
2599
                    my $myProjectDir;
3052
                    my $myProjectDir;
2600
                    my $myProject = "$data->{ViewRoot}/$file";
3053
                    my $myProject = "$data->{ViewRoot}/$file";
2601
                    $myProject =~ s~/[^/]+$~~;
3054
                    $myProject =~ s~/[^/]+$~~;
-
 
3055
 
2602
                    $line =~ s~MakeProject~push \@myArgs,~;
3056
                    unless ($line =~ m~\s*(\w+)\s*\((.*)\)\s*;\s*$~ )
2603
                    eval $line;
3057
                    {
2604
                    Error("Line did not compiler: $line", "Err: $@" ) if ($@);
3058
                        Error("Could not detect arguments: $line");
-
 
3059
                    }
-
 
3060
                    my $args = $2;
-
 
3061
                    $args =~ tr~'" ~ ~s;
-
 
3062
                    @myArgs = split (/\s*,\s*/, $args);
2605
                    shift @myArgs;
3063
                    shift @myArgs;
2606
                    foreach ( @myArgs )
3064
                    foreach ( @myArgs )
2607
                    {
3065
                    {
2608
                        next if ( m~^--~ );
3066
                        next if ( m~^--~ );
2609
                        $myProject .= '/' . $_;
3067
                        $myProject .= '/' . $_;
2610
                        $myProjectDir = $myProject;
3068
                        $myProjectDir = $myProject;
2611
                        $myProjectDir =~ s~/[^/]+$~~;
3069
                        $myProjectDir =~ s~/[^/]+$~~;
2612
                        last;
3070
                        last;
2613
                    }
3071
                    }
2614
                    Error ("No project Found") unless ( defined $myProjectDir);
3072
                    Error ("No project Found") unless ( defined $myProjectDir);
-
 
3073
 
-
 
3074
                    #
-
 
3075
                    #   Look for 'include.txt' that may be bwteen the makefile and the project
-
 
3076
                    #
-
 
3077
 
-
 
3078
 
2615
                    if ( -f "$myProjectDir/include.txt" )
3079
                    if ( -f "$myProjectDir/include.txt" )
2616
                    {
3080
                    {
2617
                        Warning ("Co-located 'include.txt' file also found");
3081
                        Warning ("Co-located 'include.txt' file also found");
2618
                    }
3082
                    }
2619
 
3083
 
Line 2717... Line 3181...
2717
    
3181
    
2718
    return $retval;
3182
    return $retval;
2719
}
3183
}
2720
 
3184
 
2721
#-------------------------------------------------------------------------------
3185
#-------------------------------------------------------------------------------
-
 
3186
# Function        : detectBadMakePaths
-
 
3187
#
-
 
3188
# Description     : Detect and report bad usage of some directives
-
 
3189
#
-
 
3190
# Inputs          : $data               - Ref to a hash of bits
-
 
3191
#
-
 
3192
# Returns         : true    - Bad usage (Really good usage not detected)
-
 
3193
#                   false   - Good usage detected
-
 
3194
#
-
 
3195
sub detectBadMakePaths
-
 
3196
{
-
 
3197
    my ($data) = @_;
-
 
3198
    my $retval = 0;
-
 
3199
    my $eSuf = $opt_ignoreBadPaths ? '' : 'Error';
-
 
3200
 
-
 
3201
    #
-
 
3202
    #   Find makefile.pl
-
 
3203
    #
-
 
3204
    Message ("Detect Bad Source Paths");
-
 
3205
    my $badPath = 0;
-
 
3206
 
-
 
3207
    my $search = JatsLocateFiles->new("--Recurse=1",
-
 
3208
                                       "--FilterIn=makefile.pl",
-
 
3209
                                       );
-
 
3210
    my @makefiles = $search->search($data->{ViewPath});
-
 
3211
    foreach my $file ( @makefiles )
-
 
3212
    {
-
 
3213
        $file =~ tr~/~/~s;
-
 
3214
        my $max_up = ($file =~ tr~/~/~);
-
 
3215
        my $shownPath;
-
 
3216
#print "---Reading: $workDir/$data->{ViewPath}/$file\n";
-
 
3217
        if ( open( my $fh, '<', "$data->{ViewPath}/$file" ) )
-
 
3218
        {
-
 
3219
            my $eof = 0;
-
 
3220
            my $line = '';
-
 
3221
 
-
 
3222
            until ( $eof )
-
 
3223
            {
-
 
3224
                my $in = <$fh>;
-
 
3225
                unless ( defined $in )
-
 
3226
                {
-
 
3227
                    $eof = 1;
-
 
3228
                }
-
 
3229
                else
-
 
3230
                {
-
 
3231
                $in =~ s~\s+$~~;
-
 
3232
                $in =~ s~^\s+~~;
-
 
3233
                $in =~ s~^#.*$~~;
-
 
3234
                $in =~ s~\s*[^\$]#.*$~~;
-
 
3235
                $line .= ' ' if ( $line );
-
 
3236
                $line .= $in;
-
 
3237
                $line =~ s~\s+~ ~g;
-
 
3238
#print "====== '$line'\n";
-
 
3239
                redo unless ( $line =~ m~;$~  );
-
 
3240
                }
-
 
3241
                if ( $line =~ m~^AddDir~ || $line =~ m~^AddSrcDir~ || $line =~ m~^AddIncDir~ || $line =~ m~^Src~ )
-
 
3242
                {
-
 
3243
                    #
-
 
3244
                    #   Extract out the arguments
-
 
3245
                    #
-
 
3246
                    my @myArgs;
-
 
3247
                    my $myProjectDir;
-
 
3248
                    my $myProject = "$data->{ViewRoot}/$file";
-
 
3249
                    $myProject =~ s~/[^/]+$~~;
-
 
3250
 
-
 
3251
                    unless ($line =~ m~\s*(\w+)\s*\((.*)\)\s*;\s*$~ )
-
 
3252
                    {
-
 
3253
                        Error("Could not detect arguments: $line");
-
 
3254
                    }
-
 
3255
                    my $args = $2;
-
 
3256
                    $args =~ tr~'" ~ ~s;
-
 
3257
                    @myArgs = split (/\s*,\s*/, $args);
-
 
3258
                    shift @myArgs;
-
 
3259
                    foreach ( @myArgs )
-
 
3260
                    {
-
 
3261
                        next if ( m~^--~ );
-
 
3262
                        next unless ( m~^\.\./~ );
-
 
3263
                        my $tmp = $_;
-
 
3264
                        $tmp =~ s~Z~z~g;
-
 
3265
                        $tmp =~ s~\.\./~Z~g;
-
 
3266
                        my $upCount = ( $tmp =~ tr~Z~Z~ );
-
 
3267
                        if ( $upCount > $max_up )
-
 
3268
                        {
-
 
3269
                            Warning ("Makefile Path: $file ") unless $shownPath;
-
 
3270
                            Warning ("Path escapes view: $max_up, $upCount, $_");
-
 
3271
                            $badPath++;
-
 
3272
                            $shownPath = 1;
-
 
3273
                        }
-
 
3274
#print "---x Path : $max_up, $upCount, $_\n";
-
 
3275
                    }
-
 
3276
                }
-
 
3277
                $line = '';
-
 
3278
            }
-
 
3279
            close $fh;
-
 
3280
        }
-
 
3281
        else
-
 
3282
        {
-
 
3283
            Warning ("detectBadMakePaths$eSuf - Cannot open makefile: $file");
-
 
3284
            $retval = 1;
-
 
3285
        }
-
 
3286
    }
-
 
3287
 
-
 
3288
    #
-
 
3289
    #   Used
-
 
3290
    #   May be improved latter
-
 
3291
    #
-
 
3292
    if ( $badPath )
-
 
3293
    {
-
 
3294
        Warning ("detectBadMakePaths$eSuf - Bad Path seen. Must check manually");
-
 
3295
        $retval = 1;
-
 
3296
    }
-
 
3297
    
-
 
3298
    return $retval;
-
 
3299
}
-
 
3300
 
-
 
3301
 
-
 
3302
#-------------------------------------------------------------------------------
2722
# Function        : detectProjectBaseUsage
3303
# Function        : detectProjectBaseUsage
2723
#
3304
#
2724
# Description     : Detect and report usage of the SetProjectBase directive
3305
# Description     : Detect and report usage of the SetProjectBase directive
2725
#
3306
#
2726
# Inputs          : $data               - Ref to a hash of bits
3307
# Inputs          : $data               - Ref to a hash of bits
2727
#                   $cc_path            - Packages cc_path
-
 
2728
#
3308
#
2729
# Returns         : true    - Bad usage (Really good usage not detected)
3309
# Returns         : true    - Bad usage (Really good usage not detected)
2730
#                   false   - Good usage detected
3310
#                   false   - Good usage detected
2731
#
3311
#
2732
sub detectProjectBaseUsage
3312
sub detectProjectBaseUsage
2733
{
3313
{
2734
    my ($data, $cc_path) = @_;
3314
    my ($data) = @_;
2735
    my $retval = 0;
3315
    my $retval = 0;
2736
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
3316
    my $eSuf = $opt_ignoreProjectBaseErrors ? '' : 'Error';
2737
 
3317
 
2738
    #
3318
    #
2739
    #   Find makefile.pl
3319
    #   Find makefile.pl
2740
    #
3320
    #
2741
    Message ("Locate JATS makefiles");
3321
    Message ("Detect ProjectBase Usage");
2742
    my $usesProjectBase = 0;
3322
    my $usesProjectBase = 0;
2743
    my $definesProjectBase = 0;
3323
    my $definesProjectBase = 0;
2744
    my $definitionError = 0;
3324
    my $definitionError = 0;
2745
 
3325
 
2746
    my $search = JatsLocateFiles->new("--Recurse=1",
3326
    my $search = JatsLocateFiles->new("--Recurse=1",
2747
                                       "--FilterIn=makefile.pl",
3327
                                       "--FilterIn=makefile.pl",
2748
                                       );
3328
                                       );
2749
    my @makefiles = $search->search($data->{ViewRoot});
3329
    my @makefiles = $search->search($data->{ViewPath});
2750
    foreach my $file ( @makefiles )
3330
    foreach my $file ( @makefiles )
2751
    {
3331
    {
2752
        if ( open( my $fh, '<', "$data->{ViewRoot}/$file" ) )
3332
        if ( open( my $fh, '<', "$data->{ViewPath}/$file" ) )
2753
        {
3333
        {
2754
            while ( <$fh> )
3334
            while ( <$fh> )
2755
            {
3335
            {
2756
                s~\s+$~~;
3336
                s~\s+$~~;
2757
                s~^\s+~~;
3337
                s~^\s+~~;
Line 2767... Line 3347...
2767
                if ( m~^SetProjectBase~ )
3347
                if ( m~^SetProjectBase~ )
2768
                {
3348
                {
2769
                    $definesProjectBase++;
3349
                    $definesProjectBase++;
2770
                    $data->{DefinesProjectBase}++;
3350
                    $data->{DefinesProjectBase}++;
2771
                    Warning ("Package initialises SetProjectBase:",
3351
                    Warning ("Package initialises SetProjectBase:",
2772
                             "Line: " . $_,
3352
                             "Line : " . $_,
2773
                             "Root: " . "$data->{ViewRoot}",
3353
                             "Root : " . "$data->{ViewRoot}",
-
 
3354
                             "Path : " . "$data->{ViewPath}",
2774
                             "File: " . "$data->{ViewRoot}/$file",
3355
                             "File : " . "$data->{ViewPath}/$file",
2775
                            );
3356
                            );
2776
 
3357
 
2777
                    # The only problem is if the user attempts to escape
3358
                    # The only problem is if the user attempts to escape
2778
                    # from the root of the view.
3359
                    # from the root of the view.
2779
                    #
3360
                    #
Line 2784... Line 3365...
2784
                    # Locate the build.pl file
3365
                    # Locate the build.pl file
2785
                    # This is the basis for for the directive
3366
                    # This is the basis for for the directive
2786
                    #
3367
                    #
2787
                    my $blevel;
3368
                    my $blevel;
2788
                    my @bpaths = split ('/', $file );
3369
                    my @bpaths = split ('/', $file );
-
 
3370
                    my $buildFile;
2789
                    while ( @bpaths )
3371
                    while ( @bpaths )
2790
                    {
3372
                    {
2791
                        $bpaths[-1] = 'build.pl';
3373
                        $bpaths[-1] = 'build.pl';
2792
                        my $bfile = join '/', @bpaths ;
3374
                        my $bfile = join '/', @bpaths ;
2793
                        if ( -f "$data->{ViewRoot}/$bfile" )
3375
                        $buildFile = "$data->{ViewPath}/$bfile";
-
 
3376
                        if ( -f $buildFile )
2794
                        {
3377
                        {
2795
                            $blevel = scalar @bpaths;
3378
                            $blevel = scalar @bpaths;
2796
                            last;
3379
                            last;
2797
                        }
3380
                        }
2798
                        pop @bpaths;
3381
                        pop @bpaths;
Line 2805... Line 3388...
2805
                    }
3388
                    }
2806
                    else
3389
                    else
2807
                    {
3390
                    {
2808
                        #
3391
                        #
2809
                        #   Determine the depth of the view root
3392
                        #   Determine the depth of the view root
2810
                        #   This is given by cc_path, but cc_path has a leading /
-
 
2811
                        #
3393
                        #
-
 
3394
                        Warning ("Build: $buildFile");
2812
                        my @cpaths = split ('/', $cc_path );
3395
                        my $countPath = ($data->{ViewPath} =~ tr~/~/~);
2813
                        my $clevel = (scalar @cpaths) - 1;
3396
                        my $countBuild = ($buildFile =~ tr~/~/~);
2814
                        my $max_up = $blevel - $clevel - 1;
3397
                        my $max_up = $countBuild - $countPath -1;
2815
 
3398
 
2816
                        m~--Up=(\d+)~i;
3399
                        m~--Up=(\d+)~i;
2817
                        my $ulevel = $1;
3400
                        my $ulevel = $1;
2818
                        if ( defined $ulevel )
3401
                        if ( defined $ulevel )
2819
                        {
3402
                        {
Line 2823... Line 3406...
2823
#print "--- blevel: $blevel\n";
3406
#print "--- blevel: $blevel\n";
2824
#print "--- bpaths: @bpaths\n";
3407
#print "--- bpaths: @bpaths\n";
2825
#print "--- ulevel: $ulevel\n";
3408
#print "--- ulevel: $ulevel\n";
2826
#print "--- paths: @paths\n";
3409
#print "--- paths: @paths\n";
2827
#print "--- plevel: $plevel\n";
3410
#print "--- plevel: $plevel\n";
2828
#print "--- cpaths: @cpaths\n";
-
 
2829
#print "--- clevel: $clevel\n";
-
 
2830
#print "--- max_up: $max_up\n";
3411
#print "--- max_up: $max_up\n";
2831
 
3412
 
2832
                            if ( $ulevel > $max_up )
3413
                            if ( $ulevel > $max_up )
2833
                            {
3414
                            {
2834
                                Warning ("SetProjectBase escapes view. MaxUp: $max_up, Up: $ulevel");
3415
                                Warning ("SetProjectBase escapes view. MaxUp: $max_up, Up: $ulevel");
Line 3480... Line 4061...
3480
# Returns         : Cleaned up vcs tag
4061
# Returns         : Cleaned up vcs tag
3481
#
4062
#
3482
sub vcsCleanup
4063
sub vcsCleanup
3483
{
4064
{
3484
    my ($tag) = @_;
4065
    my ($tag) = @_;
3485
    $tag =~ tr~\\/~/~;
4066
    $tag =~ tr~\\/~/~;                              # Force use of /
-
 
4067
    $tag =~ s~/+$~~;                                # Trailing /
3486
    if ( $tag =~ m~^CC::~ )
4068
    if ( $tag =~ m~^CC::~ )
3487
    {
4069
    {
-
 
4070
        $tag =~ s~CC::/VOB:/~CC::/~;                # Kill stuff
3488
        $tag =~ s~CC::load\s+~CC::~;                # Load rule
4071
        $tag =~ s~CC::load\s+~CC::~;                # Load rule
3489
        $tag =~ s~CC::\s+~CC::~;                    # Leading white space
4072
        $tag =~ s~CC::\s+~CC::~;                    # Leading white space
3490
        $tag =~ s~CC::[A-Za-z]\:/~CC::/~;           # Leading driver letter
4073
        $tag =~ s~CC::[A-Za-z]\:/~CC::/~;           # Leading driver letter
3491
        $tag =~ s~CC::/+~CC::/~;                    # Multiple initial /'s
4074
        $tag =~ s~CC::/+~CC::/~;                    # Multiple initial /'s
3492
        $tag =~ s~/build.pl::~::~i;
4075
        $tag =~ s~/build.pl::~::~i;
Line 3536... Line 4119...
3536
        $bad = 1 if ( $path =~ m~^/devl/~ || $path  =~ m~^devl/~ );
4119
        $bad = 1 if ( $path =~ m~^/devl/~ || $path  =~ m~^devl/~ );
3537
        $bad = 1 if ( $path =~ m~^CVS~ );
4120
        $bad = 1 if ( $path =~ m~^CVS~ );
3538
        $bad = 1 if ( $path =~ m~^http:~i );
4121
        $bad = 1 if ( $path =~ m~^http:~i );
3539
        $bad = 1 if ( $path =~ m~^[A-Za-z]\:~ );
4122
        $bad = 1 if ( $path =~ m~^[A-Za-z]\:~ );
3540
        $bad = 1 if ( $path =~ m~^//~ );
4123
        $bad = 1 if ( $path =~ m~^//~ );
-
 
4124
        $bad = 1 if ( $path =~ m~^/blade1/~ );
-
 
4125
        $bad = 1 if ( $path =~ m~^/devl/~ );
3541
        $bad = 1 if ( $path =~ m~^/*none~i );
4126
        $bad = 1 if ( $path =~ m~^/*none~i );
3542
        $bad = 1 if ( $path =~ m~^/*NoWhere~i );
4127
        $bad = 1 if ( $path =~ m~^/*NoWhere~i );
3543
        $bad = 1 if ( $path =~ m~^-$~i );
4128
        $bad = 1 if ( $path =~ m~^-$~i );
3544
        $bad = 1 if ( $path =~ m~^cvsserver:~ );
4129
        $bad = 1 if ( $path =~ m~^cvsserver:~ );
3545
        $bad = 1 if ( $path =~ m~,\s*module:~ );
4130
        $bad = 1 if ( $path =~ m~,\s*module:~ );
-
 
4131
        $bad = 1 if ( $path =~ m~[()]~ );
3546
#        $bad = 1 unless ( $path =~ m~^/~ );
4132
#        $bad = 1 unless ( $path =~ m~^/~ );
3547
    }
4133
    }
3548
    else
4134
    else
3549
    {
4135
    {
3550
        $bad = 1;
4136
        $bad = 1;
Line 3840... Line 4426...
3840
        unless ( $opt_fileList )
4426
        unless ( $opt_fileList )
3841
        {
4427
        {
3842
            push @attributes, 'URL="' . dotUrl($entry) . '"';
4428
            push @attributes, 'URL="' . dotUrl($entry) . '"';
3843
            push @attributes, 'tooltip="' . "Goto: $versions{$entry}{vname}, PVID=$entry" ,'"';
4429
            push @attributes, 'tooltip="' . "Goto: $versions{$entry}{vname}, PVID=$entry" ,'"';
3844
        }
4430
        }
-
 
4431
        else
3845
        {
4432
        {
3846
            push @attributes, 'URL="' . "Dummy" . '"';
4433
            push @attributes, 'URL="' . "Dummy" . '"';
3847
            push @attributes, 'tooltip="' . "Original Label: $versions{$entry}{realLabel}" ,'"';
4434
            push @attributes, 'tooltip="' . "Original Label: $versions{$entry}{realLabel}" ,'"';
3848
        }
4435
        }
3849
        my $shape;
4436
        my $shape;
Line 4020... Line 4607...
4020
        unless ( keys(%ScmRepoMap) >= 0 );
4607
        unless ( keys(%ScmRepoMap) >= 0 );
4021
 
4608
 
4022
    $opt_vobMap = $ScmRepoMap{$packageNames}{repo}
4609
    $opt_vobMap = $ScmRepoMap{$packageNames}{repo}
4023
        if (exists $ScmRepoMap{$packageNames});
4610
        if (exists $ScmRepoMap{$packageNames});
4024
 
4611
 
-
 
4612
    $opt_protected = $ScmRepoMap{$packageNames}{protected}
-
 
4613
        if (exists $ScmRepoMap{$packageNames}{protected});
4025
    #
4614
    #
4026
    #   Free the memory
4615
    #   Free the memory
4027
    #
4616
    #
4028
    %ScmRepoMap = ();
4617
    %ScmRepoMap = ();
4029
 
4618
 
Line 4082... Line 4671...
4082
        next unless ( exists  $pkg_ids{ $ScmPackages{$_}{pkgid} } );
4671
        next unless ( exists  $pkg_ids{ $ScmPackages{$_}{pkgid} } );
4083
        push @EssentialPackages, $_;
4672
        push @EssentialPackages, $_;
4084
        Error ("Essential Package Version not in extracted Release Manager Data: $_")
4673
        Error ("Essential Package Version not in extracted Release Manager Data: $_")
4085
            unless ( exists $versions{$_} );
4674
            unless ( exists $versions{$_} );
4086
        $versions{$_}{Essential} = 1;
4675
        $versions{$_}{Essential} = 1;
4087
        $versions{$_}{Reason} = $ScmPackages{$_}{Reason};
4676
        $versions{$_}{Reason} = $ScmPackages{$_}{Reason} if exists $ScmPackages{$_}{Reason}  ;
4088
 
4677
 
4089
        # Retain which RM Release this package-version is the tip
4678
        # Retain which RM Release this package-version is the tip
4090
        # Release of
4679
        # Release of
4091
        foreach my $rtag_id ( @{$ScmPackages{$_}{'release'}} )
4680
        foreach my $rtag_id ( @{$ScmPackages{$_}{'release'}} )
4092
        {
4681
        {
Line 4135... Line 4724...
4135
        my $vcsType = $1;
4724
        my $vcsType = $1;
4136
        my $cc_label = $4;
4725
        my $cc_label = $4;
4137
        my $cc_path = $2;
4726
        my $cc_path = $2;
4138
        $cc_path = '/' . $cc_path;
4727
        $cc_path = '/' . $cc_path;
4139
        $cc_path =~ tr~\\/~/~s;
4728
        $cc_path =~ tr~\\/~/~s;
-
 
4729
        $cc_path =~ s~/+$~~;
4140
 
4730
 
4141
        $VobPaths{$cc_path}++;
4731
        $VobPaths{$cc_path}++;
4142
    }
4732
    }
4143
 
4733
 
4144
    @multiplePaths = sort keys %VobPaths;
4734
    @multiplePaths = sort keys %VobPaths;
4145
    if ( scalar @multiplePaths > 1 )
4735
    if ( scalar @multiplePaths > 1 )
4146
    {
4736
    {
4147
        Warning ("Multiple Paths:" . $_ ) foreach (@multiplePaths);
4737
        Warning ("Multiple Paths:" . $_ ) foreach (@multiplePaths);
-
 
4738
 
-
 
4739
        # Kill SVN import
-
 
4740
        # User will need to configure one path
-
 
4741
        unless ( $opt_AllowMuliplePaths )
-
 
4742
        {
-
 
4743
            Warning ("Multiple Paths detected: Import supressed");
-
 
4744
            $opt_useSvn = 0
-
 
4745
        }
-
 
4746
        else
-
 
4747
        {
-
 
4748
            Message ("Multiple Paths detected: Allowed");
-
 
4749
        }
4148
    }
4750
    }
4149
}
4751
}
4150
 
4752
 
4151
sub isSet
4753
sub isSet
4152
{
4754
{
Line 4371... Line 4973...
4371
    #
4973
    #
4372
    #   Close out the file
4974
    #   Close out the file
4373
    #
4975
    #
4374
    $fh->Close();
4976
    $fh->Close();
4375
}
4977
}
-
 
4978
 
-
 
4979
#-------------------------------------------------------------------------------
-
 
4980
# Function        : restoreData
-
 
4981
#
-
 
4982
# Description     : Read in essential information
-
 
4983
#                   Used during a resume operation
-
 
4984
#
-
 
4985
# Inputs          : 
-
 
4986
#
-
 
4987
# Returns         : 
-
 
4988
#
-
 
4989
our %ScmVersions;
-
 
4990
sub restoreData
-
 
4991
{
-
 
4992
    my $file = $cwd . "/${packageNames}.data";
-
 
4993
    Message ("Restoring: $file");
-
 
4994
    Error "Cannot locate restoration file: $file" unless ( -f $file );
-
 
4995
    require $file;
-
 
4996
 
-
 
4997
    Error "Resume Data in $file is not valid\n"
-
 
4998
        unless ( keys(%ScmVersions) >= 0 );
-
 
4999
 
-
 
5000
    foreach  ( keys %ScmVersions )
-
 
5001
    {
-
 
5002
        $restoreData{$_} = $ScmVersions{$_}{data};
-
 
5003
        $restoreData{$_}{rmRef} = $ScmVersions{$_}{rmRef};
-
 
5004
    }
-
 
5005
    %ScmVersions = ();
-
 
5006
}
-
 
5007
 
-
 
5008
#-------------------------------------------------------------------------------
-
 
5009
# Function        : testSvnLabel
-
 
5010
#
-
 
5011
# Description     : Test existence of an SVN label
-
 
5012
#
-
 
5013
# Inputs          :     Package
-
 
5014
#                       Label to test
-
 
5015
#
-
 
5016
# Returns         : 0   - Tag in place
-
 
5017
#                   1   - Not in place
-
 
5018
#
-
 
5019
sub testSvnLabel
-
 
5020
{
-
 
5021
    my ($svnPkg, $svnTag) = @_;
-
 
5022
 
-
 
5023
    my $rv = JatsToolPrint ( 'jats_svnlabel',
-
 
5024
                    '-check',
-
 
5025
                    "-packagebase=$svnPkg",
-
 
5026
                    "$svnTag",
-
 
5027
                     );
-
 
5028
    Message ("testSvnLabel: $svnTag - $rv");
-
 
5029
    return $rv;
-
 
5030
}
-
 
5031
 
-
 
5032
 
4376
#-------------------------------------------------------------------------------
5033
#-------------------------------------------------------------------------------
4377
# Function        : GetData_by_filelist
5034
# Function        : GetData_by_filelist
4378
#
5035
#
4379
# Description     : Read in source data from a file
5036
# Description     : Read in source data from a file
4380
#
5037
#
Line 4416... Line 5073...
4416
            $pv_id++;
5073
            $pv_id++;
4417
#            $versions{$pv_id}{fileListEntry} = $_;
5074
#            $versions{$pv_id}{fileListEntry} = $_;
4418
            $versions{$pv_id}{name} = $pkg_name;
5075
            $versions{$pv_id}{name} = $pkg_name;
4419
            $versions{$pv_id}{pvid} = $pv_id;
5076
            $versions{$pv_id}{pvid} = $pv_id;
4420
            $versions{$pv_id}{vname} = $pkg_ver;
5077
            $versions{$pv_id}{vname} = $pkg_ver;
4421
            $versions{$pv_id}{vcsTag} = "CC::/MASS_Dataman::$data[2]";
5078
            $versions{$pv_id}{vcsTag} = "CC::/${opt_ccbase}::$data[2]";
4422
            $versions{$pv_id}{created} = $cdate;
5079
            $versions{$pv_id}{created} = $cdate;
4423
            $versions{$pv_id}{created_id} = $data[1];
5080
            $versions{$pv_id}{created_id} = $data[1];
4424
            $versions{$pv_id}{realLabel} = $data[2];
5081
            $versions{$pv_id}{realLabel} = $data[2];
4425
            $versions{$pv_id}{comment} = "Label Import: $data[2]";
5082
            $versions{$pv_id}{comment} = "Label Import: $data[2]";
4426
            $versions{$pv_id}{locked} = 'Y';
5083
            $versions{$pv_id}{locked} = 'Y';
Line 4452... Line 5109...
4452
        }
5109
        }
4453
    }
5110
    }
4454
    close $fh;
5111
    close $fh;
4455
}
5112
}
4456
 
5113
 
4457
 
-
 
4458
#-------------------------------------------------------------------------------
5114
#-------------------------------------------------------------------------------
4459
#   Documentation
5115
#   Documentation
4460
#
5116
#
4461
 
5117
 
4462
=pod
5118
=pod
Line 4489... Line 5145...
4489
    -[no]postimage     - Create image after transger: Def: -post
5145
    -[no]postimage     - Create image after transger: Def: -post
4490
    -workdir=path      - Use for temp storage (def:/work)
5146
    -workdir=path      - Use for temp storage (def:/work)
4491
    -delete            - Delete SVN package before test
5147
    -delete            - Delete SVN package before test
4492
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
5148
    -[no]relabel       - Attempt to relabel dirs in packages that don't extract
4493
    -filelist=path     - Use named list of files
5149
    -filelist=path     - Use named list of files
-
 
5150
    -testRmDatabase    - Use test database
-
 
5151
    -[no]fromSvn       - Also extract packages from SVN
4494
 
5152
 
4495
=head1 OPTIONS
5153
=head1 OPTIONS
4496
 
5154
 
4497
=over 8
5155
=over 8
4498
 
5156