Subversion Repositories DevTools

Rev

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

Rev 6073 Rev 6133
Line 21... Line 21...
21
use PackageEntry;
21
use PackageEntry;
22
use JatsEnv;
22
use JatsEnv;
23
use JatsSystem;
23
use JatsSystem;
24
use JatsVersionUtils;
24
use JatsVersionUtils;
25
use FileUtils;
25
use FileUtils;
-
 
26
use ToolsetFiles;
26
use Pod::Usage;
27
use Pod::Usage;
27
use Getopt::Long;
28
use Getopt::Long;
28
use File::Path;
29
use File::Path;
29
use XML::Writer;
30
use XML::Writer;
30
use ArrayHashUtils;
31
use ArrayHashUtils;
Line 42... Line 43...
42
our $Interface              = 0;
43
our $Interface              = 0;
43
our $RootOnly               = 0;
44
our $RootOnly               = 0;
44
our $Perms                  = 0;
45
our $Perms                  = 0;
45
our $Expert                 = 0;
46
our $Expert                 = 0;
46
our $All                    = 0;
47
our $All                    = 0;
47
our $Nolog                  = 0;
-
 
48
our $Cache                  = $ENV{GBE_DPKG_CACHE_CTL} || 0;
48
our $Cache                  = $ENV{GBE_DPKG_CACHE_CTL} || 0;
49
our $NoPackageError         = 0;
49
our $NoPackageError         = 0;
50
our $ForceBuildPkg          = 0;
50
our $ForceBuildPkg          = 0;
51
our $Srcdir                 = "";               # default source root
51
our $Srcdir                 = "";               # default source root
52
our $ForceBuild             = 1;
52
our $ForceBuild             = 1;
Line 101... Line 101...
101
 
101
 
102
my  $DeleteDPACKAGE         = 0;                # Must clobber DPACKAGE
102
my  $DeleteDPACKAGE         = 0;                # Must clobber DPACKAGE
103
my  $build_source_pkg       = 0;                # Flag to build source package
103
my  $build_source_pkg       = 0;                # Flag to build source package
104
my  $opt_help               = 0;
104
my  $opt_help               = 0;
105
my  $sandbox_exact          = 0;                # Exact or in-exact sandbox
105
my  $sandbox_exact          = 0;                # Exact or in-exact sandbox
-
 
106
my  $pkgFromSandbox         = 0;                # Flags that we have imported a package from a sandbox
-
 
107
 
-
 
108
my  $genToolsetPlatform     = 0;                # BuildToolset directive has been seen
-
 
109
my  $genToolsetActive       = 0;                # TOOLSET platform required:1, Error:2
-
 
110
my  $toolsetPlatform        = 'NONE';           # TOOLSET Display Value
-
 
111
my  @genToolsetArgs;                            # Args for a generated TOOLSET
106
 
112
 
107
BuildLibInit();
113
BuildLibInit();
108
 
114
 
109
sub BuildLibInit
115
sub BuildLibInit
110
{
116
{
Line 156... Line 162...
156
                             "man:3"         => \$opt_help,
162
                             "man:3"         => \$opt_help,
157
                             "debug:+"       => \$::ScmDebug,
163
                             "debug:+"       => \$::ScmDebug,
158
                             "verbose:+"     => \$::ScmVerbose,
164
                             "verbose:+"     => \$::ScmVerbose,
159
                             "expert:1"      => \$Expert,
165
                             "expert:1"      => \$Expert,
160
                             "all"           => \$All,
166
                             "all"           => \$All,
161
                             "nolog"         => \$Nolog,
-
 
162
                             "cache:+"       => \$Cache,
167
                             "cache:+"       => \$Cache,
163
                             "package"       => \$NoPackageError,
168
                             "package"       => \$NoPackageError,
164
                             "nopackages"    => \$IgnorePkgs,
169
                             "nopackages"    => \$IgnorePkgs,
165
                             "forcebuildpkg" => \$ForceBuildPkg,
170
                             "forcebuildpkg" => \$ForceBuildPkg,
166
                             "force!"        => \$ForceBuild,
171
                             "force!"        => \$ForceBuild,
Line 174... Line 179...
174
    Debug( "BuildFile:     ", $ScmBuildSrc );
179
    Debug( "BuildFile:     ", $ScmBuildSrc );
175
    Debug( "Debug:         ", $::ScmDebug );
180
    Debug( "Debug:         ", $::ScmDebug );
176
    Debug( "Verbose:       ", $::ScmVerbose );
181
    Debug( "Verbose:       ", $::ScmVerbose );
177
    Debug( "Expert:        ", $Expert );
182
    Debug( "Expert:        ", $Expert );
178
    Debug( "All:           ", $All );
183
    Debug( "All:           ", $All );
179
    Debug( "Nolog:         ", $Nolog );
-
 
180
    Debug( "Cache:         ", $Cache );
184
    Debug( "Cache:         ", $Cache );
181
    Debug( "package:       ", $NoPackageError );
185
    Debug( "package:       ", $NoPackageError );
182
    Debug( "ForcePkg  :    ", $ForceBuildPkg );
186
    Debug( "ForcePkg  :    ", $ForceBuildPkg );
183
    Debug( "ForceBuild :   ", $ForceBuild );
187
    Debug( "ForceBuild :   ", $ForceBuild );
184
    Debug( "IgnorePkgs :   ", $IgnorePkgs );
188
    Debug( "IgnorePkgs :   ", $IgnorePkgs );
Line 203... Line 207...
203
 
207
 
204
        } elsif ( $CmdSwitch eq "help" || $CmdSwitch eq "usage" ) {
208
        } elsif ( $CmdSwitch eq "help" || $CmdSwitch eq "usage" ) {
205
            $opt_help = 1;
209
            $opt_help = 1;
206
            Usage();
210
            Usage();
207
 
211
 
208
        } elsif ( $CmdSwitch eq "changelog" ) {
-
 
209
            if ( -d "CVS" )                         # CVS support subdir
-
 
210
            {
-
 
211
                System( "$::GBE_PERL $::GBE_TOOLS/cvs2cl.pl --tags --branches --revisions --day-of-week" )
-
 
212
            }
-
 
213
            exit(1);
-
 
214
 
-
 
215
        } else {
212
        } else {
216
            Usage( "(E) build. Unknown command \"$CmdSwitch\"" );
213
            Usage( "(E) build. Unknown command \"$CmdSwitch\"" );
217
        }
214
        }
218
    }
215
    }
219
 
216
 
Line 336... Line 333...
336
            unless ( $Srcdir );
333
            unless ( $Srcdir );
337
    }
334
    }
338
}
335
}
339
 
336
 
340
#-------------------------------------------------------------------------------
337
#-------------------------------------------------------------------------------
-
 
338
# Function        : isKeyword 
-
 
339
#
-
 
340
# Description     : Test for an attempt to use reserved platform name 
-
 
341
#
-
 
342
# Inputs          : $test   - Name to test
-
 
343
#
-
 
344
# Returns         : Reserved word or none
-
 
345
#
-
 
346
sub isKeyword
-
 
347
{
-
 
348
    my ($test) = @_;
-
 
349
    foreach my $keyword ( qw (NATIVE TOOLSET GENERIC INSTRUMENT))
-
 
350
    {
-
 
351
        return $keyword if (uc($test) eq $keyword);
-
 
352
    }
-
 
353
 
-
 
354
    return undef;
-
 
355
}
-
 
356
 
-
 
357
 
-
 
358
#-------------------------------------------------------------------------------
341
# Function        : BuildAlias
359
# Function        : BuildAlias
342
#
360
#
343
# Description     : Create an alias for multiple targets
361
# Description     : Create an alias for multiple targets
344
#                   The default operations will:
362
#                   The default operations will:
345
#                       Add the alias as a default platform (* in the makefile.pl)
363
#                       Add the alias as a default platform (* in the makefile.pl)
Line 399... Line 417...
399
        }
417
        }
400
    }
418
    }
401
    Error( "BuildAlias() missing alias specifications" )
419
    Error( "BuildAlias() missing alias specifications" )
402
        if ( $alias eq "" );
420
        if ( $alias eq "" );
403
 
421
 
-
 
422
    Error ("BuildAlias() attempt to alias a keyword: $alias")
-
 
423
        if ( isKeyword($alias) );
404
 
424
 
405
    #
425
    #
406
    #   If we need to recalculate the alias based on targets, then tag the alias
426
    #   If we need to recalculate the alias based on targets, then tag the alias
407
    #   to be processed
427
    #   to be processed
408
    #
428
    #
409
    $BUILDALIAS_TARGETS{ $alias } = ''
429
    $BUILDALIAS_TARGETS{ $alias } = ''
410
        if ( $target_mode );
430
        if ( $target_mode );
411
 
431
 
412
    #   Define alias
432
    #   Define alias
413
    #
433
    #
414
    if ( PlatformConfig::checkBuildAvailability($alias) == 2 )
434
    if ( PlatformConfig::targetHasTag($alias, 'GENERIC') )
415
    {
435
    {
416
        Error( "BuildAlias() cannot create an alias named $alias", "That name is reserved for generic targets" );
436
        Error( "BuildAlias() cannot create an alias named $alias", "That name is reserved for generic targets" );
417
    }
437
    }
418
    elsif ( $alias ne quotemeta( $alias ) )
438
    elsif ( $alias ne quotemeta( $alias ) )
419
    {
439
    {
-
 
440
        Error   ("BuildAlias() alias '$alias' contains invalid characters") unless defined($::GBE_ABT);
420
        Warning( "BuildAlias() alias '$alias' contains invalid characters -- ignored" );
441
        Warning( "BuildAlias() alias '$alias' contains invalid characters -- ignored" );
421
    }
442
    }
422
    elsif ( $BUILDALIAS{ $alias } )
443
    elsif ( $BUILDALIAS{ $alias } )
423
    {
444
    {
-
 
445
        Error   ("BuildAlias() duplicate alias '$alias'") unless defined($::GBE_ABT);
424
        Warning( "BuildAlias() duplicate alias '$alias' -- alias ignored" );
446
        Warning( "BuildAlias() duplicate alias '$alias' -- alias ignored" );
425
    }
447
    }
426
    else
448
    else
427
    {
449
    {
428
        #
450
        #
Line 431... Line 453...
431
        #   This solves order dependancy problems.
453
        #   This solves order dependancy problems.
432
        #
454
        #
433
        @arguments = ExpandPlatforms( @arguments )
455
        @arguments = ExpandPlatforms( @arguments )
434
            unless $target_mode;
456
            unless $target_mode;
435
 
457
 
436
        my $platform = "";                   # current platform
458
        my $platform = '';                   # current platform
437
        my @pargs = ();                      # current args
459
        my @pargs = ();                      # current args
438
 
460
 
439
        #
461
        #
440
        #   Process the expanded arguments
462
        #   Process the expanded arguments
441
        #   Collect arguments and process when a new platform is discovered
463
        #   Collect arguments and process when a new platform is discovered
Line 480... Line 502...
480
            }
502
            }
481
        }
503
        }
482
    }
504
    }
483
}
505
}
484
 
506
 
-
 
