Subversion Repositories DevTools

Rev

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

Rev 6133 Rev 6177
Line 1... Line 1...
1
########################################################################
1
########################################################################
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
2
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
3
#
3
#
4
# Module name   : jats.sh
4
# Module name   : jats.sh
5
# Module type   : Makefile system
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
6
# Compiler(s)   : n/a
7
# Environment(s): jats build system
7
# Environment(s): jats build system
Line 53... Line 53...
53
@EXPORT      = qw(  ReadBuildConfig
53
@EXPORT      = qw(  ReadBuildConfig
54
                    getPlatformParts
54
                    getPlatformParts
55
                    getPackagePaths
55
                    getPackagePaths
56
                    getPackageList
56
                    getPackageList
57
                    getToolInfo
57
                    getToolInfo
-
 
58
                    testToolInfo
58
                    getAliases
59
                    getAliases
59
                );
60
                );
60
@EXPORT_OK =  qw(   $InterfaceVersion
61
@EXPORT_OK =  qw(   $InterfaceVersion
61
                    $ScmBuildMachType
62
                    $ScmBuildMachType
62
                    $ScmInterfaceVersion
63
                    $ScmInterfaceVersion
Line 71... Line 72...
71
                    $ScmDeploymentPatch
72
                    $ScmDeploymentPatch
72
                    $ScmBuildSrc
73
                    $ScmBuildSrc
73
                    $ScmExpert
74
                    $ScmExpert
74
                    $ScmAll
75
                    $ScmAll
75
                    $ScmNoBuild
76
                    $ScmNoBuild
-
 
77
                    $ScmBuildUuid
76
                    %ScmBuildAliases
78
                    %ScmBuildAliases
77
                    %ScmBuildProducts
79
                    %ScmBuildProducts
78
                    %ScmBuildPlatforms
80
                    %ScmBuildPlatforms
79
                    %ScmBuildPkgRules
81
                    %ScmBuildPkgRules
80
                    @BUILDPLATFORMS
82
                    @BUILDPLATFORMS
Line 393... Line 395...
393
    }
395
    }
394
    return ( @result );
396
    return ( @result );
395
}
397
}
396
 
398
 
397
#-------------------------------------------------------------------------------
399
#-------------------------------------------------------------------------------
398
# Function        : getToolInfo 
400
# Function        : testToolInfo 
399
#
401
#
400
# Description     : Locate and load the tool information for the named tool
402
# Description     : Test to see if suitable toolInfo exists
-
 
403
#                   May be used if the need for the toolInfo is optional
401
#
404
#
402
# Inputs          : $toolname           - tool to locate
405
# Inputs          : $toolname       - Tool to locate
403
#                   ...                 - Optional,Names of fields to expect in the package
-
 
404
#                                         If any of the required fields ar missing an error
-
 
405
#                                         will be reported
406
#                   $error          - True: Error on not found
406
#
407
#
407
# Returns         : A hash of Tool info
408
# Returns         : undefined       - No tool located
-
 
409
#                   refToToolEntry  - Used internally
408
#
410
#
409
sub getToolInfo
411
sub testToolInfo
410
{
412
{
411
    my ($toolname, @fnames) = @_;
413
    my ($toolname, $error) = @_;
412
    my $toolroot;
414
    my $toolroot;
413
    my $toolinfo;
415
    my $toolinfo;
414
    my $pentry;
416
    my $pentry;
415
    my %data;
-
 
416
    my @searchPath;
417
    my @searchPath;
417
 
418
 
418
    foreach my $entry ( getPackageList() )
419
    foreach my $entry ( getPackageList() )
419
    {
420
    {
420
        my $path = $entry->getBase(2);
421
        my $path = $entry->getBase(2);
Line 436... Line 437...
436
            $toolroot = $path;
437
            $toolroot = $path;
437
            $pentry = $entry;
438
            $pentry = $entry;
438
            last;
439
            last;
439
        }
440
        }
440
    }
441
    }
-
 
442
 
441
    if (defined $toolroot)
443
    unless (defined $toolroot)
442
    {
444
    {
-
 
445
        #   Didn't find the required tool
-
 
446
        Error ("Cannot find required tool in any package: $toolname", "Search Path:", @searchPath) if ($error );
-
 
447
        return undef ;
-
 
448
    }
-
 
449
 
-
 
450
    #
-
 
451
    #   Return user info
-
 
452
    #
-
 
453
    return ($pentry, $toolroot, $toolinfo) if (wantarray);
-
 
454
    return $pentry;
-
 
455
}
-
 
