Subversion Repositories DevTools

Rev

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

Rev 257 Rev 261
Line 17... Line 17...
17
#       makefile generation sessions.
17
#       makefile generation sessions.
18
#
18
#
19
#.........................................................................
19
#.........................................................................
20
#
20
#
21
 
21
 
22
require 5.006_001;
-
 
23
use strict;
22
use strict;
24
use warnings;
23
use warnings;
25
 
24
 
26
use BuildVersion;
25
use BuildVersion;
27
use BuildName;
26
use BuildName;
Line 29... Line 28...
29
use JatsEnv;
28
use JatsEnv;
30
use JatsSystem;
29
use JatsSystem;
31
use JatsVersionUtils;
30
use JatsVersionUtils;
32
use FileUtils;
31
use FileUtils;
33
use Pod::Usage;
32
use Pod::Usage;
-
 
33
use Getopt::Long;
34
 
34
 
35
our $BuildVersion           = "2.1.0";
35
our $BuildVersion           = "2.1.0";
36
 
36
 
37
#.. Switchs
37
#.. Switchs
38
#
38
#
Line 48... Line 48...
48
our $Perms                  = 0;
48
our $Perms                  = 0;
49
our $Expert                 = 0;
49
our $Expert                 = 0;
50
our $All                    = 0;
50
our $All                    = 0;
51
our $Nolog                  = 0;
51
our $Nolog                  = 0;
52
our $Cache                  = 0;
52
our $Cache                  = 0;
53
our $Project                = 0;
-
 
54
our $FullJats               = 0;
53
our $FullJats               = 0;
55
our $PackageError           = 1;
54
our $NoPackageError         = 0;
56
our $ForceBuildPkg          = 0;
55
our $ForceBuildPkg          = 0;
57
our $Srcdir                 = "";               # default source root
56
our $Srcdir                 = "";               # default source root
58
 
57
 
59
#.. Public symbols, referenced by many build.pl implementations
58
#.. Public symbols, referenced by many build.pl implementations
60
#
59
#
Line 99... Line 98...
99
 
98
 
100
BuildLibInit();
99
BuildLibInit();
101
 
100
 
