Subversion Repositories DevTools

Rev

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

Rev 227 Rev 241
Line 124... Line 124...
124
    #
124
    #
125
    #   Ensure that the package source in dpkg_archive can be found
125
    #   Ensure that the package source in dpkg_archive can be found
126
    #
126
    #
127
 
127
 
128
    $src_dir = "$GBE_DPKG/$ARGV[0]/$ARGV[1]";
128
    $src_dir = "$GBE_DPKG/$ARGV[0]/$ARGV[1]";
129
    print "Testing $src_dir\n";
129
    Message ( "Testing $src_dir" );
130
    Error ("Package not found: $src_dir" ) unless ( -d $src_dir );
130
    Error ("Package not found: $src_dir" ) unless ( -d $src_dir );
131
    print "Found source package\n";
131
    Message ("Found source package");
132
}
132
}
133
 
133
 
134
#
134
#
135
#   Ensure target directory is not present
135
#   Ensure target directory is not present
136
#
136
#
Line 173... Line 173...
173
#
173
#
174
#   Transfer source to target and remove generated files
174
#   Transfer source to target and remove generated files
175
#
175
#
176
if ( $opt_delete && -d $temp_dir )
176
if ( $opt_delete && -d $temp_dir )
177
{
177
{
178
    print "Delete temp directory\n";
178
    Message ("Delete temp directory");
179
    rmtree( $temp_dir );
179
    rmtree( $temp_dir );
180
}
180
}
181
 
181
 
182
mkpath ($temp_dir,1);
182
mkpath ($temp_dir,$opt_verbose);
183
Error( "Cannot create directory: $temp_dir") unless( -d $temp_dir);
183
Error( "Cannot create directory: $temp_dir") unless( -d $temp_dir);
184
 
184
 
185
mkpath ($dest_dir,1);
185
mkpath ($dest_dir,$opt_verbose);
186
Error( "Cannot create target directory") unless ( -d $dest_dir);
186
Error( "Cannot create target directory") unless ( -d $dest_dir);
187
 
187
 
188
print "Transfer package to local directory\n";
188
Message ("Transfer package to local directory");
189
File::Find::find( \&CopyDir, $src_dir );
189
File::Find::find( \&CopyDir, $src_dir );
190
 
190
 
191
 
191
 