507
#-------------------------------------------------------------------------------
-
 
508
# Function        : BuildAliasDef  
-
 
509
#
-
 
510
# Description     : Shorthand for BuildAlias (xxx,-Define, ... )
-
 
511
#                   The way is should have been done  :(
-
 
512
#
-
 
513
# Inputs          : $alias          Name of alias to define
-
 
514
#                   arguments       Alias arguments; platforms or targets
-
 
515
#
-
 
516
sub BuildAliasDef()
-
 
517
{
-
 
518
    my( $alias, @arguments ) = @_;
-
 
519
    BuildAlias($alias . ',--Define', @arguments);
-
 
520
}
485
 
521
 
486
#-------------------------------------------------------------------------------
522
#-------------------------------------------------------------------------------
487
# Function        : Process_TargetAlias
523
# Function        : Process_TargetAlias
488
#
524
#
489
# Description     : Post Process the --Target option for the build alias
525
# Description     : Post Process the --Target option for the build alias
Line 546... Line 582...
546
        }
582
        }
547
    }
583
    }
548
}
584
}
549
 
585
 
550
#-------------------------------------------------------------------------------
586
#-------------------------------------------------------------------------------
-
 
587
# Function        : CleanUp_Aliases 
-
 
588
#
-
 
589
# Description     : Will fully expand aliases to simplify display and processing 
-
 
590
#                       Remove arguments that  start with a '-'
-
 
591
#                       Remove bits that start with a !
-
 
592
#
-
 
593
# Inputs          : 
-
 
594
#
-
 
595
# Returns         : 
-
 
596
#
-
 
597
sub CleanUp_Aliases
-
 
598
{
-
 
599
    #
-
 
600
    #   Clean up Aliases
-
 
601
    #
-
 
602
#DebugDumpData("BEFORE CleanUp_Aliases", \%BUILDALIAS);
-
 
603
    foreach my $alias ( keys %BUILDALIAS )
-
 
604
    {
-
 
605
        my @aliasList = split(/ /, $BUILDALIAS{$alias});
-
 
606
        my @expanded =  ExpandPlatforms(@aliasList);
-
 
607
 
-
 
608
        my %add;
-
 
609
        my %remove;
-
 
610
 
-
 
611
        foreach ( @expanded)
-
 
612
        {
-
 
613
            if (m/^-/) {
-
 
614
            } elsif (m/^!(.*)/) {
-
 
615
                $remove{$1} = 1;
-
 
616
            } else {
-
 
617
                $add{$_} = 1;
-
 
618
            }
-
 
619
        }
-
 
620
 
-
 
621
        #
-
 
622
        #   If there are NO additive expressions in the alias, then
-
 
623
        #   assume all the active targets
-
 
624
        #
-
 
625
        unless (keys %add) {
-
 
626
            foreach  ( @BUILD_ACTIVEPLATFORMS)
-
 
627
            {
-
 
628
                 $add{$_} = 1;
-
 
629
            }
-
 
630
        }
-
 
631
 
-
 
632
 
-
 
633
        foreach ( keys %remove) {
-
 
634
            delete $add { $_};
-
 
635
        }
-
 
636
 
-
 
637
        $BUILDALIAS{$alias} = join(' ',keys %add);
-
 
638
    }
-
 
639
#DebugDumpData("AFTER CleanUp_Aliases", \%BUILDALIAS);
-
 
640
}
-
 
641
 
-
 
642
 
-
 
643
#-------------------------------------------------------------------------------
551
# Function        : BuildProduct
644
# Function        : BuildProduct
552
#
645
#
553
# Description     : Create a family of Platforms with a common product line
646
# Description     : Create a family of Platforms with a common product line
554
#                   ie: Create two flavors of the TP5, one based on the MOSF and
647
#                   ie: Create two flavors of the TP5, one based on the MOSF and
555
#                   the othe based on the MOS68 toolset.
648
#                   the othe based on the MOS68 toolset.
Line 663... Line 756...
663
        #
756
        #
664
        unless ( $arg eq '++' )
757
        unless ( $arg eq '++' )
665
        {
758
        {
666
            $target = $arg;
759
            $target = $arg;
667
            Error( "BuildProduct() cannot create a product based on a GENERIC platform" )
760
            Error( "BuildProduct() cannot create a product based on a GENERIC platform" )
668
                if ( PlatformConfig::checkBuildAvailability($target) == 2);
761
                if ( PlatformConfig::targetHasTag($target,'GENERIC') );
669
            next;
762
            next;
670
        }
763
        }
671
 
764
 
672
        #
765
        #
673
        #   Infer a BuildPlatform
766
        #   Infer a BuildPlatform
Line 715... Line 808...
715
    $buildentry{BASE} = $target;
808
    $buildentry{BASE} = $target;
716
    $buildentry{USES} = [ @$pUses ] if $pUses;
809
    $buildentry{USES} = [ @$pUses ] if $pUses;
717
    foreach ( @$pArgs )
810
    foreach ( @$pArgs )
718
    {
811
    {
719
        if ( m~^--Alias=(.+)~ ) {
812
        if ( m~^--Alias=(.+)~ ) {
-
 
813
            foreach my $alias (split(',',$1))
-
 
814
            {
-
 
815
                Error ("$fname() attempt to alias a keyword: $alias")
-
 
816
                    if ( isKeyword($alias) );
720
            push @{$buildentry{USERALIAS}}, split(',',$1);
817
                push @{$buildentry{USERALIAS}},$alias;
721
        }
818
            }
722
        else{
819
        } else {
723
            push @{$buildentry{ARGS}}, $_;
820
            push @{$buildentry{ARGS}}, $_;
724
        }
821
        }
725
    }
822
    }
726
 
823
 
727
    #   Detect reserved words being misused as a platform name
824
    #   Detect reserved words being misused as a platform name
728
    #   At the moment, the value of NATIVE is calculate towards the end of the
825
    #   At the moment, the value of NATIVE and TOOLSET are calculate towards the end of the
729
    #   build process so that it can be limited to platfroms that 
826
    #   build process so that it can be limited to platforms that are present.
-
 
827
    foreach my $reserved ( qw (NATIVE TOOLSET INSTRUMENT))
730
    #   are present.
828
    {
731
    Error('Invalid use of the platform alias NATIVE','The NATIVE alias cannot be used to define build platforms')
829
        Error("Invalid use of the platform alias $reserved","The $reserved alias cannot be used to define build platforms")
732
        if (uc($target) eq 'NATIVE');
830
            if (uc($target) eq uc($reserved));
-
 
831
    }
733
 
832
 
734
    #
833
    #
735
    #   Allow per-platform processing to be alter the basic information
834
    #   Allow per-platform processing to be alter the basic information
736
    #   Special processing may be perform to extend the information
835
    #   Special processing may be perform to extend the information
737
    #   Allows special processing to be enabled on a per-target basis
836
    #   Allows special processing to be enabled on a per-target basis
Line 828... Line 927...
828
 
927
 
829
    #
928
    #
830
    #   Detect GENERIC targets
929
    #   Detect GENERIC targets
831
    #       The Build file is only allowed to have one that can be built on any one machine
930
    #       The Build file is only allowed to have one that can be built on any one machine
832
    #
931
    #
833
    my $buildAvailability = PlatformConfig::checkBuildAvailability( $base_target );
932
    my $buildAvailability = PlatformConfig::targetHasTag( $base_target, 'KNOWN' );
834
    if ($buildAvailability == 2 )
933
    if (PlatformConfig::targetHasTag( $base_target, 'GENERIC' ) )
835
    {
934
    {
836
        UniquePush (\@GENERIC_TARGETS, $target );
935
        UniquePush (\@GENERIC_TARGETS, $target );
-
 
936
    }
-
 
937
 
-
 
938
    #
-
 
939
    #   Detect GENERIC_<machType> targets
-
 
940
    #
-
 
941
    if (PlatformConfig::targetHasTag( $base_target, 'GENERIC_MACHTYPE' ) )
-
 
942
    {
837
        $pInfo->{IS_GENERIC} = 1;
943
        $pInfo->{IS_GENERIC} = 1;
-
 
944
        $pInfo->{ALIAS} = 'GENERIC';
-
 
945
        $pInfo->{NOT_AVAILABLE} = 1 unless needToolset();
-
 
946
        $All = 1;
838
    }
947
    }
839
 
948
 
840
    #
949
    #
841
    #   Ensure target is known to JATS
950
    #   Ensure target is known to JATS
842
    #   Remove unknown targets from the build. Create a list of unknown
951
    #   Remove unknown targets from the build. Create a list of unknown
Line 846... Line 955...
846
    #   an alias that has not been expanded.
955
    #   an alias that has not been expanded.
847
    #
956
    #
848
    #   One result will be that alias platforms, such as DEVLINUX, that don't
957
    #   One result will be that alias platforms, such as DEVLINUX, that don't
849
    #   expand on WIN32 will be shown as DEVLINUX and not its components.
958
    #   expand on WIN32 will be shown as DEVLINUX and not its components.
850
    #
959
    #
851
    unless ( $pInfo->{NOT_AVAILABLE} || exists $BUILDINFO{$target} || $pInfo->{IS_GENERIC} )
960
    unless ( $pInfo->{NOT_AVAILABLE} || exists $BUILDINFO{$target} || $pInfo->{IS_GENERIC} || ($base_target =~ m~^GENERIC_~) )
852
    {
961
    {
853
        unless ( Exists( "$::GBE_CONFIG/PLATFORM", $base_target  ) )
962
        unless ( Exists( "$::GBE_CONFIG/PLATFORM", $base_target  ) )
854
        {
963
        {
855
            UniquePush (\@BUILD_BADNAME, $target ) 
964
            UniquePush (\@BUILD_BADNAME, $target ); 
856
                unless PlatformConfig::checkKnownSpecial($target);
-
 
857
            $pInfo->{NOT_AVAILABLE} = 1;
965
            $pInfo->{NOT_AVAILABLE} = 1;
858
        }
966
        }
859
    }
967
    }
860
 
968
 
861
    #
969
    #
Line 1233... Line 1341...
1233
        UniquePush (\@BUILDEXCLUDE, split(/\s*,\s*/,$_));
1341
        UniquePush (\@BUILDEXCLUDE, split(/\s*,\s*/,$_));
1234
    }
1342
    }
1235
}
1343
}
1236
 
1344
 
1237
#-------------------------------------------------------------------------------
1345
#-------------------------------------------------------------------------------
-
 
1346
# Function        : BuildToolset 
-
 
1347
#
-
 
1348
# Description     : Indicate that this package will build binary parts of a JATS
-
 
1349
#                   toolset.
-
 
1350
#                   
-
 
1351
#                   Should be used to indicate that it building non-binary parts
-
 
1352
#                   too.
-
 
1353
#                   
-
 
1354
#                   Used as a sanity test.
-
 
1355
#
-
 
1356
# Inputs          : Options to limit the Machine Types affected 
-
 
1357
#
-
 
1358
# Returns         : 
-
 
1359
#
-
 
1360
sub BuildToolset
-
 