102
sub BuildLibInit
101
sub BuildLibInit
103
{
102
{
104
    my ( $argc );                               # argument count
-
 
105
 
103
 
106
#.. Set environment
104
#.. Set environment
107
#
105
#
108
    EnvImport( "GBE_VERSION" );
106
    EnvImport( "GBE_VERSION" );
109
    EnvImport( "GBE_BIN" );
107
    EnvImport( "GBE_BIN" );
Line 141... Line 139...
141
    Debug( "Host:      $ScmHost" );
139
    Debug( "Host:      $ScmHost" );
142
    Debug( "Cwd:       $Cwd" );
140
    Debug( "Cwd:       $Cwd" );
143
    Debug( "Makelib:   $Makelib" );
141
    Debug( "Makelib:   $Makelib" );
144
    Debug( "BuildFile: $ScmBuildSrc" );
142
    Debug( "BuildFile: $ScmBuildSrc" );
145
 
143
 
146
    $argc = 2;
-
 
147
    while ($_ = $ARGV[ $argc ])
-
 
148
    {
-
 
149
        last if ( ! /^-/ );                     # end of options
-
 
150
 
-
 
151
        $argc++;
-
 
152
        Debug( "option:    $_" );
144
    Verbose ("Command Line: @ARGV");
153
 
-
 
154
        if ( /^-h$|^-help$|^--help$|^--usage$|^-?$/ ) {
-
 
155
            $opt_help++;
145
    my $result = GetOptions (
156
            next;
-
 
157
 
-
 
158
        } elsif ( /^-man$|^--man$/ ) {
-
 
159
            $opt_help = 3;
146
                "help|h|usage+" => \$opt_help,
160
            next;
-
 
161
        }
-
 
162
                                                # long arguments
147
                "man"           => sub{ $opt_help = 3},
163
        next if (/^--debug/ && ($::ScmDebug = 1));
148
                "debug:+"       => \$::ScmDebug,
164
        next if (/^--verbose/ && ($::ScmVerbose = 1));
149
                "verbose:+"     => \$::ScmVerbose,
165
 
-
 
166
        if (/^--expert(.*)/) {
-
 
167
            if ($1) {
-
 
168
                $Expert = $1;
-
 
169
            } else {
-
 
170
                $Expert = 1;
-
 
171
            }
-
 
172
            Debug( "Expert:    $Expert" );
150
                "expert:1"      => \$Expert,
173
            next;
-
 
174
        }
-
 
175
 
-
 
176
        if (/^--all/) {
-
 
177
            $All = 1;
-
 
178
            Debug( "All:       $All" );
151
                "all"           => \$All,
179
            next;
-
 
180
        }
-
 
181
 
-
 
182
        if (/^--nolog/) {
-
 
183
            $Nolog = 1;
-
 
184
            Debug( "Nolog:     $Nolog" );
152
                "nolog"         => \$Nolog,
185
            next;
-
 
186
        }
-
 
187
 
-
 
188
        if (/^--cache/) {
-
 
189
            $Cache++;
-
 
190
            Debug( "Cache:     $Cache" );
153
                "cache+"        => \$Cache,
191
            next;
-
 
192
        }
-
 
193
 
-
 
194
        if (/^--project/) {
-
 
195
            $FullJats = 1;
-
 
196
            $Project = eval "require Data::Dumper";
-
 
197
            Debug( "Project:   $Project" );
154
                "project"       => \$FullJats,
198
            next;
-
 
199
        }
-
 
200
 
-
 
201
        if (/^--package/) {
-
 
202
            $PackageError = 0;
-
 
203
            Debug( "Package:   $PackageError" );
155
                "package"       => \$NoPackageError,
204
            next;
-
 
205
        }
-
 
206
 
-
 
207
        if (/^--forcebuildpkg/i) {
-
 
208
            $ForceBuildPkg = 1;
-
 
209
            Debug( "ForcePkg:   $ForceBuildPkg" );
156
                "forcebuildpkg" => \$ForceBuildPkg,
210
            next;
157
                );
211
        }
-
 
212
        
-
 
213
        last if (/^--$/);                       # end of arguments
158
    Usage() if ( $opt_help || !$result );
214
 
159
 
215
        if (/^-D(.*)/) {
-
 
216
            if ($1) {
-
 
217
                $::ScmDebug = $1;
160
    Debug( "Debug:          $::ScmDebug" );
218
            } else {
161
    Debug( "Verbose:        $::ScmVerbose" );
219
                $::ScmDebug = 1;
162
    Debug( "Expert:        $Expert" );
220
            }
163
    Debug( "All:           $All" );
221
            Debug( "ScmDebug:  $::ScmDebug" );
164
    Debug( "Nolog:         $Nolog" );
222
            next;
165
    Debug( "Cache:         $Cache" );
223
        }
-
 
224
 
-
 
225
        next if (/^-V/ && ($::ScmVerbose = 1));
166
    Debug( "project:       $FullJats" );
226
 
-
 
227
        if (/^-.*/) {                           # unknown option
-
 
228
            Usage( "(E) unknown option \"$_\"" );
167
    Debug( "package:       $NoPackageError" );
229
        }
-
 
230
 
-
 
231
        last;
-
 
232
    }
-
 
233
    Usage() if ( $opt_help );
168
    Debug( "Force  :       $ForceBuildPkg" );
234
 
169
 
235
#.. Command
170
#.. Command
236
#
171
#
-
 
172
    my $argc = 2;
237
    $CmdSwitch = $ARGV[ $argc++ ] if ($argc <= $#ARGV);
173
    $CmdSwitch = $ARGV[ $argc++ ] if ($argc <= $#ARGV);
238
    $CmdParm = $ARGV[ $argc++ ] if ($argc <= $#ARGV);
174
    $CmdParm = $ARGV[ $argc++ ] if ($argc <= $#ARGV);
239
 
175
 
240
    Debug( "CmdSwitch: $CmdSwitch" );
176
    Debug( "CmdSwitch: $CmdSwitch" );
241
    Debug( "CmdParm:   $CmdParm" );
177
    Debug( "CmdParm:   $CmdParm" );
Line 294... Line 230...
294
#
230
#
295
sub Log
231
sub Log
296
{
232
{
297
    if ( ! $Clobber )
233
    if ( ! $Clobber )
298
    {
234
    {
299
        open( BUILDLOG, ">>build.log" ) || Error( "Cannot append to 'build.log'" );
-
 
300
        print BUILDLOG @_;
-
 
301
        print @_;
235
        print "@_\n";
302
        close( BUILDLOG );
236
        FileAppend ('build.log', \@_ );
303
    }
237
    }
304
}
238
}
305
 
239
 
306
#-------------------------------------------------------------------------------
240
#-------------------------------------------------------------------------------
307
# Function        : BuildSubDir
241
# Function        : BuildSubDir
Line 1225... Line 1159...
1225
    }
1159
    }
1226
 
1160
 
1227
 
1161
 
1228
#.. Create build.log summary information
1162
#.. Create build.log summary information
1229
#
1163
#
1230
    my ($sep) = "\n".(" "x11).". ";
1164
    my ($sep) = "\n".(" " x 11) . ". ";
1231
 
1165
 
1232
    Log( "\nBuild configuration (version $::GBE_VERSION)\n" );
1166
    Log( "\nBuild configuration (version $::GBE_VERSION)" );
1233
    Log( "Name ....... $BUILDNAME ($ScmHost)\n" );
1167
    Log( "Name ....... $BUILDNAME ($ScmHost)" );
1234
    Log( "Version .... $BUILDNAME_VERSION\n" );
1168
    Log( "Version .... $BUILDNAME_VERSION" );
1235
    Log( "DeployPatch. $DEPLOY_PATCH\n" ) if ($DEPLOY_PATCH);
1169
    Log( "DeployPatch. $DEPLOY_PATCH" ) if ($DEPLOY_PATCH);
1236
    Log( "Project .... $BUILDNAME_PROJECT\n" )if ($BUILDNAME_PROJECT);
1170
    Log( "Project .... $BUILDNAME_PROJECT" )if ($BUILDNAME_PROJECT);
1237
    Log( "Project .... ****** Specifically supressed ******\n" )unless ($BUILDNAME_PROJECT);
1171
    Log( "Project .... ****** Specifically supressed ******" )unless ($BUILDNAME_PROJECT);
1238
    Log( "DateTime ... $::CurrentTime\n" );
1172
    Log( "DateTime ... $::CurrentTime" );
1239
    Log( "AutoBuild... Enabled:$::GBE_ABT\n" ) if defined($::GBE_ABT) ;
1173
    Log( "AutoBuild... Enabled:$::GBE_ABT" ) if defined($::GBE_ABT) ;
1240
    Log( "Build dir... $Cwd\n" ) if defined($::GBE_ABT) ;
1174
    Log( "Build dir... $Cwd" ) if defined($::GBE_ABT) ;
1241
 
1175
 
1242
    Log( "BIN  ....... $::GBE_BIN\n" );
1176
    Log( "BIN  ....... $::GBE_BIN" );
1243
    Log( "PERL ....... $::GBE_PERL\n" );
1177
    Log( "PERL ....... $::GBE_PERL" );
1244
    Log( "TOOLS ...... $::GBE_TOOLS\n" );
1178
    Log( "TOOLS ...... $::GBE_TOOLS" );
1245
    Log( "CONFIG ..... $::GBE_CONFIG\n" );
1179
    Log( "CONFIG ..... $::GBE_CONFIG" );
1246
    Log( "MACHTYPE ... $::GBE_MACHTYPE\n" );
1180
    Log( "MACHTYPE ... $::GBE_MACHTYPE" );
1247
 
1181
 
1248
    Log( "PLATFORM ... " . PrintList([split(' ', $::GBE_PLATFORM)], $sep) . "\n")    if defined ($::GBE_PLATFORM);
1182
    Log( "PLATFORM ... " . PrintList([split(' ', $::GBE_PLATFORM)], $sep) )    if defined ($::GBE_PLATFORM);
1249
    Log( "BUILDFILTER. " . PrintList([split(' ', $::GBE_BUILDFILTER)], $sep) . "\n") if defined ($::GBE_BUILDFILTER);
1183
    Log( "BUILDFILTER. " . PrintList([split(' ', $::GBE_BUILDFILTER)], $sep) ) if defined ($::GBE_BUILDFILTER);
1250
 
1184
 
1251
    Log( "DPKG_STORE.. $::GBE_DPKG_STORE\n" );
1185
    Log( "DPKG_STORE.. $::GBE_DPKG_STORE" );
1252
    Log( "DPKG ....... $::GBE_DPKG\n" );
1186
    Log( "DPKG ....... $::GBE_DPKG" );
1253
    Log( "DPKG_CACHE . $::GBE_DPKG_CACHE\n" );
1187
    Log( "DPKG_CACHE . $::GBE_DPKG_CACHE" );
1254
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL\n" );
1188
    Log( "DPKG_LOCAL . $::GBE_DPKG_LOCAL" );
1255
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX\n" );
1189
    Log( "DPKG_SBOX .. $::GBE_DPKG_SBOX" );
1256
 
1190
 
1257
    Log( "Platforms .. ", PrintPlatforms(\@BUILDPLATFORMS, $sep)."\n");
1191
    Log( "Platforms .. " . PrintPlatforms(\@BUILDPLATFORMS, $sep) );
1258
 
1192
 
1259
    #
1193
    #
1260
    #   Generate a list of platforms that are completely unknown to JATS
1194
    #   Generate a list of platforms that are completely unknown to JATS
1261
    #   May be the result of a user type or a guess
1195
    #   May be the result of a user type or a guess
1262
    #
1196
    #
1263
    if ( @BUILD_BADNAME )
1197
    if ( @BUILD_BADNAME )
1264
    {
1198
    {
1265
        Log( "Uknown Pla . ". PrintPlatforms(\@BUILD_BADNAME, $sep)."\n");
1199
        Log( "Unknown Pla . " . PrintPlatforms(\@BUILD_BADNAME, $sep) );
1266
         Warning ("The following platform names are not known to JATS", "@BUILD_BADNAME");
1200
         Warning ("The following platform names are not known to JATS", "@BUILD_BADNAME");
1267
    }
1201
    }
1268
    
1202
    
1269
    #
1203
    #
1270
    #   Generate a list of active platforms
1204
    #   Generate a list of active platforms
1271
    #   Ensure that there are some active platforms
1205
    #   Ensure that there are some active platforms
1272
    #
1206
    #
1273
    GeneratePlatformList();
1207
    GeneratePlatformList();
1274
    Error( "GBE_BUILDFILTER prevents any targets being built" )
1208
    Error( "GBE_BUILDFILTER prevents any targets being built" )
1275
        unless( @BUILD_ACTIVEPLATFORMS );
1209
        unless( @BUILD_ACTIVEPLATFORMS );
1276
    Log( "Build for .. ". PrintPlatforms(\@BUILD_ACTIVEPLATFORMS, $sep)."\n");
1210
    Log( "Build for .. ". PrintPlatforms(\@BUILD_ACTIVEPLATFORMS, $sep));
1277
 
1211
 
1278
    #
1212
    #
1279
    #   Generate an error if nothing can be done because the GBE_PLATFORM
1213
    #   Generate an error if nothing can be done because the GBE_PLATFORM
1280
    #   masks any useful operation.
1214
    #   masks any useful operation.
1281
    #
1215
    #
Line 1299... Line 1233...
1299
            }
1233
            }
1300
 
1234
 
1301
            Error ("The GBE_PLATFORM filter prevents any targets being made",
1235
            Error ("The GBE_PLATFORM filter prevents any targets being made",
1302
                   "GBE_PLATFORM: $::GBE_PLATFORM" ) unless ( @MAKE_PLATFORMS );
1236
                   "GBE_PLATFORM: $::GBE_PLATFORM" ) unless ( @MAKE_PLATFORMS );
1303
 
1237
 
1304
            Log( "Make for ... ". PrintPlatforms(\@MAKE_PLATFORMS, $sep)."\n");
1238
            Log( "Make for ... ". PrintPlatforms(\@MAKE_PLATFORMS, $sep));
1305
        }
1239
        }