192
#
192
#
193
#   Create a build.pl file based on a template
193
#   Create a build.pl file based on a template
194
#
194
#
195
print "Create build.pl\n";
195
Message ("Create build.pl");
196
open (BUILD, ">", "$dest_dir/build.pl" );
196
open (BUILD, ">", "$dest_dir/build.pl" );
197
while ( <DATA> )
197
while ( <DATA> )
198
{
198
{
199
    chomp;
199
    chomp;
200
    last if ( /^__ENDBUILD/ );
200
    last if ( /^__ENDBUILD/ );
Line 230... Line 230...
230
close (BUILD);
230
close (BUILD);
231
 
231
 
232
#
232
#
233
#   Create a makefile.pl based on a template
233
#   Create a makefile.pl based on a template
234
#
234
#
235
print "Create src/makefile.pl\n";
235
Message ("Create src/makefile.pl");
236
mkdir "$dest_dir/src";
236
mkdir "$dest_dir/src";
237
open (MAKE, ">", "$dest_dir/src/makefile.pl" );
237
open (MAKE, ">", "$dest_dir/src/makefile.pl" );
238
while ( <DATA> )
238
while ( <DATA> )
239
{
239
{
240
    chomp;
240
    chomp;
Line 287... Line 287...
287
#
287
#
288
#   Transfer the image into the target VOB
288
#   Transfer the image into the target VOB
289
#   The clearcase command will adjust the target directory to match the source
289
#   The clearcase command will adjust the target directory to match the source
290
#
290
#
291
 
291
 
292
print "Import to clearcase vob: $opt_vob\n";
292
Message ("Import to clearcase vob: $opt_vob");
293
my $cmd = "clearfsimport.exe -nsetevent -rec -rmname";
293
my $cmd = "clearfsimport.exe -nsetevent -rec -rmname";
294
   $cmd .= " -preview " if $opt_test;
294
   $cmd .= " -preview" if $opt_test;
295
   $cmd .= " -mklabel $opt_label ";
295
   $cmd .= " -mklabel $opt_label";
296
   $cmd .= " -c \"Package snapshot $ARGV[0]_$ARGV[1]\"";
296
   $cmd .= " -c \"Package snapshot $ARGV[0]_$ARGV[1]\"";
297
   $cmd .= " gen_cots/$opt_subdir $opt_vob$target_path\n";
297
   $cmd .= " gen_cots/$opt_subdir $opt_vob$target_path";
298
 
298
 
299
Verbose($cmd);
299
Verbose($cmd);
300
@error_list = ();
300
@error_list = ();
301
open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
301
open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
302
while (<CMD>)
302
while (<CMD>)
Line 314... Line 314...
314
    display_error_list();
314
    display_error_list();
315
    Error("Problem encountered saving package image");
315
    Error("Problem encountered saving package image");
316
}
316
}
317
 
317
 
318
#
318
#
319
#   Massage the vob name and remove the drive letter
319
#   Apply label to all directories upto the root of the VOB
-
 
320
#   The label will have been applied to the TIP
320
#
321
#
321
$opt_vob =~ s~^[A-Za-z]:[\\/]~/~;
322
Verbose ("Label package path");
322
$opt_vob = '/' . $opt_vob;
323
my $lpath = $opt_vob;
-
 
324
foreach ( split ('/', $target_path) )
-
 
325
{
323
$opt_vob =~ tr~\\/~/~s;
326
    $lpath = $lpath . '/' . $_;
-
 
327
    Verbose ("Label package path: $lpath");
-
 
328
    ClearCmd ("mklabel -replace $opt_label $lpath" ) unless $opt_test;
-
 
329
    Error ("Program Terminated") if ( @error_list );
-
 
330
}
324
 
331
 
325
#
332
#
326
#   Lock the label
333
#   Lock the label
327
#
334
#
328
print "Locking label: $opt_label\n";
335
Message ("Locking label: $opt_label");
329
ClearCmd ("lock lbtype:$opt_label\@/$vob_name" ) unless $opt_test;
336
ClearCmd ("lock lbtype:$opt_label\@/$vob_name" ) unless $opt_test;
330
Error ("Program Terminated") if ( @error_list );
337
Error ("Program Terminated") if ( @error_list );
331
 
338
 
332
#
339
#
333
#   Remove the created directory
340
#   Remove the created directory
334
#
341
#
335
if ( $opt_keep )
342
if ( $opt_keep )
336
{
343
{
337
    print "KEEP temp directory: $temp_dir\n";
344
    Warning ("KEEP temp directory: $temp_dir");
338
}
345
}
339
else
346
else
340
{
347
{
341
    print "Delete temp directory\n";
348
    Message ("Delete temp directory");
342
    rmtree( $temp_dir );
349
    rmtree( $temp_dir );
343
}
350
}
344
 
351
 
345
#
352
#
346
#   All done
353
#   All done
347
#
354
#
348
print "\n";
355
Message ("\n");
349
print "Release Manager information\n";
356
Message ("Release Manager information");
350
print "Package path : /$vob_name/$ARGV[0] \n";
357
Message ("Package path : /$vob_name/$opt_subdir");
351
print "Label        : $opt_label\n";
358
Message ("Label        : $opt_label");
352
 
359
 
353
Warning ("Test Mode: Not changes made to the VOB") if ( $opt_test );
360
Warning ("Test Mode: Not changes made to the VOB") if ( $opt_test );
354
exit 0;
361
exit 0;
355
 
362
 
356
 
363
 
Line 381... Line 388...
381
    return if ( -d $item );
388
    return if ( -d $item );
382
 
389
 
383
    #
390
    #
384
    #   Calculate target directory
391
    #   Calculate target directory
385
    #
392
    #
386
    my $target = $item;
393
    my $sdl = length ($src_dir);
387
    $target =~ s~^$src_dir~$dest_dir/$DESTDIR~;
394
    my $target = $dest_dir . '/' . $DESTDIR . substr ( $item, $sdl );
388
 
395
 
389
    #
396
    #
390
    #   Determinate top level package directories
397
    #   Determinate top level package directories
391
    #
398
    #
392
    my $rootdir = $item;
399
    my $rootdir = substr ( $item, 1 + $sdl );
393
    $rootdir =~ s~^$src_dir/~~;
-
 
394
    $rootdir =~ s~/.*~~;
400
    $rootdir =~ s~/.*~~;
395
 
401
 
396
    if ( $rootdir eq $base )
402
    if ( $rootdir eq $base )
397
    {
403
    {
398
        $files{$base} = 1;
404
        $files{$base} = 1;
Line 448... Line 454...
448
    }
454
    }
449
 
455
 
450
    #
456
    #
451
    #   Scan for a dynamic view
457
    #   Scan for a dynamic view
452
    #
458
    #
453
    print "Scanning for suitable dynamic view\n";
459
    Message ("Scanning for suitable dynamic view");
454
    my @search_list = glob ("O:/*");
460
    my @search_list = glob ("O:/*");
455
    my $found_vob;
461
    my $found_vob;
456
    foreach my $dir ( @search_list )
462
    foreach my $dir ( @search_list )
457
    {
463
    {
458
        my $test_vob = "$dir/$opt_vob";
464
        my $test_vob = "$dir/$opt_vob";
459
        Verbose ("Testing vob: $test_vob" );
465
        Verbose ("Testing vob: $test_vob" );
460
        next if ( $dir =~ m~solaris~i );
466
        next if ( $dir =~ m~solaris~i );                    # Take the hint
-
 
467
        next if ( $dir =~ '/administration_view$' );        # Known read-only VOB
-
 
468
 
461
        if ( -d $test_vob )
469
        if ( -d $test_vob )
462
        {
470
        {
463
            $found_vob = $dir;
471
            $found_vob = $dir;
464
            last;
472
            last;
465
        }
473
        }
Line 467... Line 475...
467
    Error ("Cannot find a suitable view with the $opt_vob VOB mounted") unless ( $found_vob );
475
    Error ("Cannot find a suitable view with the $opt_vob VOB mounted") unless ( $found_vob );
468
 
476
 
469
    $vob_dir = $found_vob;
477
    $vob_dir = $found_vob;
470
    $vob_name = $opt_vob;
478
    $vob_name = $opt_vob;
471
    $opt_vob = "$vob_dir/$vob_name";
479
    $opt_vob = "$vob_dir/$vob_name";
472
    print "Using VOB: $opt_vob\n";
480
    Message ("Using VOB: $opt_vob");
473
}
481
}
474
 
482
 
475
 
483
 
476
#-------------------------------------------------------------------------------
484
#-------------------------------------------------------------------------------
477
# Function        : ClearCmd
485
# Function        : ClearCmd
Line 511... Line 519...
511
 
519
 
512
#-------------------------------------------------------------------------------
520
#-------------------------------------------------------------------------------
513
# Function        : display_error_list
521
# Function        : display_error_list
514
#
522
#
515
# Description     : Display the error list
523
# Description     : Display the error list
516
#                   This function is registered as an Error callback function
-
 
517
#                   it will be called on error exit
524
#                   The exit process will be handled by the caller
518
#
525
#
519
# Inputs          :
526
# Inputs          :
520
#
527
#
521
# Returns         :
528
# Returns         :
522
#
529
#
523
sub display_error_list
530
sub display_error_list
524
{
531
{
525
    foreach ( @error_list )
532
    foreach ( @error_list )
526
    {
533
    {
527
        print "$_\n";
534
        ReportError ("$_");
528
    }
535
    }
529
}
536
}
530
 
537
 
531
 
538
 
532
__DATA__
539
__DATA__