Subversion Repositories DevTools

Rev

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

Rev 1538 Rev 1540
Line 96... Line 96...
96
                    &installDpkgArchiveDocFile
96
                    &installDpkgArchiveDocFile
97
                    &installDpkgArchiveBinFile
97
                    &installDpkgArchiveBinFile
98
                    &installDpkgArchiveLibFile
98
                    &installDpkgArchiveLibFile
99
                    &installPkgAddConfigFile
99
                    &installPkgAddConfigFile
100
                    &installPkgAddSystemClassFile
100
                    &installPkgAddSystemClassFile
-
 
101
                    &installDpkgArchivePkgRaw
101
                    &updatePrototypeFileAddItem
102
                    &updatePrototypeFileAddItem
102
                    &updatePrototypeFileAddItem2
103
                    &updatePrototypeFileAddItem2
103
                    &addPath2Prototype
104
                    &addPath2Prototype
104
                    &createAfcRcScriptLink
105
                    &createAfcRcScriptLink
105
                    &createAfcRcScriptLink2
106
                    &createAfcRcScriptLink2
Line 141... Line 142...
141
                    $MachType
142
                    $MachType
142
                    $TargetHomeDir
143
                    $TargetHomeDir
143
                    $TargetBaseDir
144
                    $TargetBaseDir
144
 
145
 
145
                    $PkgName
146
                    $PkgName
-
 
147
                    $PkgVersionUser
-
 
148
                    $PkgVersion
146
 
149
 
147
                );
150
                );
148
 
151
 
149
#------------------------------------------------------------------------------
152
#------------------------------------------------------------------------------
150
# Constants global/local to this package
153
# Constants global/local to this package
Line 833... Line 836...
833
    {
836
    {
834
        if ( $TargetDstDirStructure{$i} =~ /\$/ )
837
        if ( $TargetDstDirStructure{$i} =~ /\$/ )
835
        {
838
        {
836
            Debug("-n", "Expanding TargetDstDirStructure [$TargetDstDirStructure{$i}] to ");
839
            Debug("-n", "Expanding TargetDstDirStructure [$TargetDstDirStructure{$i}] to ");
837
            $TargetDstDirStructure{$i} = eval "sprintf " . qq/"$TargetDstDirStructure{$i}"/;
840
            $TargetDstDirStructure{$i} = eval "sprintf " . qq/"$TargetDstDirStructure{$i}"/;
838
            print("[$TargetDstDirStructure{$i}]\n");
841
            Information("TargetDstDir $i =[$TargetDstDirStructure{$i}]");
839
        }
842
        }
840
    }
843
    }
841
 
844
 
842
    # lets check waht we can before proceeding.
845
    # lets check waht we can before proceeding.
843
    #
846
    #
Line 1468... Line 1471...
1468
 
1471
 
1469
    return @result;
1472
    return @result;
1470
}
1473
}
1471
 
1474
 
1472
#------------------------------------------------------------------------------
1475
#------------------------------------------------------------------------------
-
 
1476
sub installDpkgArchivePkgRaw
-
 
1477
#
-
 
1478
# Description:
-
 
1479
#       This sub-routine is used to install all pkg files from the named package
-
 
1480
#       in dpkg_archive into the defined install area.
-
 
1481
#
-
 
1482
#       If it has any problems it will log an error and stop processing.
-
 
1483
#
-
 
1484
# Inputs          : targetTag       - Target directory      [Mandatory]
-
 
1485
#                   package         - Source Package        [Mandatory]
-
 
1486
#                   options         - Optional options
-
 
1487
#                                       --NoRecurse
-
 
1488
#                                       --Recurse           [default]
-
 
1489
#                                       --Flatten
-
 
1490
#                                       --NoFlatten         [default]
-
 
1491
#                                       --FilterIn=xx
-
 
1492
#                                       --FilterInRE=xx     [default=.*]
-
 
1493
#                                       --FilterOut=xx
-
 
1494
#                                       --FilterOutRE=xx
-
 
1495
#                                       --Warn              [ default]
-
 
1496
#                                       --NoWarn
-
 
1497
#
-
 
1498
# Notes:    --FilterIn=xxxx, --FilterOut=xxx
-
 
1499
#           xxx is a simple Shell style filter where:
-
 