1361
{
-
 
1362
    my( @arguments ) = @_;
-
 
1363
    my ($exclude, $include, $including);
-
 
1364
 
-
 
1365
    $genToolsetPlatform = 1;
-
 
1366
    Debug( "BuildToolset(@arguments)" );
-
 
1367
    Error( "BuildToolset must appear before BuildName()..." )
-
 
1368
        if ( $BUILDNAME ne "" );
-
 
1369
 
-
 
1370
    #
-
 
1371
    #   Process TOOLSET specific options
-
 
1372
    #       --ExcludeMachType=xxxx,yyy
-
 
1373
    #       --MachType=xxxx,yyy
-
 
1374
    #
-
 
1375
    foreach ( @arguments )
-
 
1376
    {
-
 
1377
        if ( m~^--ExcludeMachType=(.+)~i ) {
-
 
1378
            foreach my $arch (split(',',$1))
-
 
1379
            {
-
 
1380
                if (uc($arch) eq uc($::GBE_MACHTYPE))
-
 
1381
                {
-
 
1382
                    Verbose("Exclude TOOLSET on this machine");
-
 
1383
                    $exclude = 1;
-
 
1384
                    last;
-
 
1385
                }
-
 
1386
            }
-
 
1387
        } elsif ( m~^--MachType=(.+)~i ) {
-
 
1388
            $including = 1;
-
 
1389
            foreach my $arch (split(',',$1))
-
 
1390
            {
-
 
1391
                if (uc($arch) eq uc($::GBE_MACHTYPE))
-
 
1392
                {
-
 
1393
                    Verbose("Include TOOLSET on this machine");
-
 
1394
                    $include = 1;
-
 
1395
                    last;
-
 
1396
                }
-
 
1397
            }
-
 
1398
 
-
 
1399
        } else {
-
 
1400
            Error ("BuildToolset: Unknown option: $_");
-
 
1401
        }
-
 
1402
    }
-
 
1403
 
-
 
1404
    #
-
 
1405
    #   Show we build for this architecture
-
 
1406
    #
-
 
1407
    $genToolsetActive = 0;
-
 
1408
    if ($exclude) {
-
 
1409
        $toolsetPlatform = 'Excluded';
-
 
1410
        return;
-
 
1411
    }
-
 
1412
 
-
 
1413
    if ($including) {
-
 
1414
        if ($include) {
-
 
1415
            $genToolsetActive = 1;
-
 
1416
        } else {
-
 
1417
            $toolsetPlatform = 'Not included';
-
 
1418
        }
-
 
1419
        return;
-
 
1420
    }
-
 
1421
 
-
 
1422
    $genToolsetActive = 1;
-
 
1423
    return;
-
 
1424
}
-
 
1425
 
-
 
1426
 
-
 
1427
#-------------------------------------------------------------------------------
1238
# Function        : BuildName
1428
# Function        : BuildName
1239
#
1429
#
1240
# Description     : Defines the package name and version
1430
# Description     : Defines the package name and version
1241
#
1431
#
1242
# Inputs          : build arguments
1432
# Inputs          : build arguments
Line 1259... Line 1449...
1259
    my( @arguments ) = @_;
1449
    my( @arguments ) = @_;
1260
    my $relaxed_version_name = 0;
1450
    my $relaxed_version_name = 0;
1261
    my @args;
1451
    my @args;
1262
 
1452
 
1263
    Debug( "BuildName(@arguments)" );
1453
    Debug( "BuildName(@arguments)" );
1264
 
-
 
1265
    Error( "Platform(s) not defined.",
1454
    Error( "Platform(s) not defined.",
1266
            "BuildAlias, BuildProduct and BuildPlatform directives must be defined prior to BuildName()." )
1455
            "BuildAlias, BuildProduct and BuildPlatform directives must be defined prior to BuildName()." )
1267
        unless( scalar @BUILDPLATFORMS );
1456
        unless( scalar @BUILDPLATFORMS );
1268
 
1457
 
1269
#.. Parse arguments
1458
#.. Parse arguments
Line 1283... Line 1472...
1283
    #
1472
    #
1284
    #   Clobber processing done after values have been accumulated
1473
    #   Clobber processing done after values have been accumulated
1285
    #   as they may be used later
1474
    #   as they may be used later
1286
    #
1475
    #
1287
    return if ( $Clobber );
1476
    return if ( $Clobber );
1288
    ToolsetFile('build.log');
1477
    ToolsetFiles::AddFile('build.log');
1289
    ToolsetFile('ChangeLog', 'ChangeLog.bak') if ( $ScmHost eq "Unix" );
-
 
1290
    
1478
    
1291
    #
1479
    #
1292
    #   Determine type of sandbox
1480
    #   Determine type of sandbox
1293
    #
1481
    #
1294
    $sandbox_exact = ( -f $::GBE_DPKG_SBOX . '/.exact' )
1482
    $sandbox_exact = ( -f $::GBE_DPKG_SBOX . '/.exact' )
1295
        if ( $::GBE_DPKG_SBOX );
1483
        if ( $::GBE_DPKG_SBOX );
1296
    
1484
    
1297
#.. Create the ChangeLog
-
 
1298
#
-
 
1299
    if ( -d "CVS" )                             # CVS support subdir
-
 
1300
    {
-
 
1301
        System( "$::GBE_PERL $::GBE_TOOLS/cvs2cl.pl --tags --branches --revisions --day-of-week" )
-
 
1302
            if ( $Nolog == 0 && $ScmHost eq "Unix" );
-
 
1303
    }
-
 
1304
 
-
 
1305
 
-
 
1306
#.. Create build.log summary information
1485
#.. Create build.log summary information
1307
#
1486
#
1308
    my ($sep) = "\n".(" " x 11) . ". ";
1487
    my ($sep) = "\n".(" " x 11) . ". ";
1309
 
1488
 
1310
    Log( "\nBuild configuration (version $::GBE_VERSION)" );
1489
    Log( "\nBuild configuration (version $::GBE_VERSION)" );
Line 1335... Line 1514...
1335
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL" );
1514
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL" );
1336
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX" );
1515
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX" );
1337
    Log( "Sandbox .... " . ($sandbox_exact ? "Exact" : "Development") );
1516
    Log( "Sandbox .... " . ($sandbox_exact ? "Exact" : "Development") );
1338
    Log( "LocalFilter. $::GBE_SANDBOX/buildfilter") if ( $::GBE_SANDBOX && -f $::GBE_SANDBOX . '/buildfilter' );
1517
    Log( "LocalFilter. $::GBE_SANDBOX/buildfilter") if ( $::GBE_SANDBOX && -f $::GBE_SANDBOX . '/buildfilter' );
1339
 
1518
 
1340
    Log( "Platforms .. " . PrintPlatforms(\@BUILDPLATFORMS, $sep) );
-
 
1341
 
-
 
1342
    #
1519
    #
1343
    #   Generate a list of platforms that are completely unknown to JATS
1520
    #   Generate a list of platforms that are completely unknown to JATS
1344
    #   May be the result of a user typo or a guess
1521
    #   May be the result of a user typo or a guess
1345
    #
1522
    #
1346
    if ( @BUILD_BADNAME )
1523
    if ( @BUILD_BADNAME )
Line 1365... Line 1542...
1365
    #
1542
    #
1366
    #   Generate a list of active platforms
1543
    #   Generate a list of active platforms
1367
    #   Ensure that there are some active platforms
1544
    #   Ensure that there are some active platforms
1368
    #
1545
    #
1369
    GeneratePlatformList();
1546
    GeneratePlatformList();
-
 
1547
    Log( "Platforms .. " . PrintPlatforms(\@BUILDPLATFORMS, $sep) );
1370
 
1548
 
1371
    #
1549
    #
1372
    #   Detect a mix of Generic and non Generic targets
1550
    #   Detect a mix of Generic and non Generic targets
1373
    #       Cannot mix generic and non-generic targets
1551
    #       Cannot mix generic and non-generic targets
1374
    #
1552
    #
Line 1381... Line 1559...
1381
            Error("Cannot mix GENERIC and non-GENERIC targets in the one build");
1559
            Error("Cannot mix GENERIC and non-GENERIC targets in the one build");
1382
        }
1560
        }
1383
    }
1561
    }
1384
 
1562
 
1385
    #
1563
    #
1386
    #   Build System Generic Saniy Test
1564
    #   Build System Generic Sanity Test
1387
    #       If Generic   then MUST be a GENERIC build
1565
    #       If Generic   then MUST be a GENERIC build
1388
    #       If NoGeneric then MUST not be a GENERIC build
1566
    #       If NoGeneric then MUST not be a GENERIC build
1389
    #
1567
    #
1390
    if (defined $GenericBuild)
1568
    if (defined $GenericBuild)
1391
    {
1569
    {
Line 1399... Line 1577...
1399
    }
1577
    }
1400
 
1578
 
1401
    unless( @BUILD_ACTIVEPLATFORMS )
1579
    unless( @BUILD_ACTIVEPLATFORMS )
1402
    {
1580
    {
1403
        my $msg = 'GBE_BUILDFILTER prevents any targets being built';
1581
        my $msg = 'GBE_BUILDFILTER prevents any targets being built';
1404
        if (defined($::GBE_ABT)) {
1582
        if (defined($::GBE_ABT) || defined($::GBE_SANDBOX )) {
1405
 
1583
 
1406
            # Build filter on this machine prevents the package building
1584
            # Build filter on this machine prevents the package building
1407
            # On a Build System this is not an error
1585
            # On a Build System this is not an error
1408
            #   Create a dummy platform called NOBUILD
1586
            #   Create a dummy platform called NOBUILD
1409
            #   Do not populate the interface directory with package data
1587
            #   Do not populate the interface directory with package data
Line 1421... Line 1599...
1421
    else
1599
    else
1422
    {
1600
    {
1423
        Log( "Build for .. ". PrintPlatforms(\@BUILD_ACTIVEPLATFORMS, $sep));
1601
        Log( "Build for .. ". PrintPlatforms(\@BUILD_ACTIVEPLATFORMS, $sep));
1424
    }
1602
    }
1425
 
1603
 
-
 
1604
    ProcessToolSetPlatform() if $genToolsetActive;
-
 
1605
    Log( "Toolset .... " . $toolsetPlatform ) if $genToolsetPlatform;
-
 
1606
    Error ("No suitable TOOLSET platform found") if (($genToolsetActive > 1) && $::GBE_ABT);
-
 
1607
 
1426
    #
1608
    #
1427
    #   Generate an error if nothing can be done because the GBE_PLATFORM
1609
    #   Generate an error if nothing can be done because the GBE_PLATFORM
1428
    #   masks any useful operation.
1610
    #   masks any useful operation.
1429
    #
1611
    #
1430
    if ( $::GBE_PLATFORM )
1612
    if ( $::GBE_PLATFORM )
Line 1455... Line 1637...
1455
    }
1637
    }
1456
 
1638
 
1457
    return 1;
1639
    return 1;
1458
}
1640
}
1459
 
1641
 
-
 
1642
#-------------------------------------------------------------------------------
-
 
1643
# Function        : needToolset 
-
 
1644
#
-
 
1645
# Description     : Internal. Determine if this machine needs to build for
-
 
