Subversion Repositories DevTools

Rev

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

Rev 1544 Rev 1546
Line 1594... Line 1594...
1594
 
1594
 
1595
    #
1595
    #
1596
    #   Convert the package name into a real path name to the package as
1596
    #   Convert the package name into a real path name to the package as
1597
    #   held in dpkg_archive. Do not use the copy in the 'interface' directory
1597
    #   held in dpkg_archive. Do not use the copy in the 'interface' directory
1598
    #
1598
    #
1599
    for my $entry ( $BuildFileInfo->getBuildPkgRules() )
-
 
1600
    {
-
 
1601
        next unless ( $entry->{'DNAME'} eq $pkgName );
-
 
1602
        $src_base_dir = $entry->{'ROOT'};
-
 
1603
        Verbose ("Discovered package in: $src_base_dir");
-
 
1604
    }
-
 
1605
 
-
 
1606
    Error ("installDpkgArchivePkgRaw: Package not located: $pkgName")
1599
    $src_base_dir = LocatePackageBase ( "installDpkgArchivePkgRaw", $pkgName );
1607
        unless ( $src_base_dir );
-
 
1608
 
-
 
1609
    Error ("installDpkgArchivePkgRaw: Package directory not found: $src_base_dir")
-
 
1610
        unless ( -d $src_base_dir );
-
 
1611
 
1600
 
1612
    #
1601
    #
1613
    #   Build up a list of files to copy
1602
    #   Build up a list of files to copy
1614
    #   Creating a list allows:
1603
    #   Creating a list allows:
1615
    #       Simplified coding
1604
    #       Simplified coding
Line 3034... Line 3023...
3034
#                                             or a reference to a list of files
3023
#                                             or a reference to a list of files
3035
#                       $targetTag          - Symbolic name of target
3024
#                       $targetTag          - Symbolic name of target
3036
#                       Options             - Optional options
3025
#                       Options             - Optional options
3037
#
3026
#
3038
# Options:
3027
# Options:
3039
#                   --SelectFrom=xxxx       - Limits foile source selection
3028
#                   --SelectFrom=xxxx       - Limits file source selection
3040
#                                             By default all LIB sources are searched.
3029
#                                             By default all LIB sources are searched.
3041
#                                             The selector should be a Platform, Product
3030
#                                             The selector should be a Platform, Product
3042
#                                             ,Target or MachineType
3031
#                                             ,Target or MachineType
3043
#
3032
#
3044
#
3033
#
Line 3189... Line 3178...
3189
#                       Options             - Optional options
3178
#                       Options             - Optional options
3190
#
3179
#
3191
# Options:
3180
# Options:
3192
#                   --NoLink                - same as 3rd arg == nolinks
3181
#                   --NoLink                - same as 3rd arg == nolinks
3193
#                   --Link                  - Default
3182
#                   --Link                  - Default
3194
#                   --SelectFrom=xxxx       - Limits foile source selection
3183
#                   --SelectFrom=xxxx       - Limits file source selection
3195
#                                             By default all LIB sources are searched.
3184
#                                             By default all LIB sources are searched.
3196
#                                             The selector should be a Platform, Product
3185
#                                             The selector should be a Platform, Product
3197
#                                             ,Target or MachineType
3186
#                                             ,Target or MachineType
3198
#
3187
#
3199
# SourceFile options:
3188
# SourceFile options:
Line 3511... Line 3500...
3511
#       source location to a predefined destination location that is based on
3500
#       source location to a predefined destination location that is based on
3512
#       the build type.
3501
#       the build type.
3513
#
3502
#
3514
#       The sub routine also updates to the prototype file with an appropriate
3503
#       The sub routine also updates to the prototype file with an appropriate
3515
#       entry for the associated file.
3504
#       entry for the associated file.
-
 
3505
# Inputs:
-
 
3506
#       sDirTag                 - Source directory tag
-
 
3507
#       sfile                   - Source File Name [Mandatory]
-
 
3508
#       tfile                   - Not sure. Used in the prototype file.
-
 
