Subversion Repositories DevTools

Rev

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

Rev 391 Rev 3552
Line 282... Line 282...
282
#
282
#
283
sub process_build_file
283
sub process_build_file
284
{
284
{
285
    Verbose ("Processing build file: $opt_infile");
285
    Verbose ("Processing build file: $opt_infile");
286
 
286
 
-
 
287
    my $build_info;
-
 
288
    my $release_name;
-
 
289
    my $release_version;
-
 
290
 
287
    #
291
    #
288
    #   Unlink any OLD output file
292
    #   Unlink any OLD output file
289
    #
293
    #
290
    unlink $opt_work_file;
294
    unlink $opt_work_file;
291
 
295
 
292
    #
296
    #
293
    #   Open the input and output files
297
    #   Open the output file
294
    #
298
    #
295
    open ( INFILE, "<$opt_infile" ) || Error( "Cannot read from $opt_infile", $! );
-
 
296
    open ( OUTFILE, ">$opt_work_file" ) || Error( "Cannot create $opt_work_file", $! );
299
    open ( OUTFILE, ">$opt_work_file" ) || Error( "Cannot create $opt_work_file", $! );
297
 
300
 
298
    my $build_info;
301
    #
299
 
-
 
300
    my $release_name;
-
 
301
    my $release_version;
302
    #   Read input file and process as an array of lines
302
 
303
    #
303
    while ( <INFILE> )
304
    foreach ( getInputLines($opt_infile) )
304
    {
305
    {
305
        next if ( $opt_noconfig );       # Nothing to do
306
        next if ( $opt_noconfig );       # Nothing to do
306
        next if ( m~^\s*#~ );            # Skip comments
307
        next if ( m~^\s*#~ );            # Skip comments
-
 
308
 
307
        #
309
        #
308
        #   Process BuildName
310
        #   Process BuildName
309
        #
311
        #
310
        if ( m~\s*BuildName[\s\(]~  )
312
        if ( m~\s*BuildName[\s\(]~  )
311
        {
313
        {
Line 381... Line 383...
381
    }
383
    }
382
 
384
 
383
    #
385
    #
384
    #   Cleanup
386
    #   Cleanup
385
    #
387
    #
386
    close INFILE;
-
 
387
    close OUTFILE;
388
    close OUTFILE;
388
    unlink $opt_ofile;
389
    unlink $opt_ofile;
389
    rename $opt_work_file ,$opt_ofile;
390
    rename $opt_work_file ,$opt_ofile;
390
    display_unused();
391
    display_unused();
391
}
392
}
Line 418... Line 419...
418
#
419
#
419
sub process_xml_build_file
420
sub process_xml_build_file
420
{
421
{
421
    Verbose ("$opt_infile");
422
    Verbose ("$opt_infile");
422
 
423
 
-
 
424
    my $release_name;
-
 
425
    my $release_version;
-
 
426
 
423
    #
427
    #
424
    #   Unlink any OLD output file
428
    #   Unlink any OLD output file
425
    #
429
    #
426
    unlink $opt_work_file;
430
    unlink $opt_work_file;
427
 
431
 
428
    #
432
    #
429
    #   Open the input and output files
433
    #   Open the output file
430
    #
434
    #
431
    open ( INFILE, "<$opt_infile" ) || Error( "Cannot read from $opt_infile", $! );
-
 
432
    open ( OUTFILE, ">$opt_work_file" ) || Error( "Cannot create $opt_work_file", $! );
435
    open ( OUTFILE, ">$opt_work_file" ) || Error( "Cannot create $opt_work_file", $! );
433
 
436
 
434
    my $release_name;
437
    #
435
    my $release_version;
438
    #   Read input file and process as an array of lines
436
 
439
    #
437
    while ( <INFILE> )
440
    foreach ( getInputLines($opt_infile) )
438
    {
441
    {
439
        next if ( $opt_noconfig );       # Nothing to do
442
        next if ( $opt_noconfig );       # Nothing to do
440
        #
443
        #
441
        #   Process "project" statement
444
        #   Process "project" statement
442
        #
445
        #
Line 594... Line 597...
594
    }
597
    }
595
 
598
 
596
    #
599
    #
597
    #   Cleanup
600
    #   Cleanup
598
    #
601
    #
599
    close INFILE;
-
 
600
    close OUTFILE;
602
    close OUTFILE;
601
    unlink $opt_ofile;
603
    unlink $opt_ofile;
602
    rename $opt_work_file ,$opt_ofile;
604
    rename $opt_work_file ,$opt_ofile;
603
    display_unused();
605
    display_unused();
604
}
606
}
605
 
607
 
606
#-------------------------------------------------------------------------------
608
#-------------------------------------------------------------------------------
-
 
609
# Function        : getInputLines
-
 
610
#
-
 
611
# Description     : Slurp into the input file and create an array of lines
-
 
612
#                   Must handle files with a mix of line endings
-
 
613
#
-
 
614
#
-
 
615
# Inputs          : File to slurp
-
 
616
#
-
 
617
# Returns         : An array of lines
-
 
618
#                   Line endings preserved
-
 
619
#
-
 
620
sub getInputLines
-
 
621
{
-
 
622
    my ($infile) = @_;
-
 
623
    my @lines;
-
 
624
 
-
 
625
    #
-
 
626
    #   Open the input file
-
 
627
    #
-
 
628
    open ( INFILE, "<$infile" ) || Error( "Cannot read from $infile", $! );
-
 
629
 
-
 
630
    #   Read the entire file and break into lines
-
 
631
    #   Need to handle files that are a mix of Unix and Windows line endings
-
 
632
    #   Attempt to preserve the line style
-
 
633
 
-
 
634
    while ( <INFILE> )
-
 
635
    {
-
 
636
        s~([\n\r]+)$~~;
-
 
637
        my $eol = $1;
-
 
638
        if ( my @line = split(/[\r\n]+/, $_) ) {
-
 
639
            push @lines, $_ . $eol foreach (@line );
-
 
640
        } else {
-
 
641
            push @lines, $eol;
-
 
642
        }
-
 
643
    }
-
 
644
    return @lines;
-
 
645
    close INFILE;
-
 
646
}
-
 
647
 
-
 
648
#-------------------------------------------------------------------------------
607
# Function        : display_unused
649
# Function        : display_unused
608
#
650
#
609
# Description     : Generate warnings about config items that were not used
651
# Description     : Generate warnings about config items that were not used
610
#
652
#
611
# Inputs          :
653
# Inputs          :