1306
 
1240
 
1307
    }
1241
    }
1308
 
1242
 
1309
    return 1;
1243
    return 1;
Line 1313... Line 1247...
1313
sub BuildPreviousVersion
1247
sub BuildPreviousVersion
1314
{
1248
{
1315
    my( $version ) = shift;
1249
    my( $version ) = shift;
1316
 
1250
 
1317
    $BUILDPREVIOUSVERSION = $version;
1251
    $BUILDPREVIOUSVERSION = $version;
1318
    Log( "Previous Version ... $BUILDPREVIOUSVERSION\n" );
1252
    Log( "Previous Version ... $BUILDPREVIOUSVERSION" );
1319
 
1253
 
1320
    return 1;
1254
    return 1;
1321
}
1255
}
1322
 
1256
 
1323
 
1257
 
Line 1365... Line 1299...
1365
        $::ScmInterface = $ifdirname;
1299
        $::ScmInterface = $ifdirname;
1366
    }
1300
    }
1367
    System( "$::GBE_BIN/mkdir -p $ifdirname/bin" );
1301
    System( "$::GBE_BIN/mkdir -p $ifdirname/bin" );
1368
    System( "$::GBE_BIN/mkdir -p $ifdirname/lib" );
1302
    System( "$::GBE_BIN/mkdir -p $ifdirname/lib" );