1646
#                   a TOOLSET or a GENERIC_<MachType>
-
 
1647
#                   
-
 
1648
#                   In Build System
-
 
1649
#                       BUILDFILTER must identify the machine performing TOOLSET builds
-
 
1650
#                       
-
 
1651
#                       The build filter MUST contain the psuedo platform TOOLSET in order for 
-
 
1652
#                       the alias to be created. This requires that the build daemons be configured to 
-
 
1653
#                       specify a TOOLSET. 
-
 
1654
#                       
-
 
1655
#                       Care MUST be taken to not configure multiple TOOLSET candiates 
-
 
1656
#                       on similar machine types.
-
 
1657
#                       
-
 
1658
#                   Non Build Sytem (User Development)
-
 
1659
#                       True    
-
 
1660
#
-
 
1661
# Inputs          : 
-
 
1662
#
-
 
1663
# Returns         : 
-
 
1664
#
-
 
1665
sub needToolset
-
 
1666
{
-
 
1667
    my $toolsetNeeded;
-
 
1668
 
-
 
1669
    $toolsetNeeded = 1 if (!defined($::GBE_ABT));
-
 
1670
    if (!$toolsetNeeded && defined($::GBE_BUILDFILTER) ) {
-
 
1671
        $toolsetNeeded = grep( /^TOOLSET$/, split( ' ', $::GBE_BUILDFILTER ) );
-
 
1672
    }
-
 
1673
 
-
 
1674
    return $toolsetNeeded;
-
 
1675
}
-
 
1676
 
-
 
1677
#-------------------------------------------------------------------------------
-
 
1678
# Function        : ProcessToolSetPlatform 
-
 
1679
#
-
 
1680
# Description     : Locate the TOOLSET platform if required
-
 
1681
#                   In Build System
-
 
1682
#                       BUILDFILTER must identify the machine performing TOOLSET builds
-
 
1683
#                       The first suitable target will be chosen
-
 
1684
#                       
-
 
1685
#                       The build filter MUST contain the psuedo platform TOOLSET in order for 
-
 
1686
#                       the alias to be created. This requires that the build daemons be configured to 
-
 
1687
#                       specify a TOOLSET. 
-
 
1688
#                       
-
 
1689
#                       Care MUST be taken to not configure multiple TOOLSET candiates 
-
 
1690
#                       on similar machine types.
-
 
1691
#                       
-
 
1692
#                   Non Build Sytem (User Development)
-
 
1693
#                       The first suitable target will be chosen    
-
 
1694
#
-
 
1695
# Inputs          : 
-
 
1696
#
-
 
1697
# Returns         : 
-
 
1698
#
-
 
1699
sub ProcessToolSetPlatform
-
 
1700
{
-
 
1701
    my $toolsetNeeded;
-
 
1702
    my $toolset;
-
 
1703
 
-
 
1704
    #
-
 
1705
    #   User is not allowed to create a TOOLSET alias
-
 
1706
    #       This should be captured before here, but ...
-
 
1707
    #
-
 
1708
    if (exists $BUILDALIAS{TOOLSET})
-
 
1709
    {
-
 
1710
        Error('Internal: User has manually specified a TOOLSET alias' );
-
 
1711
    }
-
 
1712
 
-
 
1713
    #
-
 
1714
    #   Determine if we need to do any work
-
 
1715
    #
-
 
1716
    return unless needToolset();
-
 
1717
 
-
 
1718
    #
-
 
1719
    #   Need to ensure that we have a TOOLSET platform in the build set
-
 
1720
    #
-
 
1721
    my %activePlatformMap = map {$_ => 1} @BUILD_ACTIVEPLATFORMS;
-
 
1722
    my @toolsetTargets = PlatformConfig::getTargetsByTag('TOOLSET'); 
-
 
1723
    foreach my $item (@toolsetTargets)
-
 
1724
    {
-
 
1725
        if (exists($activePlatformMap{$item}))
-
 
1726
        {
-
 
1727
            #
-
 
1728
            #   Add TOOLSET arguments into the existing target
-
 
1729
            #   Really only expecting --OnlyProd
-
 
1730
            #
-
 
1731
            if ( @genToolsetArgs) {
-
 
1732
                PlatformArgument($item, @genToolsetArgs);
-
 
1733
            }
-
 
1734
 
-
 
1735
            # Update the displayed Toolset platform
-
 
1736
            $toolset = $item;
-
 
1737
            $toolsetPlatform = $toolset;
-
 
1738
            last;
-
 
1739
        }
-
 
1740
    }
-
 
1741
 
-
 
1742
    #
-
 
1743
    #   No toolset platform found in the current build set
-
 
1744
    #   
-
 
1745
    unless ($toolset) {
-
 
1746
        $toolsetPlatform = "None found in current build set"; 
-
 
1747
        $genToolsetActive = 2;
-
 
1748
        return;
-
 
1749
    }
-
 
1750
 
-
 
1751
    #
-
 
1752
    #   Insert alias information
-
 
1753
    #
-
 
1754
    $BUILDALIAS{TOOLSET} = $toolset;
-
 
1755
    push @{$BUILDINFO{$toolset}{USERALIAS}}, 'TOOLSET';
-
 
1756
}
1460
 
1757
 
-
 
1758
#-------------------------------------------------------------------------------
-
 
1759
# Function        : BuildPreviousVersion 
-
 
1760
#
-
 
1761
# Description     : Deprecated. Do not use 
-
 
1762
#
-
 
1763
# Inputs          : 
-
 
1764
#
-
 
1765
# Returns         : 
-
 
1766
#
1461
sub BuildPreviousVersion
1767
sub BuildPreviousVersion
1462
{
1768
{
1463
    my( $version ) = shift;
1769
    my( $version ) = shift;
1464
 
1770
 
1465
    $BUILDPREVIOUSVERSION = $version;
1771
    $BUILDPREVIOUSVERSION = $version;
Line 1471... Line 1777...
1471
 
1777
 
1472
sub BuildInterface
1778
sub BuildInterface
1473
{
1779
{
1474
    my( $ifdirname ) = @_;
1780
    my( $ifdirname ) = @_;
1475
 
1781
 
1476
 
-
 
1477
    #
1782
    #
1478
    #   Clobber the directory - at the end.
1783
    #   Clobber the directory - at the end.
1479
    #
1784
    #
1480
    if ( $Clobber )
1785
    if ( $Clobber )
1481
    {
1786
    {
Line 1483... Line 1788...
1483
        #   If this Interface directory contains the Dpackage.cfg file
1788
        #   If this Interface directory contains the Dpackage.cfg file
1484
        #   then JATS has created DPACKAGE and it needs to be clobbered
1789
        #   then JATS has created DPACKAGE and it needs to be clobbered
1485
        #   Flag that it needs to be done later - when we know where it is
1790
        #   Flag that it needs to be done later - when we know where it is
1486
        #
1791
        #
1487
        $DeleteDPACKAGE = 1 if ( -f "$ifdirname/Dpackage.cfg" );
1792
        $DeleteDPACKAGE = 1 if ( -f "$ifdirname/Dpackage.cfg" );
1488
 
-
 
1489
        push @CLOBBERDIRS, $ifdirname;
-
 
1490
        return;
-
 
1491
    }
1793
    }
1492
 
1794
 
1493
    #
1795
    #
1494
    #   In AutoBuildTool mode the entire interface directory
1796
    #   Generate the required directory
1495
    #   will be deleted. This allows the build to be retried
-
 
1496
    #
1797
    #
-
 
1798
    BuildInterfaceInternal($ifdirname);
1497
    if (  defined($::GBE_ABT) )   # clobber mode ?
1799
    Log( "Interface .. $ifdirname" );
1498
    {
1800
    return 1;
-
 
1801
}
-
 
1802
 
-
 
1803
#-------------------------------------------------------------------------------
1499
        if ( -d $ifdirname )
1804
# Function        : BuildInterfaceInternal  
-
 
1805
#
-
 
1806
# Description     : Internal Use Only
-
 
1807
#                   Guts of the BuildInterface processing 
-
 
1808
#
-
 
1809
# Inputs          : $ifdirname  - Name of an interface directory
-
 
1810
#
1500
        {
1811
# Returns         : 
-
 
1812
#
-
 
1813
 
-
 
1814
sub BuildInterfaceInternal
-
 
1815
{
1501
                RmDirTree( $ifdirname );
1816
    my( $ifdirname ) = @_;
1502
        }
1817
    my @createDirs;
1503
    }
1818
 
-
 
1819
    push @CLOBBERDIRS, $ifdirname;
1504
 
1820
 
1505
    if ( $ifdirname eq "local" ) {
1821
    if ( $ifdirname eq "local" ) {
1506
        mkpath ( "$ifdirname/inc" );
1822
        push @createDirs, "$ifdirname/inc";
1507
        $BUILDLOCAL = "local";
1823
        $BUILDLOCAL = "local";
1508
 
1824
 
1509
    } else {
1825
    } else {
1510
        mkpath ( "$ifdirname/include" );
1826
        push @createDirs, "$ifdirname/include";
1511
        $BUILDINTERFACE = $ifdirname;
1827
        $BUILDINTERFACE = $ifdirname;
1512
        $::ScmInterface = $ifdirname;
1828
        $::ScmInterface = $ifdirname;
1513
    }
1829
    }
1514
    mkpath ( "$ifdirname/bin" );
-
 
1515
    mkpath ( "$ifdirname/lib" );
-
 
1516
 
1830
 
-
 
1831
    unless ($Clobber) {
-
 
1832
        push @createDirs, "$ifdirname/bin";
1517
    Log( "Interface .. $ifdirname" );
1833
        push @createDirs, "$ifdirname/lib";
-
 
1834
 
-
 
1835
        foreach my $dir ( @createDirs)
-
 
1836
        {
-
 
1837
            mkpath($dir);
1518
    return 1;
1838
        }
-
 
1839
        ToolsetFiles::AddDir($ifdirname, 'Internal');
-
 
1840
    }
1519
}
1841
}
1520
 
1842
 
1521
 
1843
 
-
 
1844
 
1522
sub BuildDirTree
1845
sub BuildDirTree
1523
{
1846
{
1524
    my( $dirfile, $dirhead ) = @_;
1847
    my( $dirfile, $dirhead ) = @_;
1525
    my( $dirname, $c );
1848
    my( $dirname, $c );
1526
 
1849
 
Line 1601... Line 1924...
1601
        Log( "PackageIncludes. $name" ) unless ( $INC{$file} );
1924
        Log( "PackageIncludes. $name" ) unless ( $INC{$file} );
1602
        require $file;
1925
        require $file;
1603
    }
1926
    }
1604
}
1927
}
1605
 
1928
 
1606
 
-
 
1607
sub LinkSandbox
-
 