3509
#                                 Suggest using the same name as sfile
3516
#
3510
#
3517
#       If it has any problems it will log an error and stop processing.
3511
#       If it has any problems it will log an error and stop processing.
3518
#
3512
#
3519
#------------------------------------------------------------------------------
3513
#------------------------------------------------------------------------------
3520
{
3514
{
Line 3539... Line 3533...
3539
    my ($sDirTag, $sfile, $tfile) = @_;
3533
    my ($sDirTag, $sfile, $tfile) = @_;
3540
 
3534
 
3541
 
3535
 
3542
    # we must have a filename.
3536
    # we must have a filename.
3543
    #
3537
    #
3544
    if ( "x$sfile" eq "x" )
3538
    unless ( $sfile )
3545
    {
3539
    {
3546
        Error("Source filename not supplied. Check deploy config.");
3540
        Error("Source filename not supplied. Check deploy config.");
3547
    }
3541
    }
3548
 
3542
 
3549
 
-
 
3550
    # lets check to see if the local src dir tag exists
3543
    # lets check to see if the local src dir tag exists
3551
    # if does not the process with log an error.
3544
    # if does not the process with log an error.
3552
    #
3545
    #
3553
    my ($sDirValue) = getLocalDirValue("$sDirTag", "A");
3546
    my ($sDirValue) = getLocalDirValue("$sDirTag", "A");
3554
 
3547
 
Line 4640... Line 4633...
4640
# Description:
4633
# Description:
4641
#       This sub-routine is used to return the local dir value from
4634
#       This sub-routine is used to return the local dir value from
4642
#       %LocalSrcDirStructure based on providing the 
4635
#       %LocalSrcDirStructure based on providing the 
4643
#       associated key.
4636
#       associated key.
4644
#
4637
#
-
 
4638
#
-
 
4639
# Input:
-
 
4640
#       m_key               - A symbolic directory name to be found in the
-
 
4641
#                             LocalSrcDirStructure
-
 
4642
#
-
 
4643
#                             A Package Name of the form
-
 
4644
#                             --Package=PackageName,subdir
-
 
4645
#
-
 
4646
#                             A directory within the interface directory
-
 
4647
#                             --Interface=subdir
-
 
4648
#
-
 
4649
#                             This form is only valid for an ABS address
-
 
4650
#
-
 
4651
#       m_type              - "A"   Absolute address
-
 
4652
#                             else  Relative address
-
 
4653
#
4645
#       If the value does not exist then it will return an error
4654
#       If the value does not exist then it will return an error
4646
#       and terminate processing.
4655
#       and terminate processing.
4647
#
4656
#
4648
#------------------------------------------------------------------------------
4657
#------------------------------------------------------------------------------
4649
{
4658
{
Line 4653... Line 4662...
4653
        Error("Incorrect number of params passed to " .
4662
        Error("Incorrect number of params passed to " .
4654
                  "getLocalDirValue() function.");
4663
                  "getLocalDirValue() function.");
4655
    }
4664
    }
4656
 
4665
 
4657
    my ($m_key, $m_type) = @_;
4666
    my ($m_key, $m_type) = @_;
-
 
4667
 
-
 
4668
    #
-
 
4669
    #   Determine the type of lookup
-
 
4670
    #
-
 
4671
    if ( $m_key =~ m~^--Interface=(.*)~ )
-
 
4672
    {
-
 
4673
        Error("Locating Interface directory must be used in conjunction with an Absolute path")
-
 
4674
            unless ( $m_type eq 'A' );
-
 
4675
 
-
 
4676
        my $SubDir = $1;
-
 
4677
        my $Dir = "$InterfaceDir/$SubDir";
-
 
4678
        Error ("Interface subdirectory not found: $SubDir" )
-
 
4679
            unless ( -d $Dir );
-
 
4680
        return $Dir;
-
 
4681
    }
-
 
4682
 
-
 
4683
    if ( $m_key =~ m~^--Package=(.*)~ )
-
 
4684
    {
-
 
4685
        Error("Locating local source directory must be used in conjunction with an Absolute path")
-
 
4686
            unless ( $m_type eq 'A' );
-
 
4687
 
-
 
4688
        #
-
 
4689
        #   Locate directory within a package
-
 
4690
        #
-
 
4691
        my ($PkgName, $PkgSubDir) = split /[\/,]/, $1, 2;
-
 
4692
        Error ("--Package requres a package name and a subdirectory") unless ( $PkgName && $PkgSubDir );
-
 
4693
        my $PkgDir = LocatePackageBase( "getLocalDirValue", $PkgName, $PkgSubDir );
-
 
4694
        return $PkgDir;
-
 
4695
    }
-
 
4696
 
-
 
4697
    #
-
 
4698
    #   Locate the directory within the LocalSrcDirStructure
-
 
4699
    #   This is a symbolic reference to a local directory
-
 
4700
    #
4658
    if (exists  $LocalSrcDirStructure{$m_key} )    
4701
    if (exists  $LocalSrcDirStructure{$m_key} )
4659
    {
4702
    {
4660
        if ( "$m_type" eq "A" )
4703
        if ( "$m_type" eq "A" )
4661
        {
4704
        {
4662
            return "$SrcDir/" .
-
 
4663
                   "$LocalSrcDirStructure{$m_key}";
4705
            return "$SrcDir/$LocalSrcDirStructure{$m_key}";
4664
        }
4706
        }
4665
        else
4707
        else
4666
        {
4708
        {
4667
            return "$LocalSrcDirStructure{$m_key}";
4709
            return "$LocalSrcDirStructure{$m_key}";
4668
        }
4710
        }
Line 6359... Line 6401...
6359
    {
6401
    {
6360
        Information("Renamed [$m_tfileLoc] to [$m_ifileLoc] ...");
6402
        Information("Renamed [$m_tfileLoc] to [$m_ifileLoc] ...");
6361
    }
6403
    }
6362
    else
6404
    else
6363
    {
6405
    {
6364
        Error("Failed to crename file [$m_tfileLoc] to [$m_ifileLoc]: $!");
6406
        Error("Failed to rename file [$m_tfileLoc] to [$m_ifileLoc]: $!");
6365
    }
6407
    }
6366
 
6408
 
6367
    return 1;
6409
    return 1;
6368
}
6410
}
6369
 
6411
 
Line 7684... Line 7726...
7684
    #   Not for me
7726
    #   Not for me
7685
    #
7727
    #
7686
    return 0;
7728
    return 0;
7687
}
7729
}
7688
 