1369
 
1303
 
1370
    Log( "Interface .. $ifdirname\n" );
1304
    Log( "Interface .. $ifdirname" );
1371
    return 1;
1305
    return 1;
1372
}
1306
}
1373
 
1307
 
1374
 
1308
 
1375
sub BuildDirTree
1309
sub BuildDirTree
Line 1390... Line 1324...
1390
    #   Allow for an empty "dirfile". This will allow a directory to be created
1324
    #   Allow for an empty "dirfile". This will allow a directory to be created
1391
    #   without the overhead of the file
1325
    #   without the overhead of the file
1392
    #
1326
    #
1393
    if ( ! $dirfile )
1327
    if ( ! $dirfile )
1394
    {
1328
    {
1395
        Log( "DirTree .... $dirhead\n" );
1329
        Log( "DirTree .... $dirhead" );
1396
        System( "$::GBE_BIN/mkdir -p $dirhead" );
1330
        System( "$::GBE_BIN/mkdir -p $dirhead" );
1397
    }
1331
    }
1398
    else
1332
    else
1399
    {
1333
    {
1400
        Log( "DirTree .... $dirfile within $dirhead\n" );
1334
        Log( "DirTree .... $dirfile within $dirhead" );
1401
        System( "$::GBE_BIN/mkdir -p $dirhead" );
1335
        System( "$::GBE_BIN/mkdir -p $dirhead" );
1402
    
1336
    
1403
        open( DIRFILE, $dirfile ) ||
1337
        open( DIRFILE, $dirfile ) ||
1404
            Error( "cannot open '$dirfile'" );
1338
            Error( "cannot open '$dirfile'" );
1405
 
1339
 
Line 1411... Line 1345...
1411
 
1345
 
1412
            next unless ( $c == 1 );
1346
            next unless ( $c == 1 );
1413
 
1347
 
1414
            if ( ! -d "$dirhead/$dirname" )
1348
            if ( ! -d "$dirhead/$dirname" )
1415
            {
1349
            {
1416
                Log( "Dir ........ $dirhead/$dirname\n" );
1350
                Log( "Dir ........ $dirhead/$dirname" );
1417
                System( "$::GBE_BIN/mkdir -p $dirhead/$dirname" );
1351
                System( "$::GBE_BIN/mkdir -p $dirhead/$dirname" );
1418
            }
1352
            }
1419
        }
1353
        }
1420
 
1354
 
1421
        close( DIRFILE );
1355
        close( DIRFILE );
Line 1449... Line 1383...
1449
    #   even though the function user may be called multiple times.
1383
    #   even though the function user may be called multiple times.
1450
    #   Also prevents recursion within included packages.
1384
    #   Also prevents recursion within included packages.
1451
    #
1385
    #
1452
    if ( -f $file  )
1386
    if ( -f $file  )
1453
    {
1387
    {
1454
        Log( "PackageIncludes. $name\n" ) unless ( $INC{$file} );
1388
        Log( "PackageIncludes. $name" ) unless ( $INC{$file} );
1455
        require $file;
1389
        require $file;
1456
    }
1390
    }
1457
}
1391
}
1458
 
1392
 
1459
 
1393
 
Line 1476... Line 1410...
1476
 
1410
 
1477
#
1411
#
1478
#   If GBE_BUILDFILTER exists, Import 'user' platform
1412
#   If GBE_BUILDFILTER exists, Import 'user' platform
1479
#   specification and filter against the BUILD_ACTIVEPLATFORMS.
1413
#   specification and filter against the BUILD_ACTIVEPLATFORMS.
1480
#
1414
#
1481
    Log( "LinkSandbox. $name ($path)\n" );
1415
    Log( "LinkSandbox. $name ($path)" );
1482
 
1416
 
1483
    if ( ! -d $path )                           # sandbox exists ?
1417
    if ( ! -d $path )                           # sandbox exists ?
1484
    {
1418
    {
1485
        Log( "WARNING .... Sandbox $path not available\n" );
1419
        Log( "WARNING .... Sandbox $path not available" );
1486
    }
1420
    }
1487
    else
1421
    else