1608
{
-
 
1609
    my( $name, $path, $platform ) = @_;
-
 
1610
    return if ( $Clobber );                     # clobber mode ?
-
 
1611
 
-
 
1612
    Warning ("LinkSandbox() This directive is being deprecated.");       #Dec-2011
-
 
1613
 
-
 
1614
    Error ("LinkSandbox() expects three arguments:  @_")
-
 
1615
        unless ( $#_ == 2 );
-
 
1616
 
-
 
1617
    Error ("LinkSandbox not allowed in ABT build","It can only be used in a Development Environment")
-
 
1618
        if ( $::GBE_ABT );
-
 
1619
 
-
 
1620
    Debug( "LinkSandbox:" );
-
 
1621
    Debug( "Package:   $name" );
-
 
1622
    Debug( "Version:   $path" );
-
 
1623
 
-
 
1624
    DataDirective("LinkSandbox");               # This directive allowed here
-
 
1625
 
-
 
1626
    if ( $IgnorePkgs )
-
 
1627
    {
-
 
1628
        Log( "LinkSandbox. $name ($path) - Ignored" );
-
 
1629
        return;
-
 
1630
    }
-
 
1631
 
-
 
1632
#
-
 
1633
#   If GBE_BUILDFILTER exists, Import 'user' platform
-
 
1634
#   specification and filter against the BUILD_ACTIVEPLATFORMS.
-
 
1635
#
-
 
1636
    Log( "LinkSandbox. $name ($path)" );
-
 
1637
 
-
 
1638
    if ( ! -d $path )                           # sandbox exists ?
-
 
1639
    {
-
 
1640
        Log( "WARNING .... Sandbox $path not available" );
-
 
1641
    }
-
 
1642
    else
-
 
1643
    {
-
 
1644
        my @platforms;
-
 
1645
        if ( !defined($platform) || $platform eq "*" ) {
-
 
1646
            @platforms = @BUILD_ACTIVEPLATFORMS;
-
 
1647
        } else {
-
 
1648
            @platforms = ExpandPlatforms( split( ',', $platform ) );
-
 
1649
        }
-
 
1650
 
-
 
1651
        $path = Realpath( $path );
-
 
1652
        IncludePkg ( $name, $path );
-
 
1653
        foreach my $platform ( @platforms )
-
 
1654
        {
-
 
1655
            LinkEntry( $platform, $path, $name, "!sandbox", 1, 1 );
-
 
1656
        }
-
 
1657
    }
-
 
1658
}
-
 
1659
 
-
 
1660
 
-
 
1661
#-------------------------------------------------------------------------------
1929
#-------------------------------------------------------------------------------
1662
# Function        : LinkPkgArchive
1930
# Function        : LinkPkgArchive
1663
#
1931
#
1664
# Description     : Include an external package into the build sandbox
1932
# Description     : Include an external package into the build sandbox
1665
#                   by extending the compiler and linker search paths to
1933
#                   by extending the compiler and linker search paths to
Line 1781... Line 2049...
1781
        {
2049
        {
1782
            $isa_cache = 0;
2050
            $isa_cache = 0;
1783
            next;
2051
            next;
1784
        }
2052
        }
1785
        
2053
        
1786
 
-
 
1787
        #
2054
        #
1788
        #   If we are playing in a sandbox, then the version number is
2055
        #   If we are playing in a sandbox, then the version number is
1789
        #   not used. The Package suffix is still used so that we can
2056
        #   not used. The Package suffix is still used so that we can
1790
        #   differentiate sysbasetypes.xxxxx.mas and sysbasetypes.xxxxx.syd
2057
        #   differentiate sysbasetypes.xxxxx.mas and sysbasetypes.xxxxx.syd
1791
        #
2058
        #
Line 1798... Line 2065...
1798
        else
2065
        else
1799
        {
2066
        {
1800
            $version = $uversion;
2067
            $version = $uversion;
1801
        }
2068
        }
1802
 
2069
 
1803
        #
-
 
1804
        #   Alias support
-
 
1805
        #   If the 'version' is '!current' then use a version of:
-
 
1806
        #       current
-
 
1807
        #       current_<USER_NAME>
-
 
1808
        #   This is an old mechanism whose use should not be encouraged
-
 
1809
        #
-
 
1810
        #..
-
 
1811
        if ( $version eq "!current" )
-
 
1812
        {
-
 
1813
            Error ("Use of !current is not allowed in ABT build")
-
 
1814
                if ( $::GBE_ABT );
-
 
1815
 
-
 
1816
            $pkg = "$dpkg/$name/current";       # current
-
 
1817
            $pkg = "$dpkg/$name/current.lnk"
-
 
1818
                if ( -e "$dpkg/$name/current.lnk" );
-
 
1819
 
-
 
1820
                                                # USER specific current
-
 
1821
            EnvImport( "USER" );
-
 
1822
            $pkg = "$dpkg/$name/current_$::USER"
-
 
1823
                if ( -e "$dpkg/$name/current_$::USER" );
-
 
1824
 
-
 
1825
            $pkg = "$dpkg/$name/current_$::USER.lnk"
-
 
1826
                if ( -e "$dpkg/$name/current_$::USER.lnk" );
-
 
1827
        }
-
 
1828
        else
-
 
1829
        {                                       # standard
-
 
1830
            $pkg = "$dpkg/$name/$version";
2070
        $pkg = "$dpkg/$name/$version";
1831
            $pkg = "$dpkg/$name/$version.lnk"
2071
        $pkg = "$dpkg/$name/$version.lnk"
1832
                if ( -e "$dpkg/$name/$version.lnk" );
2072
            if ( -e "$dpkg/$name/$version.lnk" );
1833
        }
2073
        
1834
 
-
 
1835
        #
2074
        #
1836
        #   Using a soft link
2075
        #   Using a soft link
1837
        #   Emulate a link in software. The link file contains one line
2076
        #   Emulate a link in software. The link file contains one line
1838
        #   which is the real pathname of the package
2077
        #   which is the real pathname of the package
1839
        #
2078
        #
Line 1848... Line 2087...
1848
                     "Both a link and a package where found - using the link" )
2087
                     "Both a link and a package where found - using the link" )
1849
                                                            if ( -d $non_link );
2088
                                                            if ( -d $non_link );
1850
 
2089
 
1851
            Debug( "           link found -> $pkg" );
2090
            Debug( "           link found -> $pkg" );
1852
            my $link_src = $pkg;
2091
            my $link_src = $pkg;
1853
            open( LNKFILE, '<', "$pkg" ) || Error( "cannot open '$pkg'" );
-
 
1854
            $pkg = <LNKFILE>;                   # real path
-
 
1855
            close( LNKFILE );
-
 
1856
            $pkg = '' unless ( $pkg );
2092
            $pkg = TagFileRead($pkg);
1857
            $pkg =~ s~\s+$~~;
2093
            $pkg =~ s~\\~/~g;
1858
            if ($pkg =~ s~^GBE_SANDBOX/~$::GBE_SANDBOX/~)
2094
            if ($pkg =~ s~^GBE_SANDBOX/~$::GBE_SANDBOX/~)
1859
            {
2095
            {
-
 
2096
                    $pkgFromSandbox++;
-
 
2097
 
1860
                    # If the target sandbox is in the 'deploymode' then the package
2098
                    # If the target sandbox is in the 'deploymode' then the package
1861
                    # will not be in the expected location. It will be in a 'build/deploy'
2099
                    # will not be in the expected location. It will be in a 'build/deploy'
1862
                    # subdir. Remove the pkg/name dir to get to the root of the package
2100
                    # subdir. Remove the pkg/name dir to get to the root of the package
1863
                    my @dirs = File::Spec->splitdir( $pkg );
2101
                    my @dirs = File::Spec->splitdir( $pkg );
1864
                    splice(@dirs, -2);
2102
                    splice(@dirs, -2);
Line 2066... Line 2304...
2066
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -wait -quiet $name/$version" );
2304
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -wait -quiet $name/$version" );
2067
    }
2305
    }
2068
 
2306
 
2069
    #
2307
    #
2070
    #   Locate the package
2308
    #   Locate the package
2071
    #   Use the first instance of the package that it found
2309
    #   Use the first instance of the package that is found
2072
    #
2310
    #
2073
    Log( "BuildPkgArchive . $name ($version)" );
2311
    Log( "BuildPkgArchive . $name ($version)" );
2074
    my ( $pkg, $local ) = PackageLocate( $name, $version );
2312
    my ( $pkg, $local ) = PackageLocate( $name, $version );
2075
    if ( $pkg )
2313
    if ( $pkg )
2076
    {
2314
    {
Line 2099... Line 2337...
2099
                  );
2337
                  );
2100
 
2338
 
2101
        #
2339
        #
2102
        #   Determine the package format and use the appropriate installer
2340
        #   Determine the package format and use the appropriate installer
2103
        #   Supported formats
2341
        #   Supported formats
2104
        #       1) Package has a descpkg file (new style)
2342
        #       1) Package has a descpkg file (only style currently supported)
2105
        #       2) Package has a InstallPkg.sh file (old style)
-
 
2106
        #       3) Package has a Install.sh file (old style is it used ??)
-
 
2107
        #
2343
        #
2108
        if ( $package_installed ) {
2344
        if ( $package_installed ) {
2109
            Verbose ("Package already installed: $name, $version");
2345
            Verbose ("Package already installed: $name, $version");
2110
            
2346
            
2111
        } else {
2347
        } else {
Line 2129... Line 2365...
2129
                #
2365
                #
2130
                
2366
                
2131
                System( "cd $pkg; $::GBE_PERL $::GBE_TOOLS/installpkg.pl $Cwd/$BUILDINTERFACE $Cwd @opts $arglist");
2367
                System( "cd $pkg; $::GBE_PERL $::GBE_TOOLS/installpkg.pl $Cwd/$BUILDINTERFACE $Cwd @opts $arglist");
2132
                Error( "Package installation error" ) if ( $? != 0 );
2368
                Error( "Package installation error" ) if ( $? != 0 );
2133
            }
2369
            }
2134
            elsif ( -e "$pkg/InstallPkg.sh" )
-
 
2135
            {
-
 
2136
                System( "(cd $pkg; ./InstallPkg.sh $Cwd/$BUILDINTERFACE $Cwd)" );
-
 
2137
            }
-
 
2138
            elsif ( -e "$pkg/Install.sh" )
-
 
2139
            {
-
 
2140
                System( "(cd $pkg; ./Install.sh $Cwd/$BUILDINTERFACE $Cwd)" );
-
 
2141
            }
-
 
2142
            else
2370
            else
2143
            {
2371
            {
2144
                Error ("Unknown package format for package $name/$version found in $pkg");
2372
                Error ("Unknown package format for package $name/$version found in $pkg");
2145
            }
2373
            }
2146
 
2374
 
Line 2251... Line 2479...
2251
 
2479
 
2252
    return "@arglist";
2480
    return "@arglist";
2253
}
2481
}
2254
 
2482
 
2255
#-------------------------------------------------------------------------------
2483
#-------------------------------------------------------------------------------
2256
# Function        : TagFileMatch 
-
 
2257
#
-
 
2258
# Description     : Test the contents of a simple (one line) file against a string    
-
 
2259
#
-
 
2260
# Inputs          : $tfile      - Name of the tage file
-
 
2261
#                   $tag        - Tag to match 
-
 
2262
#
-
 
2263
# Returns         : True - is a match
-
 
2264
#
-
 
2265
sub TagFileMatch
-
 