1500
#               * means one or more charters        '*.EXE'
-
 
1501
#               ? means a single character          '*.?'
-
 
1502
#               [abc] means either a or b or c      'file.[ch]'
-
 
1503
#
-
 
1504
#           --FilterInRE=xxx, --FilterOutRE=xxx
-
 
1505
#           xxx is a Regular Expression. There are harder to use but very
-
 
1506
#           powerful. ie '.*\.EXE$'
-
 
1507
#
-
 
1508
#           The 'In' filters are applied before the 'Out' filters.
-
 
1509
#
-
 
1510
#           If no 'In' filters are specified then all files will be included.
-
 
1511
#
-
 
1512
#           The filter rules are applied to the path below the Srcdir, and, for
-
 
1513
#           the purposes of the filter the path starts with a '/'.
-
 
1514
#
-
 
1515
#
-
 
1516
#       --NoWarn
-
 
1517
#           Supresses the warning message generated if no files are transferred
-
 
1518
#
-
 
1519
#------------------------------------------------------------------------------
-
 
1520
{
-
 
1521
    my $recurse = 1;
-
 
1522
    my @dir_tree_exclude;
-
 
1523
    my @dir_tree_include;
-
 
1524
    my $flatten = 0;
-
 
1525
    my $dstDir;
-
 
1526
    my @args;
-
 
1527
    my $src_base_dir;
-
 
1528
    my $warning = 1;
-
 
1529
    
-
 
1530
 
-
 
1531
    #
-
 
1532
    #   Process the arguments and extract parameters and options
-
 
1533
    #
-
 
1534
    foreach ( @_ )
-
 
1535
    {
-
 
1536
        if ( m/^--NoRecurse/ ) {
-
 
1537
            $recurse = 0;
-
 
1538
 
-
 
1539
        } elsif ( m/^--Recurse/ ) {
-
 
1540
            $recurse = 1;
-
 
1541
 
-
 
1542
        } elsif ( /^--FilterOut=(.*)/ ) {
-
 
1543
            push @dir_tree_exclude, glob2pat($1);
-
 
1544
 
-
 
1545
        } elsif ( /^--FilterOutRE=(.*)/ ) {
-
 
1546
            push @dir_tree_exclude, $1;
-
 
1547
 
-
 
1548
        } elsif ( /^--FilterIn=(.*)/ ) {
-
 
1549
            push @dir_tree_include, glob2pat($1);
-
 
1550
 
-
 
1551
        } elsif ( /^--FilterInRE=(.*)/ ) {
-
 
1552
            push @dir_tree_include, $1;
-
 
1553
 
-
 
1554
        } elsif ( /^--Flatten/ ) {
-
 
1555
            $flatten = 1;
-
 
1556
 
-
 
1557
        } elsif ( /^--NoFlatten/ ) {
-
 
1558
            $flatten = 0;
-
 
1559
 
-
 
1560
        } elsif ( /^--NoWarn/ ) {
-
 
1561
            $warning = 0;
-
 
1562
 
-
 
1563
        } elsif ( /^--Warn/ ) {
-
 
1564
            $warning = 1;
-
 
1565
 
-
 
1566
        } elsif ( m/^--/ ) {
-
 
1567
            Error("installDpkgArchivePkgRaw: Unknown option: $_")
-
 
1568
 
-
 
1569
        } else {
-
 
1570
            push @args, $_;
-
 
1571
 
-
 
1572
        }
-
 
1573
    }
-
 
1574
 
-
 
1575
    #
-
 
1576
    #   Have removed all the options
-
 
1577
    #   Must have two parameters left
-
 
1578
    #
-
 
1579
    if ( $#args != 1 )
-
 
1580
    {
-
 
1581
        Error("Incorrect number of params passed to installDpkgArchivePkgRaw() function.",
-
 
1582
              "Check deploy config.");
-
 
1583
    }
-
 
1584
    
-
 
1585
    my ( $dstDirTag, $pkgName ) = @args;
-
 
1586
 
-
 
1587
    #
-
 
1588
    #   Ensure that the user has specified a target directory
-
 
1589
    #   Convert the symbolic target directory to a real path
-
 
1590
    #
-
 
1591
    Error("installDpkgArchivePkgRaw: No target directories specified")
-
 
1592
        unless ( $dstDirTag );
-
 
1593
    $dstDir = getTargetDstDirValue($dstDirTag, "A");
-
 
1594
 
-
 
1595
    #
-
 
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
-
 
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")
-
 
1607
        unless ( $src_base_dir );
-
 
1608
 
-
 
1609
    Error ("installDpkgArchivePkgRaw: Package directory not found: $src_base_dir")
-
 
1610
        unless ( -d $src_base_dir );
-
 
1611
 
-
 
1612
    #
-
 
1613
    #   Build up a list of files to copy
-
 
1614
    #   Creating a list allows:
-
 
1615
    #       Simplified coding
-
 
1616
    #       Flattening and testing of the flattening
-
 
1617
    #
-
 
1618
    my @elements = ExpandDirTree( $src_base_dir, \@dir_tree_exclude, \@dir_tree_include, $recurse );
-
 
1619
    Information("Installing Raw Pkg files: $pkgName") if @elements;
-
 
1620
 
-
 
1621
    #
-
 
1622
    #   Perform the file copy
-
 
1623
    #   This copy will NOT create empty directories, but it will create needed
-
 
1624
    #   directories on the fly.
-
 
1625
    #
-
 
1626
    foreach  my $sfile ( @elements )
-
 
1627
    {
-
 
1628
 
-
 
1629
        #
-
 
1630
        #   Split into directory and file as we may need to make the directory
-
 
1631
        #   since the copy operation will not
-
 
1632
        #
-
 
1633
        my $dir;                                # Target directory
-
 
1634
        my $tfile;                              # Target path
-
 
1635
       (my $fname = $sfile )=~ s~^.*/+~~;       # Filename(only)
-
 
1636
 
-
 
1637
        unless ( $flatten )
-
 
1638
        {
-
 
1639
            $sfile =~ m~^(.*/)~;
-
 
1640
            $dir = "$dstDir/$1";
-
 
1641
            $tfile = $sfile;
-
 
1642
        }
-
 
1643
        else
-
 
1644
        {
-
 
1645
            $dir = $dstDir;
-
 
1646
            $tfile = $fname;
-
 
1647
        }
-
 
1648
 
-
 
1649
        #
-
 
1650
        #   Ensure the target directory is present
-
 
1651
        #
-
 
1652
        make_directory ( $dir, 0775 );
-
 
1653
 
-
 
1654
        #
-
 
1655
        #   Copy the file
-
 
1656
        #   Ensure that the target file does not already exist
-
 
1657
        #   This is most likely to occur when flattening the directory structure
-
 
1658
        #
-
 
1659
        my $m_sfile = "$src_base_dir$sfile";
-
 
1660
        my $m_tfile = "$dstDir/$tfile";
-
 
1661
 
-
 
1662
        if ( -f $m_tfile  )
-
 
1663
        {
-
 
1664
            Error("Failed to copy file [$m_sfile] to [$m_tfile]: File already exists");
-
 
1665
        }
-
 
1666
 
-
 
1667
        if( File::Copy::copy("$m_sfile", "$m_tfile") )
-
 
1668
        {
-
 
1669
            Verbose("Copied [$fname] to [$m_tfile] ...");
-
 
1670
        }
-
 
1671
        else
-
 
1672
        {
-
 
1673
            Error("Failed to copy file [$m_sfile] to [$m_tfile]: $!");
-
 
1674
        }
-
 
1675
    }
-
 
1676
 
-
 
1677
    #
-
 
1678
    #   Return the number of files transferred
-
 
1679
    #
-
 
1680
    my $nfiles = $#elements + 1;
-
 
1681
    Warning("Installing Raw Pkg files: $pkgName - No files transferred") if ( $warning && ! $nfiles ) ;
-
 
1682
 
-
 
1683
    return $nfiles;
-
 
1684
}
-
 
1685
 
-
 
1686
 
-
 
1687
#------------------------------------------------------------------------------
1473
sub installAllDpkgArchiveDevcdFiles
1688
sub installAllDpkgArchiveDevcdFiles
1474
#
1689
#
1475
# Description:
1690
# Description:
1476
#       This sub-routine is used to install all devcd files from the
1691
#       This sub-routine is used to install all devcd files from the
1477
#       dpkg_archive into the defined install area.
1692
#       dpkg_archive into the defined install area.