1488
    {
1422
    {
1489
        $path = Realpath( $path );
1423
        $path = Realpath( $path );
1490
 
1424
 
Line 1539... Line 1473...
1539
    #
1473
    #
1540
    #   Ensure that we have do not have multiple definitions
1474
    #   Ensure that we have do not have multiple definitions
1541
    #
1475
    #
1542
    if ( PackageEntry::Exists( $name, $version ) )
1476
    if ( PackageEntry::Exists( $name, $version ) )
1543
    {
1477
    {
1544
        Log( "Duplicate Package: $name, $version. Duplicate entry ignored\n" );
1478
        Log( "Duplicate Package: $name, $version. Duplicate entry ignored" );
1545
        return;
1479
        return;
1546
    }
1480
    }
1547
 
1481
 
1548
    if ( $Cache && $::GBE_DPKG_CACHE )
1482
    if ( $Cache && $::GBE_DPKG_CACHE )
1549
    {
1483
    {
1550
        my $mode = ($Cache > 1) ? "-refresh" : "";
1484
        my $mode = ($Cache > 1) ? "-refresh" : "";
1551
        Log( "LinkPkgArchive . $name ($version) Update Cache\n" );
1485
        Log( "LinkPkgArchive . $name ($version) Update Cache" );
1552
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -quiet $name/$version" );
1486
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -quiet $name/$version" );
1553
    }
1487
    }
1554
 
1488
 
1555
    #
1489
    #
1556
    #   Locate the package ONCE
1490
    #   Locate the package ONCE
1557
    #
1491
    #
1558
    Log( "LinkPkgArchive . $name ($version)\n" );
1492
    Log( "LinkPkgArchive . $name ($version)" );
1559
    my ($pkg, $local ) = PackageLocate( $name, $version );
1493
    my ($pkg, $local ) = PackageLocate( $name, $version );
1560
    if ( $pkg )
1494
    if ( $pkg )
1561
    {
1495
    {
1562
        #
1496
        #
1563
        #   Generate package rules for each active platform
1497
        #   Generate package rules for each active platform
Line 1749... Line 1683...
1749
 
1683
 
1750
    #
1684
    #
1751
    #   Package not found
1685
    #   Package not found
1752
    #   This is an error, although it can be bypassed
1686
    #   This is an error, although it can be bypassed
1753
    #
1687
    #
1754
    Error ("Required package not found: '$name/$version'" ) if $PackageError;
1688
    Error ("Required package not found: '$name/$version'" ) unless ( $NoPackageError );
1755
 
1689
 
1756
    Log( "WARNING .... Package not available: '$name/$version'\n" );
1690
    Log( "WARNING .... Package not available: '$name/$version'" );
1757
    return undef;
1691
    return undef;
1758
}
1692
}
1759
 
1693
 
1760
 
1694
 
1761
#-------------------------------------------------------------------------------
1695
#-------------------------------------------------------------------------------
Line 1893... Line 1827...
1893
    #
1827
    #
1894
    #   Ensure that we have do not have multiple definitions
1828
    #   Ensure that we have do not have multiple definitions
1895
    #
1829
    #
1896
    if ( PackageEntry::Exists( $name, $version ) )
1830
    if ( PackageEntry::Exists( $name, $version ) )
1897
    {
1831
    {
1898
        Log( "Duplicate Package: $name, $version. Duplicate entry ignored\n" );
1832
        Log( "Duplicate Package: $name, $version. Duplicate entry ignored" );
1899
        return;
1833
        return;
1900
    }
1834
    }
1901
 
1835
 
1902
    if ( $Cache && $::GBE_DPKG_CACHE )
1836
    if ( $Cache && $::GBE_DPKG_CACHE )
1903
    {
1837
    {
1904
        my $mode = ($Cache > 1) ? "-refresh" : "";
1838
        my $mode = ($Cache > 1) ? "-refresh" : "";
1905
        Log( "BuildPkgArchive . $name ($version) Update Cache\n" );
1839
        Log( "BuildPkgArchive . $name ($version) Update Cache" );
1906
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -quiet $name/$version" );
1840
        System('--NoExit', "$::GBE_PERL $::GBE_TOOLS/cache_dpkg.pl $mode -quiet $name/$version" );
1907
    }
1841
    }
1908
 
1842
 
1909
    #
1843
    #
1910
    #   Locate the package
1844
    #   Locate the package
1911
    #   Use the first instance of the package that it found
1845
    #   Use the first instance of the package that it found
1912
    #
1846
    #
1913
    Log( "BuildPkgArchive . $name ($version)\n" );
1847
    Log( "BuildPkgArchive . $name ($version)" );
1914
    my ( $pkg, $local ) = PackageLocate( $name, $version );
1848
    my ( $pkg, $local ) = PackageLocate( $name, $version );
1915
    if ( $pkg )
1849
    if ( $pkg )
1916
    {
1850
    {
1917
        #
1851
        #
1918
        #   Create a Package Entry
1852
        #   Create a Package Entry
Line 1944... Line 1878...
1944
        #
1878
        #
1945
        if ( $package_installed ) {
1879
        if ( $package_installed ) {
1946
            Verbose ("Package already installed: $name, $version");
1880
            Verbose ("Package already installed: $name, $version");
1947
            
1881
            
1948
        } else {
1882
        } else {
1949
            Log( "                . installing '$pkg'\n" );
1883
            Log( "                . installing '$pkg'" );
1950
            Log( "                . -> " . readlink($pkg) . "\n" ) if ( -l $pkg );
1884
            Log( "                . -> " . readlink($pkg) ) if ( -l $pkg );
1951
 
1885
 
1952
            if ( -e "$pkg/descpkg" )
1886
            if ( -e "$pkg/descpkg" )
1953
            {
1887
            {
1954
 
1888
 
1955
                #
1889
                #
Line 2380... Line 2314...
2380
    # Build the release archive file...
2314
    # Build the release archive file...
2381
    #
2315
    #
2382
    $SnapDir = "$ENV{ \"GBE_SNAPSHOT_DIR\" }/";
2316
    $SnapDir = "$ENV{ \"GBE_SNAPSHOT_DIR\" }/";
2383
    $SnapDir = "" unless ($SnapDir ne "/");
2317
    $SnapDir = "" unless ($SnapDir ne "/");
2384
 
2318
 
2385
    Log( "Creating release archive: $SnapDir$BuildFilename.tgz of $Cwd/$BuildDir/\n" );
2319
    Log( "Creating release archive: $SnapDir$BuildFilename.tgz of $Cwd/$BuildDir/" );
2386
 
2320
 
2387
    # GNU tar and zip the build directory NOT following links...
2321
    # GNU tar and zip the build directory NOT following links...
2388
    #
2322
    #
2389
    System( "$::GBE_BIN/tar czf $SnapDir$BuildFilename.tgz $BuildDir" );
2323
    System( "$::GBE_BIN/tar czf $SnapDir$BuildFilename.tgz $BuildDir" );
2390
 
2324
 
Line 2407... Line 2341...
2407
 
2341
 
2408
    # Set the build access permissions from the shell script...
2342
    # Set the build access permissions from the shell script...
2409
    $PermsFilename = $CmdParm;
2343
    $PermsFilename = $CmdParm;
2410
    if ( -e $PermsFilename )
2344
    if ( -e $PermsFilename )
2411
    {
2345
    {
2412
        Log( "Setting build access permissions from $PermsFilename...\n" );
2346
        Log( "Setting build access permissions from $PermsFilename..." );
2413
        System( "su root -c \"sh $PermsFilename\"" );
2347
        System( "su root -c \"sh $PermsFilename\"" );
2414
    }
2348
    }
2415
    else
2349
    else
2416
    {
2350
    {
2417
        Log( "ERROR: Could not find file to set the access permissions: $PermsFilename\n" );
2351
        Log( "ERROR: Could not find file to set the access permissions: $PermsFilename" );
2418
    }
2352
    }
2419
    die "\n";
2353
    die "\n";
2420
}
2354
}
2421
 
2355
 
2422
 
2356
 
Line 2581... Line 2515...
2581
        unlink $link_path;          # Delete the link
2515
        unlink $link_path;          # Delete the link
2582
        rmdir $link_dir;            # Delete only if empty
2516
        rmdir $link_dir;            # Delete only if empty
2583
    }
2517
    }
2584
    else
2518
    else
2585
    {
2519
    {
2586
        Log( "Local Link . $BUILDNAME_PACKAGE/$link_file ($tag)\n");
2520
        Log( "Local Link . $BUILDNAME_PACKAGE/$link_file ($tag)");
2587
        unlink $link_path;
-
 
2588
        mkdir $link_dir;
2521
        mkdir $link_dir unless -d $link_dir;
2589
        open  LNK,">$link_path" || Error( "Cannot open: $link_path" );
-
 
2590
        print LNK "$Cwd/pkg/$BUILDNAME_PACKAGE\n";
2522
        FileCreate ( $link_path, "$Cwd/pkg/$BUILDNAME_PACKAGE");
2591
        close LNK;
-
 
2592
    }
2523
    }
2593
}
2524
}
2594
 
2525
 
2595
#-------------------------------------------------------------------------------
2526
#-------------------------------------------------------------------------------
2596
# Function        : BuildSandboxData
2527
# Function        : BuildSandboxData
Line 2639... Line 2570...
2639
        unlink $link_path;          # Delete the link
2570
        unlink $link_path;          # Delete the link
2640
        rmdir $link_dir;            # Delete only if empty
2571
        rmdir $link_dir;            # Delete only if empty
2641
    }
2572
    }