2266
{
-
 
2267
    my ($tfile, $tag) = @_;
-
 
2268
    return 0 unless -f $tfile;
-
 
2269
 
-
 
2270
    open( my $file, '<', $tfile) || return 0;
-
 
2271
    my $text = <$file>;
-
 
2272
    close $file;
-
 
2273
 
-
 
2274
    # Remove trailing new line and white space
-
 
2275
    $text =~ s~\s*$~~;
-
 
2276
    #Debug0("TagFileMatch:'$text':'$tag'", $text eq $tag );
-
 
2277
 
-
 
2278
    return $text eq $tag;
-
 
2279
}
-
 
2280
 
-
 
2281
 
-
 
2282
#-------------------------------------------------------------------------------
-
 
2283
# Function        : GeneratePlatformList
2484
# Function        : GeneratePlatformList
2284
#
2485
#
2285
# Description     : Return a list of platforms that should particiate in this
2486
# Description     : Return a list of platforms that should particiate in this
2286
#                   build. This is a function of
2487
#                   build. This is a function of
2287
#                       1) Platforms defined in the build.pl file
2488
#                       1) Platforms defined in the build.pl file
Line 2423... Line 2624...
2423
                    unless ( $1 );
2624
                    unless ( $1 );
2424
 
2625
 
2425
                #
2626
                #
2426
                #   Expand PLATFORMs into known aliases
2627
                #   Expand PLATFORMs into known aliases
2427
                #   Alias will expand to PLATFORMs so it won't work unless we are
2628
                #   Alias will expand to PLATFORMs so it won't work unless we are
2428
                #   processing PALTFORMs.
2629
                #   processing PLATFORMs.
2429
                #
2630
                #
2430
                my @taglist = ( $table eq "PLATFORM" ) ? ExpandPlatforms($3) : $3;
2631
                my @taglist = ( $table eq "PLATFORM" ) ? ExpandPlatforms($3) : $3;
2431
 
2632
 
2432
                #
2633
                #
2433
                #   Add / Remove items from the result
2634
                #   Add / Remove items from the result
Line 2435... Line 2636...
2435
                for my $item ( @taglist )
2636
                for my $item ( @taglist )
2436
                {
2637
                {
2437
                    my $plist = $part_to_platform{$table}{$item};
2638
                    my $plist = $part_to_platform{$table}{$item};
2438
                    for ( @{$plist})
2639
                    for ( @{$plist})
2439
                    {
2640
                    {
2440
                        if ( $2 )
2641
                        if ( $2 ) {
2441
                        {
-
 
2442
                            delete $result{$_};
2642
                            delete $result{$_};
2443
                        }
-
 
2444
                        else
2643
                        } else {
2445
                        {
-
 
2446
                            $result{$_} = 1;
2644
                            $result{$_} = 1;
2447
                        }
2645
                        }
2448
                    }
2646
                    }
2449
                }
2647
                }
2450
            }
2648
            }
Line 2454... Line 2652...
2454
            }
2652
            }
2455
        }
2653
        }
2456
 
2654
 
2457
        #
2655
        #
2458
        #   Process BuildExclude
2656
        #   Process BuildExclude
2459
        #   A list of 
2657
        #   A list of targets to be excluded
-
 
2658
        #       INSTRUMENT is a key word
2460
        #
2659
        #
2461
        for my $word (@BUILDEXCLUDE)
2660
        for my $word (@BUILDEXCLUDE)
2462
        {
2661
        {
2463
            my $platform;
2662
            my $platform;
2464
 
2663
 
2465
            Error('BuildExclude: Unknown option: ' . $word) if ($word =~ m~^-~);
2664
            Error('BuildExclude: Unknown option: ' . $word) if ($word =~ m~^-~);
2466
            Error('BuildExclude: Invalid format: ' . $word) if ($word =~ m~^!~);
2665
            Error('BuildExclude: Invalid format: ' . $word) if ($word =~ m~^!~);
2467
 
2666
 
2468
            #
2667
            #
-
 
2668
            #   INSTRUMENT is a key word
2469
            #   Remove items from the result
2669
            #       Remove all instrumented builds
2470
            #
2670
            #
2471
            my $table = "TARGET";
2671
            if ($word eq 'INSTRUMENT')
-
 
2672
            {
2472
            my $plist = $part_to_platform{$table}{$word};
2673
                for ( keys %result) {
2473
            Warning('BuildExclude: Unknown target:' . $word ) unless $plist;
2674
                    if ( PlatformConfig::targetHasTag( $_, 'INSTRUMENT') ) {
-
 
2675
                        delete $result{$_} ;
2474
            for ( @{$plist})
2676
                    }
-
 
2677
                }
-
 
2678
            }
-
 
2679
            else
2475
            {
2680
            {
-
 
2681
                #
-
 
2682
                #   Remove items from the result
-
 
2683
                #
-
 
2684
                my $table = "PLATFORM";
-
 
2685
                my $plist = $part_to_platform{$table}{$word};
-
 
2686
                if ($plist) {
-
 
2687
                    for ( @{$plist}) {
2476
                delete $result{$_};
2688
                        delete $result{$_};
-
 
2689
                    }
-
 
2690
                }
-
 
2691
                else  {
-
 
2692
                    Warning('BuildExclude: Unknown target:' . $word ) 
-
 
2693
                        unless exists $::BUILDINFO{$word};
-
 
2694
                }
2477
            }
2695
            }
2478
        }
2696
        }
2479
 
2697
 
2480
        #
2698
        #
2481
        #   Return an array of platforms to process
2699
        #   Return an array of platforms to process