7730
 
-
 
7731
#-------------------------------------------------------------------------------
-
 
7732
# Function        : LocatePackageBase
-
 
7733
#
-
 
7734
# Description     : Locate a package and return the path to a directory within
-
 
7735
#                   the package
-
 
7736
#
-
 
7737
# Inputs          : $ufn            - User function. Error reporting
-
 
7738
#                   $PkgName        - Name of the Package
-
 
7739
#                   $PkgSubDir      - Subdir within the package
-
 
7740
#
-
 
7741
#
-
 
7742
# Returns         : Absolute path to a directory within the package
-
 
7743
#
-
 
7744
my %LocatePackageBase_cache;
-
 
7745
sub LocatePackageBase
-
 
7746
{
-
 
7747
    my ( $ufn, $PkgName, $PkgSubDir ) = @_;
-
 
7748
    my $src_base_dir;
-
 
7749
 
-
 
7750
    if ( exists $LocatePackageBase_cache{$PkgName} )
-
 
7751
    {
-
 
7752
        $src_base_dir = $LocatePackageBase_cache{$PkgName};
-
 
7753
    }
-
 
7754
    else
-
 
7755
    {
-
 
7756
        #
-
 
7757
        #   Convert the package name into a real path name to the package as
-
 
7758
        #   held in dpkg_archive. Do not use the copy in the 'interface' directory
-
 
7759
        #
-
 
7760
        for my $entry ( $BuildFileInfo->getBuildPkgRules() )
-
 
7761
        {
-
 
7762
            next unless ( $entry->{'DNAME'} eq $PkgName );
-
 
7763
            $src_base_dir = $entry->{'ROOT'};
-
 
7764
            Verbose ("Discovered package in: $src_base_dir");
-
 
7765
        }
-
 
7766
 
-
 
7767
        Error ("$ufn: Package not located: $PkgName")
-
 
7768
            unless ( $src_base_dir );
-
 
7769
 
-
 
7770
        Error ("$ufn: Package directory not found: $src_base_dir")
-
 
7771
            unless ( -d $src_base_dir );
-
 
7772
 
-
 
7773
        #
-
 
7774
        #   Mainatin a cache of located packages
-
 
7775
        #
-
 
7776
        $LocatePackageBase_cache{$PkgName} = $src_base_dir;
-
 
7777
    }
-
 
7778
 
-
 
7779
    if ( $PkgSubDir )
-
 
7780
    {
-
 
7781
        $src_base_dir .= '/' . $PkgSubDir;
-
 
7782
        Error ("$ufn: Package subdirectory not found: $PkgSubDir" )
-
 
7783
            unless ( -d $src_base_dir );
-
 
7784
    }
-
 
7785
 
-
 
7786
    return $src_base_dir;
-
 
7787
}
-
 
7788
 
7689
#------------------------------------------------------------------------------
7789
#------------------------------------------------------------------------------
7690
1;
7790
1;