2642
    else
2573
    else
2643
    {
2574
    {
2644
        Log( "Sandbox cfg. $link_file\n");
2575
        Log( "Sandbox cfg. $link_file");
2645
        unlink $link_path;
2576
        unlink $link_path;
2646
        mkdir $link_dir;
2577
        mkdir $link_dir;
2647
 
2578
 
2648
        #
2579
        #
2649
        #   Create the sandbox config data structure
2580
        #   Create the sandbox config data structure
Line 2797... Line 2728...
2797
    #
2728
    #
2798
    @ARGV = ();
2729
    @ARGV = ();
2799
    $0 = "makefile.pl ";
2730
    $0 = "makefile.pl ";
2800
    push @ARGV, "$Cwd";                         # current working directory
2731
    push @ARGV, "$Cwd";                         # current working directory
2801
    push @ARGV, "$::MAKELIB_PL";                # makelib.pl image
2732
    push @ARGV, "$::MAKELIB_PL";                # makelib.pl image
2802
 
-
 
2803
    push @ARGV, "-D1"                           # debug
-
 
2804
        if ($::ScmDebug);
-
 
2805
 
-
 
2806
    push @ARGV, "-V"                            # verbose
-
 
2807
        if ($::ScmVerbose);
-
 
2808
 
-
 
2809
    push @ARGV, "--expert"                      # expert mode
-
 
2810
        if ($Expert);
-
 
2811
                                                # interface
-
 
2812
    push @ARGV, "--interface=$BUILDINTERFACE"
2733
    push @ARGV, "--interface=$BUILDINTERFACE"
2813
        if ($BUILDINTERFACE ne "");
2734
        if ($BUILDINTERFACE);
2814
 
-
 
2815
    push @ARGV, "--all"                         # build all platforms
-
 
2816
        if ($All);
-
 
2817
 
2735
 
2818
    Debug( "ARGV:      @ARGV" );
2736
    Debug( "ARGV:      @ARGV" );
2819
 
2737
 
2820
    #.. (re)Build root makefile
2738
    #.. (re)Build root makefile
2821
    #
2739
    #
Line 2978... Line 2896...
2978
    #   It will be a file that is 'known' to JATS
2896
    #   It will be a file that is 'known' to JATS
2979
    #
2897
    #
2980
    my $pkgfile = BuildAddKnownFile ( $Srcdir, 'descpkg' );
2898
    my $pkgfile = BuildAddKnownFile ( $Srcdir, 'descpkg' );
2981
    return if ( $Clobber );                 # clobber mode ?
2899
    return if ( $Clobber );                 # clobber mode ?
2982
 
2900
 
2983
    open( DESCPKG, ">$pkgfile" ) ||
2901
    my @desc;
2984
        Error( "Cannot create $pkgfile. $!" );
-
 
2985
 
-
 
2986
    print DESCPKG "Package Name: $BUILDNAME_PACKAGE\n";
2902
    push @desc, "Package Name: $BUILDNAME_PACKAGE";
2987
    print DESCPKG "Version:      $BUILDVERSION\n";
2903
    push @desc, "Version:      $BUILDVERSION";
2988
    print DESCPKG "Released By:  $::USER\n";
2904
    push @desc, "Released By:  $::USER";
2989
    print DESCPKG "Released On:  $::CurrentTime\n";
2905
    push @desc, "Released On:  $::CurrentTime";
2990
    print DESCPKG "Path:         $Cwd\n";
2906
    push @desc, "Path:         $Cwd";
2991
    print DESCPKG "Jats Version: $::GBE_VERSION\n";
2907
    push @desc, "Jats Version: $::GBE_VERSION";
2992
    print DESCPKG "Jats Path:    $::GBE_CORE\n";
2908
    push @desc, "Jats Path:    $::GBE_CORE";
2993
    print DESCPKG "\n";
2909
    push @desc, "";
2994
    print DESCPKG "Build Dependencies:\n";
2910
    push @desc, "Build Dependencies:";
2995
    print DESCPKG "\n";
2911
    push @desc, "";
2996
 
2912
 
2997
    foreach my $tag ( PackageEntry::GetPackageList )
2913
    foreach my $tag ( PackageEntry::GetPackageList )
2998
    {
2914
    {
2999
        my ($name, $version, $type) = PackageEntry::GetPackageData($tag);
2915
        my ($name, $version, $type) = PackageEntry::GetPackageData($tag);
3000
 
2916
 
Line 3002... Line 2918...
3002
 
2918
 
3003
        push @attributes, "name=\"$name\"";
2919
        push @attributes, "name=\"$name\"";
3004
        push @attributes, "version=\"$version\"";
2920
        push @attributes, "version=\"$version\"";
3005
        push @attributes, "build=\"true\"" if $type =~ /Build/i;
2921
        push @attributes, "build=\"true\"" if $type =~ /Build/i;
3006
 
2922
 
3007
        print DESCPKG "<sandbox @attributes/>\n";
2923
        push @desc, "<sandbox @attributes/>";
3008
    }
2924
    }
3009
    close DESCPKG;
-
 
3010
 
2925
 
-
 
2926
    FileCreate ($pkgfile, \@desc );
3011
}
2927
}
3012
 