456
 
-
 
457
 
-
 
458
#-------------------------------------------------------------------------------
-
 
459
# Function        : getToolInfo 
-
 
460
#
-
 
461
# Description     : Locate and load the tool information for the named tool
-
 
462
#
-
 
463
# Inputs          : $toolname           - tool to locate
-
 
464
#                   ...                 - Optional,Names of fields to expect in the package
-
 
465
#                                         If any of the required fields ar missing an error
-
 
466
#                                         will be reported
-
 
467
#
-
 
468
# Returns         : A hash of Tool info
-
 
469
#
-
 
470
sub getToolInfo
-
 
471
{
-
 
472
    my ($toolname, @fnames) = @_;
-
 
473
    my %data;
-
 
474
 
-
 
475
    #
-
 
476
    #   Check existence and get essential information
-
 
477
    #       Will not return if not found
-
 
478
    #
-
 
479
    my ($pentry, $toolroot, $toolinfo) = testToolInfo ($toolname, 1);
-
 
480
 
443
        open (my $DATA, '<', $toolinfo ) || Error("Cannot open tool info file. $!", "File: $toolinfo");
481
    open (my $DATA, '<', $toolinfo ) || Error("Cannot open tool info file. $!", "File: $toolinfo");
444
        while ( <$DATA> )
482
    while ( <$DATA> )
445
        {
483
    {
446
            $_ =~ s~\s+$~~;
484
        $_ =~ s~\s+$~~;
447
            next if ( m~^#~ );
485
        next if ( m~^#~ );
448
            next if length($_) < 1;
486
        next if length($_) < 1;
449
            m~(.*?)\s*=\s*(.*)~;
487
        m~(.*?)\s*=\s*(.*)~;
450
            $data{$1} = $2;
488
        $data{$1} = $2;
451
        }
489
    }
452
        close $DATA;
490
    close $DATA;
453
        $data{PKGBASE} = $toolroot;
491
    $data{PKGBASE} = $toolroot;
454
        $data{PKGENTRY} = $pentry;
492
    $data{PKGENTRY} = $pentry;
455
#DebugDumpData("Data", \%data);
493
#DebugDumpData("Data", \%data);
456
 
494
 
457
        #
495
    #
458
        #   Ensure that the required fields are in the info file
496
    #   Ensure that the required fields are in the info file
459
        #   These will be a mix of mandatory and user fields
497
    #   These will be a mix of mandatory and user fields
460
        #
498
    #
461
        my @missing;
499
    my @missing;
462
        for my $fname ('TOOLNAME','TOOLROOT', @fnames)
500
    for my $fname ('TOOLNAME','TOOLROOT', @fnames)
463
        {
501
    {
464
            next if defined $data{$fname};
502
        next if defined $data{$fname};
465
            push @missing, $fname;
503
        push @missing, $fname;
466
        }
-
 
467
        if (@missing)
-
 
468
        {
-
 
469
            Error("Tool Package '$toolname' is missing required fields:", @missing);
-
 
470
        }
-
 
471
        return \%data;
-
 
472
    }
504
    }
473
 
-
 
474
    #   Didn't find the required tool
505
    if (@missing)
-
 
506
    {
475
    Error ("Cannot find required tool in any package: $toolname", "Search Path:", @searchPath);
507
        Error("Tool Package '$toolname' is missing required fields:", @missing);
-
 
508
    }
-
 
509
    return \%data;
476
}
510
}
477
 
511
 
478
 
512
 
479
################################################################################
513
################################################################################
480
#   PackageEntry
514
#   PackageEntry
Line 545... Line 579...
545
# Returns         : As above
579
# Returns         : As above
546
#
580
#
547
sub getBase
581
sub getBase
548
{
582
{
549
    my ($self, $type ) = @_;
583
    my ($self, $type ) = @_;
-
 
584
    ::Error ("Internal: PackageEntry::getBase called without 'type' argument") unless defined $type;
550
 
585
 
551
    if ( $type == 1 ) {
586
    if ( $type == 1 ) {
552
        return $self->{ROOT};
587
        return $self->{ROOT};
553
    } elsif ( $type == 2 ) {
588
    } elsif ( $type == 2 ) {
554
        if ( $self->{'TYPE'} eq 'build' ) {
589
        if ( $self->{'TYPE'} eq 'build' ) {