Subversion Repositories DevTools

Rev

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

Rev 5867 Rev 6133
Line 474... Line 474...
474
    (@_ == 1) ? $_[0] :
474
    (@_ == 1) ? $_[0] :
475
    (@_ == 2) ? join(" and ", @_)  :
475
    (@_ == 2) ? join(" and ", @_)  :
476
                    join("$sepchar ", @_[0 .. ($#_-1)], "and $_[-1]");
476
                    join("$sepchar ", @_[0 .. ($#_-1)], "and $_[-1]");
477
}
477
}
478
 
478
 
479
#-------------------------------------------------------------------------------
-
 
480
# Function        : ToolsetFile
-
 
481
#
-
 
482
# Description     : Maintain a datastructure of files that are created
-
 
483
#                   by the makefile creation process.
-
 
484
#
-
 
485
#                   Used to simplify the clobber process
-
 
486
#
-
 
487
#                   Maintains a in-memory datastructure
-
 
488
#
-
 
489
# Inputs          : fileList        - Files to add to the list
-
 
490
#
-
 
491
# Returns         : Nothing
-
 
492
#
-
 
493
our %GBE_TOOLSETFiles;
-
 
494
sub ToolsetFile
-
 
495
{
-
 
496
    my (@fileList) = @_;
-
 
497
    Verbose2 ("ToolsetFile:", @fileList);
-
 
498
    Error ("Internal: ToolsetFile. ScmRoot or ScmInterface not defined")
-
 
499
        unless ( defined $::ScmRoot && defined $::ScmInterface );
-
 
500
 
-
 
501
    my $dataDir = "$::ScmRoot/$::ScmInterface";
-
 
502
    my $dataFile = "$dataDir/GbeFiles.cfg";
-
 
503
 
-
 
504
    Error ("Internal: ToolsetFile. Cwd not defined")
-
 
505
        unless ( defined $::Cwd );
-
 
506
 
-
 
507
 
-
 
508
    #
-
 
509
    #   Initial read of data structure
-
 
510
    #   Only read on first call
-
 
511
    #
-
 
512
    unless ( %GBE_TOOLSETFiles )
-
 
513
    {
-
 
514
        if ( -f  $dataFile )
-
 
515
        {
-
 
516
            require ( $dataFile );
-
 
517
        }
-
 
518
 
-
 
519
        # Capture the package root directory
-
 
520
        $GBE_TOOLSETFiles{Root} = AbsPath($::ScmRoot)
-
 
521
            unless defined $GBE_TOOLSETFiles{Root};
-
 
522
    }
-
 
523
 
-
 
524
    #
-
 
525
    # Save to disk if
-
 
526
    #   Target directory exists - creation may be delayed
-
 
527
    #   We have added entries
-
 
528
    #
-
 
529
    if ( @fileList )
-
 
530
    {
-
 
531
        #
-
 
532
        #   Add files
-
 
533
        #       Need to be full paths
-
 
534
        #
-
 
535
        $GBE_TOOLSETFiles{Files}{RelPath(AbsPath($_), $GBE_TOOLSETFiles{Root} )} = 1 foreach ( @fileList );
-
 
536
 
-
 
537
        #
-
 
538
        #   Save file
-
 
539
        #   Simply rewrite the file - if the terget directory exists
-
 
540
        #   Its creation may be after we have started accumulating files
-
 
541
        #
-
 
542
        if ( -d $dataDir  ) {
-
 
543
            my $fh = ConfigurationFile::New( $dataFile );
-
 
544
            $fh->Header( "ToolsetFile", "Toolset Files" );
-
 
545
            $fh->Dump( [\%GBE_TOOLSETFiles], [qw(*GBE_TOOLSETFiles)] );
-
 
546
            $fh->Close();
-
 
547
        }
-
 
548
    }
-
 
549
}
-
 
550
 
-
 
551
1;  #success
479
1;  #success
552
 
480