2928
 
3013
#-------------------------------------------------------------------------------
2929
#-------------------------------------------------------------------------------
3014
# Function        : BuildIncpkg
2930
# Function        : BuildIncpkg
3015
#
2931
#
Line 3068... Line 2984...
3068
\$ScmBuildPackage               = \"$BUILDNAME_PACKAGE\";
2984
\$ScmBuildPackage               = \"$BUILDNAME_PACKAGE\";
3069
\$ScmBuildVersion               = \"$BUILDNAME_VERSION\";
2985
\$ScmBuildVersion               = \"$BUILDNAME_VERSION\";
3070
\$ScmBuildProject               = \"$BUILDNAME_PROJECT\";
2986
\$ScmBuildProject               = \"$BUILDNAME_PROJECT\";
3071
\$ScmBuildVersionFull           = \"$BUILDVERSION\";
2987
\$ScmBuildVersionFull           = \"$BUILDVERSION\";
3072
\$ScmBuildPreviousVersion       = \"$BUILDPREVIOUSVERSION\";
2988
\$ScmBuildPreviousVersion       = \"$BUILDPREVIOUSVERSION\";
3073
\$ScmProjectSupport             = \"$Project\";
-
 
3074
\$ScmLocal                      = \"$BUILDLOCAL\";
2989
\$ScmLocal                      = \"$BUILDLOCAL\";
3075
\$ScmDeploymentPatch            = \"$DEPLOY_PATCH\";
2990
\$ScmDeploymentPatch            = \"$DEPLOY_PATCH\";
3076
\$ScmSrcDir                     = \"$Srcdir\";
2991
\$ScmSrcDir                     = \"$Srcdir\";
3077
\$ScmBuildSrc                   = \"$ScmBuildSrc\";
2992
\$ScmBuildSrc                   = \"$ScmBuildSrc\";
3078
\$ScmExpert                     = \"$Expert\";
2993
\$ScmExpert                     = \"$Expert\";
-
 
2994
\$ScmAll                        = \"$All\";
3079
");
2995
");
3080
 
2996
 