Line 2688... Line 2906...
2688
#                   Directive can be used at any time before the BuildMake
2906
#                   Directive can be used at any time before the BuildMake
2689
#
2907
#
2690
#                   Will handle the existence of an auto.pl file by inserting
2908
#                   Will handle the existence of an auto.pl file by inserting
2691
#                   it as build.pl.
2909
#                   it as build.pl.
2692
#
2910
#
2693
# Inputs          : Options
2911
# Inputs          : $platform   - In ABT mode. Process under this platform name
2694
#
2912
#
2695
#
2913
#
2696
# Returns         : 
2914
# Returns         : 
2697
#
2915
#
2698
sub BuildSrcArchive
2916
sub BuildSrcArchive
2699
{
2917
{
-
 
2918
    my ($platform) = @_;
-
 
2919
    Error ("BuildSrcArchive requires one platform specifier") unless (defined $platform);
-
 
2920
 
-
 
2921
 
2700
    #
2922
    #
2701
    #   If we are clobbering, then there is nothing to do
2923
    #   If we are clobbering, then there is nothing to do
2702
    #   The generated file is placed within the interface
2924
    #   The generated file is placed within the interface
2703
    #   directory and that directory will be deleted during the clobber
2925
    #   directory and that directory will be deleted during the clobber
2704
    #
2926
    #
2705
    return if ( $Clobber );
2927
    return if ( $Clobber );
2706
    DataDirective("BuildSrcArchive");
2928
    DataDirective("BuildSrcArchive");
2707
 
2929
 
2708
    #
2930
    #
-
 
2931
    #   If not in ABT mode, then build archive on developers machine
-
 
2932
    #   In ABT mode only build the archive on a machine whose platform name is in the build filter
-
 
2933
    #
-
 
2934
    my $doBuild;
-
 
2935
    if (defined($::GBE_ABT))
-
 
2936
    {
-
 
2937
        if (defined ($::GBE_BUILDFILTER))
-
 
2938
        {
-
 
2939
            $doBuild  = grep( /^$platform/, split( ' ', $::GBE_BUILDFILTER ) );
-
 
2940
        }
-
 
2941
        unless ( $doBuild )
-
 
2942
        {
-
 
2943
            Log( "SrcPackage . Not on this machine" );
-
 
2944
            return; 
-
 
2945
        }
-
 
2946
    }
-
 
2947
 
-
 
2948
 
-
 
2949
    #
2709
    #   Currently this operation is only supported of some platforms
2950
    #   Currently this operation is only supported of some platforms
2710
    #   Only supported on Unix platforms
2951
    #   Only supported on Unix platforms
2711
    #   Uses the 'pax' utility
2952
    #   Uses the 'pax' utility
2712
    #
2953
    #
2713
    unless ( LocateProgInPath ( 'pax', '--All' ) && ( $ScmHost eq "Unix" ) )
2954
    unless ( LocateProgInPath ( 'pax', '--All' ) && ( $ScmHost eq "Unix" ) )
Line 2773... Line 3014...
2773
    {
3014
    {
2774
        next if ( m/^\.$/ );
3015
        next if ( m/^\.$/ );
2775
        next if ( m'^\.\.$' );
3016
        next if ( m'^\.\.$' );
2776
        next if ( m'^build\.log$' );
3017
        next if ( m'^build\.log$' );
2777
        next if ( m'\.gbe$' );
3018
        next if ( m'\.gbe$' );
-
 
3019
        next if ( m'\.svn$' );
-
 
3020
        next if ( m'\.git$' );
-
 
3021
        next if ( m'\.cvs$' );
-
 
3022
        next if ( m'local_dpkg_archive$' );
-
 
3023
        next if ( m'\.jats.packageroot$' );
2778
        next if ( m'^local$' );
3024
        next if ( m'^local$' );
2779
        next if ( m'^pkg$' );
3025
        next if ( m'^pkg$' );
2780
        next if ( m/^$BUILDINTERFACE$/ );
3026
        next if ( m/^$BUILDINTERFACE$/ );
2781
        $auto_pl = 1, next  if ( m'^auto\.pl$' );
3027
        $auto_pl = 1, next  if ( m'^auto\.pl$' );
2782
        next if (  m'^build\.pl$' );
3028
        next if (  m'^build\.pl$' );
Line 2910... Line 3156...
2910
    #   information.
3156
    #   information.
2911
    #
3157
    #
2912
    TestForForcedBuild();
3158
    TestForForcedBuild();
2913
 
3159
 
2914
    #
3160
    #
2915
    #   Calcuate the aliases that are being extracted from targets
3161
    #   Calculate the aliases that are being extracted from targets
2916
    #
3162
    #
2917
    Process_TargetAlias();
3163
    Process_TargetAlias();
2918
 
3164
 
2919
    #
3165
    #
2920
    #   Calculate NATIVE alaias
3166
    #   Calculate NATIVE and INSTRUMENT alias
2921
    #   Limit the Native Alias to active platforms
3167
    #       Limit the Aliases to active platforms
2922
    #
3168
    #
2923
    if (exists $BUILDALIAS{NATIVE})
3169
    foreach my $alias (qw( NATIVE INSTRUMENT))
2924
    {
3170
    {
2925
        Warning('User has manually specified a NATIVE alias','Default alias will not be set.');
-
 
2926
    }
-
 
2927
    else
-
 
2928
    {
-
 
2929
        my %activePatformMap = map {$_ => 1} @BUILD_ACTIVEPLATFORMS;
-
 
2930
        my @activeNatives;
3171
        if (exists $BUILDALIAS{$alias})
2931
        foreach my $item (PlatformConfig::getNativeTargets())
-
 
2932
        {
3172
        {
-
 
3173
            Warning("User has manually specified a $alias alias",'Default alias will not be set.');
-
 
3174
        }
-
 
3175
        else
-
 
3176
        {
-
 
3177
            my %activePlatformMap = map {$_ => 1} @BUILD_ACTIVEPLATFORMS;
-
 
3178
            my @activeAliases;
-
 
3179
            foreach my $item (PlatformConfig::getTargetsByTag($alias))
-
 
3180
            {
2933
            push (@activeNatives, $item) if exists($activePatformMap{$item});
3181
                push (@activeAliases, $item) if exists($activePlatformMap{$item});
-
 
3182
            }
-
 
3183
            
-
 
3184
            $BUILDALIAS{$alias} = join(' ', @activeAliases) if (@activeAliases);
-
 
3185
 
-
 
3186
            #
-
 
3187
            #   Add to the build entry too
-
 
3188
            #
-
 
3189
            foreach my $aliasTarget (@activeAliases)
-
 
3190
            {
-
 
3191
                push @{$BUILDINFO{$aliasTarget}{USERALIAS}}, $alias;
-
 
3192
            }
2934
        }
3193
        }
2935
        
-
 
2936
        $BUILDALIAS{NATIVE} = join(' ', @activeNatives);
-
 
2937
    }
3194
    }
-
 
3195
    
-
 
3196
    CleanUp_Aliases();
2938
 
3197
 
2939
    #
3198
    #
2940
    #   Create dummy package to describe the Interface directory
3199
    #   Create dummy package to describe the Interface directory
2941
    #
3200
    #
2942
    CreateInterfacePackage();
3201
    CreateInterfacePackage();
2943
 
3202
 
2944
    #
3203
    #
2945
    #   Sanity test the users packages
3204
    #   Sanity test the users packages
-
 
3205
    #       In a sandbox all bet are off
2946
    #
3206
    #
2947
    PackageEntry::SanityTest() unless $Clobber;
3207
    PackageEntry::SanityTest() unless ($Clobber || $::GBE_SANDBOX);
2948
 
3208
 
2949
    #
3209
    #
2950
    #   Validate the $Srcdir before its first real use
3210
    #   Validate the $Srcdir before its first real use
2951
    #   This is calculated from the user directives
3211
    #   This is calculated from the user directives
2952
    #
3212
    #
Line 2984... Line 3244...
2984
#-------------------------------------------------------------------------------
3244
#-------------------------------------------------------------------------------
2985
# Function        : TestForForcedBuild
3245
# Function        : TestForForcedBuild
2986
#
3246
#
2987
# Description     : If a non-forced build has been requested, then see
3247
# Description     : If a non-forced build has been requested, then see
2988
#                   if a build is required ( ie: build.pl modified )
3248
#                   if a build is required ( ie: build.pl modified )
2989
#
3249
#                   
-
 
3250
#                   Check:
-
 
3251
#                       Time stamp of build.pl
-
 
3252
#                       Time stamp of Makefile.gbe
-
 
3253
#                       BuildFilter has not changed
-
 
3254
#                       Signature of dependencies has not changed
-
 
3255
#                       No packages consumed from within the sandbox
2990
#
3256
#
2991
# Inputs          : None
3257
# Inputs          : None
2992
#
3258
#
2993
# Returns         : May not return
3259
# Returns         : May not return
-
 
3260
#                   Will return if we need to perform a build
2994
#
3261
#
2995
sub TestForForcedBuild
3262
sub TestForForcedBuild
2996
{
3263
{
2997
    #
3264
    #
2998
    #   Always return if in clobber mode
3265
    #   Always return if in clobber mode
Line 3011... Line 3278...
3011
        #
3278
        #
3012
        #   Ensure that the build filter has not changed
3279
        #   Ensure that the build filter has not changed
3013
        #   If the user has changed the buildfilter, then we need to
3280
        #   If the user has changed the buildfilter, then we need to
3014
        #   force a build.
3281
        #   force a build.
3015
        #
3282
        #
3016
        #   The root Makefile.bge will have a $ScmBuildFilter entry
3283
        #   The root Makefile.gbe will have a $ScmBuildFilter entry
3017
        #
3284
        #
3018
        unless ( @build_warn )
3285
        unless ( @build_warn )
3019
        {
3286
        {
3020
            use JatsMakeInfo;
3287
            use JatsMakeInfo;
3021
            ReadMakeInfo();
3288
            ReadMakeInfo();
Line 3029... Line 3296...
3029
                push @build_warn, "Build filter has changed";
3296
                push @build_warn, "Build filter has changed";
3030
                Verbose2 ("Buildfilter Test: Was:$line, Is:$::GBE_BUILDFILTER");
3297
                Verbose2 ("Buildfilter Test: Was:$line, Is:$::GBE_BUILDFILTER");
3031
            }
3298
            }
3032
        }
3299
        }
3033
 
3300
 
-
 
3301
        #
-
 
3302
        #   If any of the imported packages are from a sandbox, then we must force a build
-
 
3303
        #   and a make.
-
 
3304
        #
-
 
3305
        if ($pkgFromSandbox)
-
 
3306
        {
-
 
3307
            push @build_warn, "Consuming packages from within the sandbox";
-
 
3308
        }
-
 
3309
        
3034
        if ( @build_warn )
3310
        if ( @build_warn )
3035
        {
3311
        {
3036
            Verbose ("Forcing Build.", @build_warn );
3312
            Verbose ("Forcing Build.", @build_warn );
3037
        }
3313
        }
3038
        else
3314
        else
Line 3133... Line 3409...
3133
    }
3409
    }
3134
 
3410
 
3135
    my $link_dir = "$target_archive/$BUILDNAME_PACKAGE";
3411
    my $link_dir = "$target_archive/$BUILDNAME_PACKAGE";
3136
    my $link_path = "$link_dir/$link_file";
3412
    my $link_path = "$link_dir/$link_file";
3137
 
3413
 
3138
    if ( $Clobber )
3414
    if ( $Clobber || $NoBuild )
3139
    {
3415
    {
3140
        unlink $link_path;          # Delete the link
3416
        unlink $link_path;          # Delete the link
3141
        rmdir $link_dir;            # Delete only if empty
3417
        rmdir $link_dir;            # Delete only if empty
3142
    }
3418
    }
3143
    else
3419
    else
Line 3153... Line 3429...
3153
#
3429
#
3154
# Description     : Create data structures to allow this package to be built
3430
# Description     : Create data structures to allow this package to be built
3155
#                   within a multi-package sandbox.
3431
#                   within a multi-package sandbox.
3156
#
3432
#
3157
#                   This will allow multiple components to work together
3433
#                   This will allow multiple components to work together
-
 
3434
#                   Creates:
-
 
3435
#                       sandbox.int     - Rel path to the packages interface
-
 
3436
#                       sandbox.ffp     - Fast FingerPrint over the package body
-
 
3437
#                       sandbox.nob     - No Build marker
3158
#
3438
#
3159
#                   Note: When called in Clobber-mode the link will be deleted
3439
#                   Note: When called in Clobber-mode the link will be deleted
3160
#
3440
#
3161
# Inputs          : $BUILDNAME              - The package name
3441
# Inputs          : $BUILDNAME              - The package name
3162
#                   $BUILDNAME_PROJECT      - Project extension
3442
#                   $BUILDNAME_PROJECT      - Project extension
Line 3183... Line 3463...
3183
    #   information as this will not be correct
3463
    #   information as this will not be correct
3184
    #
3464
    #
3185
    #   PACKAGE/sandbox.PRJ.cfg
3465
    #   PACKAGE/sandbox.PRJ.cfg
3186
    #
3466
    #
3187
    my $link_dir = "$sandbox_dpkg_archive/$BUILDNAME_PACKAGE";
3467
    my $link_dir = "$sandbox_dpkg_archive/$BUILDNAME_PACKAGE";
3188
    my $link_file;
3468
    my $base = 'sandbox' . ${BUILDNAME_SUFFIX}; 
3189
 
3469
 
3190
    if ( $sandbox_exact )
3470
    my $nob_path  = $base . ".nob";
3191
    {
-
 
3192
        $link_file = "$BUILDVERSION.cfg";
3471
    my $ffp_path  = $base . ".ffp";
3193
    }
-
 
3194
    else
3472
    my $int_path  = $base . ".int";
3195
    {
3473
 
3196
        $link_file  = 'sandbox' . ${BUILDNAME_SUFFIX} . '.cfg';
3474
    $nob_path = "$link_dir/$nob_path";
3197
    }
3475
    $ffp_path = "$link_dir/$ffp_path";
3198
    my $link_path = "$link_dir/$link_file";
3476
    $int_path = "$link_dir/$int_path";
3199
 
3477
 
3200
    if ( $Clobber )
3478
    if ( $Clobber )
3201
    {
3479
    {
3202
        unlink $link_path;          # Delete the link
-
 
3203
        rmdir $link_dir;            # Delete only if empty
3480
        rmdir $link_dir;            # Delete only if empty
3204
    }
3481
    }
3205
    else
3482
    else
3206
    {
3483
    {
3207
        Log( "Sandbox cfg. $link_file");
3484
        ToolsetFiles::AddFile($nob_path);
3208
        unlink $link_path;
3485
        ToolsetFiles::AddFile($ffp_path);
3209
        mkdir $link_dir;
3486
        ToolsetFiles::AddFile($int_path);
3210
 
3487
 
3211
        #
-
 
3212
        #   Create the sandbox config data structure
3488
        #Log( "Sandbox Data. $base");
3213
        #
-
 
3214
        my %sandbox_info = (
3489
        unlink $int_path;
3215
            BUILDDIR     => $Cwd,
-
 
3216
            INTERFACEDIR => $BUILDINTERFACE,
-
 
3217
            );
3490
        mkdir $link_dir;
3218
 
3491
 
3219
        #
3492
        #
-
 
3493
        #   File with path to the interface directory
3220
        #   Write out the Parsed Config File with new information
3494
        #   Relative to the base of the sandbox
3221
        #
3495
        #
3222
        my $fh = ConfigurationFile::New( $link_path );
-
 
3223
        $fh->Header( "buildlib (version $::BuildVersion)",
3496
        FileCreate($int_path, catdir('GBE_SANDBOX',RelPath($Cwd,$::GBE_SANDBOX),$BUILDINTERFACE ));
3224
                                  "Sandbox configuration" );
-
 
3225
 
3497
 
3226
        #
3498
        #
3227
        #   Dump out the configuration information
3499
        #   Indicate packages not build on this machine
3228
        #
3500
        #
3229
        $fh->Dump( [\%sandbox_info], [qw(*sandbox_info)] );
3501
        unlink $nob_path;           # Delete the NoBuild marker
3230
        $fh->Close();
3502
        if ($NoBuild) {
-
 
3503
            TouchFile($nob_path);
-
 
3504
        }
3231
    }
3505
    }
3232
}
3506
}
3233
 
3507
 
3234
 
3508
 
3235
#-------------------------------------------------------------------------------
3509
#-------------------------------------------------------------------------------
Line 3254... Line 3528...
3254
    #   Must have a valid $BUILDINTERFACE
3528
    #   Must have a valid $BUILDINTERFACE