3081
#.. Alias
2997
#.. Alias
3082
#
2998
#
3083
    $fh->DumpData(
2999
    $fh->DumpData(
Line 3623... Line 3539...
3623
 
3539
 
3624
 Options:
3540
 Options:
3625
    --help          - Display terse usage
3541
    --help          - Display terse usage
3626
    --help --help   - Display verbose usage
3542
    --help --help   - Display verbose usage
3627
    --man           - Display internal manual
3543
    --man           - Display internal manual
3628
    -V              - Turn on verbose mode
3544
    --verbose[=n]   - Set level of progress verbosity
3629
    -D[<level>]     - Set the debug level
3545
    --debug[=n]     - Set the debug level
3630
    --nolog         - Do not generate/update Changelog
3546
    --nolog         - Do not generate/update Changelog
3631
    --cache         - Cache packages in the local dpkg_package cache
3547
    --cache         - Cache packages in the local dpkg_package cache
3632
    --cache --cache - Forced refresh dependent packages in the local cache
3548
    --cache --cache - Forced refresh dependent packages in the local cache
3633
    --project       - Generate support files for external tools
3549
    --project       - Generate support files for external tools
3634
    --package       - Ignore packages that are not available and continue
3550
    --package       - Ignore packages that are not available and continue
Line 3636... Line 3552...
3636
                      Also suppress the use of symlinks so that the phsical
3552
                      Also suppress the use of symlinks so that the phsical
3637
                      file will be copied locally.
3553
                      file will be copied locally.
3638
 
3554
 
3639
 Sticky settings:
3555
 Sticky settings:
3640
    --all           - Build for all platforms ignoring GBE_BUILDFILTER
3556
    --all           - Build for all platforms ignoring GBE_BUILDFILTER
3641
    --expert        - Relaxing dependency checks on the user makefiles
3557
    --expert[=n]    - Relaxing dependency checks on the user makefiles
3642
 
3558
 
3643
 Commands:
3559
 Commands:
3644
    changelog       - Only update ChangeLog.
3560
    changelog       - Only update ChangeLog.
3645
    interface       - Only (re)build the interface tree, including ChangeLog.
3561
    interface       - Only (re)build the interface tree, including ChangeLog.
3646
    rootonly        - Only (re)build the root directory.
3562
    rootonly        - Only (re)build the root directory.
Line 3661... Line 3577...
3661
 
3577
 
3662
=item B<-man>
3578
=item B<-man>
3663
 
3579
 
3664
Prints the manual page and exits.
3580
Prints the manual page and exits.
3665
 
3581
 
3666
=item B<-V>
3582
=item B<--verbose[=n]>
-
 
3583
 
-
 
3584
Increases program output.
3667
 
3585
 
-
 
3586
If an argument is provided, then it will be used to set the level, otherwise the
3668
Increases program output. This option may be specified multiple times
3587
existing level will be incremented. This option may be specified multiple times.
3669
 
3588
 
3670
=item B<-D[<level>]
3589
=item B<-debug>
3671
 
3590
 
3672
Increases program output. Enable internal debugging messages to generate detailed
3591
Increases program output. Enable internal debugging messages to generate detailed
3673
progress information.
3592
progress information.
3674
 
3593
 
-
 
3594
If an argument is provided, then it will be used to set the level, otherwise the
-
 
3595
existing level will be incremented. This option may be specified multiple times.
-
 
3596
 
3675
=item B<--nolog>
3597
=item B<--nolog>
3676
 
3598
 
3677
Do not generate or update the ChangeLog maintained when a CVS directory is detected
3599
Do not generate or update the ChangeLog maintained when a CVS directory is detected
3678
in the build directory.
3600
in the build directory.
3679
 
3601
 
Line 3725... Line 3647...
3725
possible build targets ignoring the use of GBE_BUILDFILTER.
3647
possible build targets ignoring the use of GBE_BUILDFILTER.
3726
 
3648
 
3727
This option is sticky. Once used in a build it will be retained when makefiles
3649
This option is sticky. Once used in a build it will be retained when makefiles
3728
are rebuilt.
3650
are rebuilt.
3729
 
3651
 
3730
=item B<--expert>
3652
=item B<--expert[=n]>
3731
 
3653
 
3732
This option causes the generation of makefiles with relaxed dependancy checks.
3654
This option causes the generation of makefiles with relaxed dependancy checks.
3733
 
3655
 
-
 
3656
If an argument is provided, then it will be used to set the level, otherwise a
-
 
3657
level of '1' will be set.
-
 
3658
 
3734
The makefiles will have no dependancy between the makefiles and the JATS build
3659
The makefiles will have no dependancy between the makefiles and the JATS build
3735
files or the users makefile. If the user's makefile.pl is changed then JATS
3660
files or the users makefile. If the user's makefile.pl is changed then JATS
3736
will not detect the change and will not rebuild the makefiles. The user manually
3661
will not detect the change and will not rebuild the makefiles. The user manually
3737
force the rebuild with the command 'jats rebuild'.
3662
force the rebuild with the command 'jats rebuild'.
3738
 
3663
 
3739
This option should be used with care and with full knowledge of its impact.
3664
This option should be used with care and with full knowledge of its impact.
3740
 
3665
 
3741
This option is sticky. Once used in a build it will be retained when makefiles
3666
This option is sticky. Once used in a build it will be retained when makefiles
3742
are rebuilt. The effect of the option can only be removed by performing a full
3667
are rebuilt. It will only be lost when the next 'jats build' is perfromed.
3743
build.
3668
 
-
 
3669
The effect of the option can be changed when the makefiles are processed. This
-
 
3670
option simply sets the default' mode of operation.
3744
 
3671
 
3745
=item B<changelog>
3672
=item B<changelog>
3746
 
3673
 
3747
This command will only update the CVS change log.
3674
This command will only update the CVS change log.
3748
 
3675
 
3749
=item B<interface>
3676
=item B<interface>
3750
 
3677
 
3751
This command will only build, or rebuild, the 'interface' directory and the
3678
This command will only build, or rebuild, the 'interface' directory and the
3752
changelog ( if required ).
3679
changelog ( if required ).
3753
 
3680
 
3754
This command will only build, or rebuild, the root directory. The build
3681
This command will not build, or rebuild, the root directory. The build
3755
process will not recurse through the subdirectories creating makefiles.
3682
process will not recurse through the subdirectories creating makefiles.
3756
 
3683
 
-
 
3684
=item B<rootonly>
-
 
3685
 
-
 
3686
This command will only build, or rebuild, the 'interface' directory, the
-
 
3687
changelog (if required) and the root-level makefiles.
-
 
3688
 
-
 
3689
The build process will not recurse through the subdirectories creating
-
 
3690
makefiles. These can be made on-demand by jats if a 'make' command is issued.
-
 
3691
 
3757
=item B<clobber>
3692
=item B<clobber>
3758
 
3693
 
3759
This command will remove generated build system files and directories.
3694
This command will remove generated build system files and directories.
3760
 
3695
 
3761
=back
3696
=back