3255
    #   Normally this is held in the interface directory, but this is not
3529
    #   Normally this is held in the interface directory, but this is not
3256
    #   always created. If there is no $BUILDINTERFACE, then use the
3530
    #   always created. If there is no $BUILDINTERFACE, then use the
3257
    #   build directory
3531
    #   build directory
3258
    #
3532
    #
3259
    $BUILDINTERFACE = "." unless ( $BUILDINTERFACE );
3533
    BuildInterfaceInternal($::ScmInterface) unless ( $BUILDINTERFACE );
-
 
3534
 
3260
 
3535
 
3261
    #.. Starting the build phase. No more data collection
3536
    #.. Starting the build phase. No more data collection
3262
    #
3537
    #
3263
    StartBuildPhase();
3538
    StartBuildPhase();
3264
    LastBuildDirective();
3539
    LastBuildDirective();
Line 3284... Line 3559...
3284
    }
3559
    }
3285
 
3560
 
3286
    if ( $Clobber )                             # clobber mode ?
3561
    if ( $Clobber )                             # clobber mode ?
3287
    {
3562
    {
3288
        #
3563
        #
3289
        #   Read in toolset files - a list of files collected during
-
 
3290
        #   previous builds
-
 
3291
        #
-
 
3292
        ToolsetFile();
-
 
3293
 
-
 
3294
        #
-
 
3295
        #   Unmake all the makefiles
3564
        #   Unmake all the makefiles
3296
        #   No longer needed as we track the file that are created
3565
        #   No longer needed as we track the file that are created
3297
        #
3566
        #
3298
        #if ( -e "Makefile.gbe" )
3567
        #if ( -e "Makefile.gbe" )
3299
        #{
3568
        #{
Line 3316... Line 3585...
3316
        #
3585
        #
3317
        push @CLOBBERDIRS, "build/deploy";
3586
        push @CLOBBERDIRS, "build/deploy";
3318
        push @REMOVEDIRS, "build";
3587
        push @REMOVEDIRS, "build";
3319
 
3588
 
3320
        #
3589
        #
-
 
3590
        #   List of files maintained by the build system
-
 
3591
        #
-
 
3592
        my @toolsetFiles = ToolsetFiles::GetFiles();
-
 
3593
 
-
 
3594
        #
3321
        #   Delete interface directories and other directories that have been
3595
        #   Delete interface directories and other directories that have been
3322
        #   marked to be clobbered
3596
        #   marked to be clobbered
3323
        #
3597
        #
3324
        foreach my $dir ( @CLOBBERDIRS )
3598
        foreach my $dir ( @CLOBBERDIRS )
3325
        {
3599
        {
Line 3339... Line 3613...
3339
            {
3613
            {
3340
                rmdir ( $dir ); # Only if empty
3614
                rmdir ( $dir ); # Only if empty
3341
            }
3615
            }
3342
        }
3616
        }
3343
 
3617
 
3344
        if ( exists $::GBE_TOOLSETFiles{Files} )
3618
        foreach my $file (@toolsetFiles)
3345
        {
3619
        {
3346
            foreach my $file (keys %{$::GBE_TOOLSETFiles{Files}})
-
 
3347
            {
-
 
3348
                if ( -f $file )
3620
            RmDirTree ( $file ) if ( -f $file );
3349
                {
-
 
3350
                    RmDirTree ( $file );
-
 
3351
                }
-
 
3352
            }
-
 
3353
        }
3621
        }
3354
        
3622
        
3355
        #
3623
        #
3356
        #   DPACKAGE may be a user file, Only delete it if we created it
3624
        #   DPACKAGE may be a user file, Only delete it if we created it
3357
        #
3625
        #
Line 3416... Line 3684...
3416
    my @cmds = ('jmake.pl', 'rebuild');
3684
    my @cmds = ('jmake.pl', 'rebuild');
3417
    push @cmds, 'NORECURSE=1' if ( $RootOnly );
3685
    push @cmds, 'NORECURSE=1' if ( $RootOnly );
3418
    JatsTool ( @cmds);
3686
    JatsTool ( @cmds);
3419
 
3687
 
3420
    #
3688
    #
-
 
3689
    ErrorConfig( 'name' => 'buildlib')   ;
3421
    #   Generate some warnings that will be seen at the end of the build
3690
    #   Generate some warnings that will be seen at the end of the build
3422
    #
3691
    #
3423
    Warning ("BuildSrcArchive Directive Present","Read JATS Manual for correct usage")
3692
    Warning ("BuildSrcArchive Directive Present","Read JATS Manual for correct usage")
3424
        if ($build_source_pkg);
3693
        if ($build_source_pkg);
3425
}
3694
}
Line 3612... Line 3881...
3612
# Description     : Maintain the nobuild marker
3881
# Description     : Maintain the nobuild marker
3613
#                   This is file placed in the interface directory simply
3882
#                   This is file placed in the interface directory simply
3614
#                   to indicate to the 'create_dpkg' utility that this build
3883
#                   to indicate to the 'create_dpkg' utility that this build
3615
#                   does not do anything useful.
3884
#                   does not do anything useful.
3616
#
3885
#
3617
#                   It will only be used on a build machine by the buid daemon
3886
#                   It will only be used on a build machine by the build daemon
3618
#
3887
#
3619
#                   Its not placed in the interface directory as it would be
3888
#                   Its not placed in the interface directory as it would be
3620
#                   harder for create_dpkg to find it.
3889
#                   harder for create_dpkg to find it.
3621
#
3890
#
3622
# Inputs          : None
3891
# Inputs          : None
Line 4215... Line 4484...
4215
    $path .= '/'. $file;
4484
    $path .= '/'. $file;
4216
    $path =~ tr~/~/~s;
4485
    $path =~ tr~/~/~s;
4217
    $BUILD_KNOWNFILES {$file} = $path
4486
    $BUILD_KNOWNFILES {$file} = $path
4218
        unless ( defined($noadd) && $noadd);
4487
        unless ( defined($noadd) && $noadd);
4219
 
4488
 
4220
    ToolsetFile( $path )
4489
    ToolsetFiles::AddFile( $path )
4221
        unless ($Clobber);
4490
        unless ($Clobber);
4222
 
4491
 
4223
    return $path;
4492
    return $path;
4224
}
4493
}
4225
 
4494
 
Line 4463... Line 4732...
4463
    -help          - Display terse usage
4732
    -help          - Display terse usage
4464
    -help -help    - Display verbose usage
4733
    -help -help    - Display verbose usage
4465
    -man           - Display internal manual
4734
    -man           - Display internal manual
4466
    -verbose[=n]   - Set level of progress verbosity
4735
    -verbose[=n]   - Set level of progress verbosity
4467
    -debug[=n]     - Set the debug level
4736
    -debug[=n]     - Set the debug level
4468
    -nolog         - Do not generate/update Changelog
-
 
4469
    -cache         - Cache packages in the local dpkg_package cache
4737
    -cache         - Cache packages in the local dpkg_package cache
4470
    -cache -cache  - Forced refresh dependent packages in the local cache
4738
    -cache -cache  - Forced refresh dependent packages in the local cache
4471
    -package       - Ignore packages that are not available and continue
4739
    -package       - Ignore packages that are not available and continue
4472
    -nopackages    - Ignore package processing directives
4740
    -nopackages    - Ignore package processing directives
4473
    -forcebuildpkg - Treat LinkPkgArchive directives as BuildPkgArchive
4741
    -forcebuildpkg - Treat LinkPkgArchive directives as BuildPkgArchive
Line 4481... Line 4749...
4481
 Sticky settings:
4749
 Sticky settings:
4482
    -all           - Build for all platforms ignoring GBE_BUILDFILTER
4750
    -all           - Build for all platforms ignoring GBE_BUILDFILTER
4483
    -expert[=n]    - Relaxing dependency checks on the user makefiles
4751
    -expert[=n]    - Relaxing dependency checks on the user makefiles
4484
 
4752
 
4485
 Commands:
4753
 Commands:
4486
    changelog      - Only update ChangeLog.
-
 
4487
    clobber        - Remove generated build system (eg Makefiles).
4754
    clobber        - Remove generated build system (eg Makefiles).
4488
    interface      - Only (re)build the interface tree, including ChangeLog.
4755
    interface      - Only (re)build the interface tree.
4489
    rootonly       - Only (re)build the root directory.
4756
    rootonly       - Only (re)build the root directory.
4490
 
4757
 
4491
=head1 OPTIONS
4758
=head1 OPTIONS
4492
 
4759
 
4493
=over 8
4760
=over 8
Line 4517... Line 4784...
4517
progress information.
4784
progress information.
4518
 
4785
 
4519
If an argument is provided, then it will be used to set the level, otherwise the
4786
If an argument is provided, then it will be used to set the level, otherwise the
4520
existing level will be incremented. This option may be specified multiple times.
4787
existing level will be incremented. This option may be specified multiple times.
4521
 
4788
 
4522
=item B<-nolog>
-
 
4523
 
-
 
4524
Do not generate or update the ChangeLog maintained when a CVS directory is detected
-
 
4525
in the build directory.
-
 
4526
 
-
 
4527
=item B<-cache>
4789
=item B<-cache>
4528
 
4790
 
4529
This option will cause dependent packages to be cached in the local
4791
This option will cause dependent packages to be cached in the local
4530
dpkg_archive cache.
4792
dpkg_archive cache.
4531
 
4793
 
Line 4616... Line 4878...
4616
are rebuilt. It will only be lost when the next 'jats build' is performed.
4878
are rebuilt. It will only be lost when the next 'jats build' is performed.
4617
 
4879
 
4618
The effect of the option can be changed when the makefiles are processed. This
4880
The effect of the option can be changed when the makefiles are processed. This
4619
option simply sets the default' mode of operation.
4881
option simply sets the default' mode of operation.
4620
 
4882
 
4621
=item B<changelog>
-
 
4622
 
-
 
4623
This command will only update the CVS change log.
-
 
4624
 
-
 
4625
=item B<interface>
4883
=item B<interface>
4626
 
4884
 
4627
This command will only build, or rebuild, the 'interface' directory and the
4885
This command will only build, or rebuild, the 'interface' directory.
4628
changelog ( if required ).
-
 
4629
 
4886
 
4630
This command will not build, or rebuild, the root directory. The build
4887
This command will not build, or rebuild, the root directory. The build
4631
process will not recurse through the subdirectories creating makefiles.
4888
process will not recurse through the subdirectories creating makefiles.
4632
 
4889
 
4633
=item B<rootonly>
4890
=item B<rootonly>
4634
 
4891
 
4635
This command will only build, or rebuild, the 'interface' directory, the
4892
This command will only build, or rebuild, the 'interface' directory and 
4636
changelog (if required) and the root-level makefiles.
4893
the root-level makefiles.
4637
 
4894
 
4638
The build process will not recurse through the subdirectories creating
4895
The build process will not recurse through the subdirectories creating
4639
makefiles. These can be made on-demand by jats if a 'make' command is issued.
4896
makefiles. These can be made on-demand by jats if a 'make' command is issued.
4640
 
4897
 
4641
=item B<clobber>
4898
=item B<clobber>