Subversion Repositories DevTools

Rev

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

Rev 5709 Rev 6133
Line 40... Line 40...
40
use JatsSystem;
40
use JatsSystem;
41
use FileUtils;
41
use FileUtils;
42
use JatsBuildFiles;
42
use JatsBuildFiles;
43
use JatsVersionUtils;
43
use JatsVersionUtils;
44
use ArrayHashUtils;
44
use ArrayHashUtils;
45
 
-
 
-
 
45
use ToolsetFiles;
46
 
46
 
47
use Pod::Usage;                             # required for help support
47
use Pod::Usage;                             # required for help support
48
use Getopt::Long qw(:config require_order); # Stop on non-option
48
use Getopt::Long qw(:config require_order); # Stop on non-option
-
 
49
use Digest;
-
 
50
 
49
my $VERSION = "1.0.0";                      # Update this
51
my $VERSION = "1.0.0";                      # Update this
50
 
52
 
51
#
53
#
52
#   Options
54
#   Options
53
#
55
#
Line 57... Line 59...
57
my $opt_exact = 0;                          # Exact (escrow) build
59
my $opt_exact = 0;                          # Exact (escrow) build
58
my $opt_toPackage;                          # Control recursion
60
my $opt_toPackage;                          # Control recursion
59
my $opt_fromPackage;                        # Control recursion
61
my $opt_fromPackage;                        # Control recursion
60
my @opt_justPackage;                        # Control recursion
62
my @opt_justPackage;                        # Control recursion
61
my @opt_ignorePackage;                      # Control recursion
63
my @opt_ignorePackage;                      # Control recursion
-
 
64
my $opt_allSandbox;                         # Extend scope to entire sandbox
-
 
65
my $opt_processUsedBy;                      # Process dependants(consumers) not dependents(children)
-
 
66
my $opt_keepgoing;                          # Ignore errors
-
 
67
my $opt_reScan;                             # Rescan for buildfiles
62
 
68
 
63
#
69
#
64
#   Globals - Provided by the JATS environment
70
#   Globals - Provided by the JATS environment
65
#
71
#
66
my $USER            = $ENV{'USER'};
72
my $USER            = $ENV{'USER'};
Line 83... Line 89...
83
#
89
#
84
my @stopped = ();                         # Stopped entries
90
my @stopped = ();                         # Stopped entries
85
my @build_order = ();                     # Build Ordered list of entries
91
my @build_order = ();                     # Build Ordered list of entries
86
my %extern_deps;                          # Hash of external dependencies
92
my %extern_deps;                          # Hash of external dependencies
87
my %packages;                             # Hash of packages
93
my %packages;                             # Hash of packages
88
 
-
 
-
 
94
my $currentPkgTag;                        # Tag of the current package - if any                                          
89
 
95
 
90
#-------------------------------------------------------------------------------
96
#-------------------------------------------------------------------------------
91
# Function        : Mainline Entry Point
97
# Function        : Mainline Entry Point
92
#
98
#
93
# Description     :
99
# Description     :
Line 136... Line 142...
136
create_sandbox()                        if ( $cmd =~ m/^create$/ );
142
create_sandbox()                        if ( $cmd =~ m/^create$/ );
137
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
143
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
138
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
144
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
139
populate(@ARGV)                         if ( $cmd =~ m/^populate$/  );
145
populate(@ARGV)                         if ( $cmd =~ m/^populate$/  );
140
buildfilter(@ARGV)                      if ( $cmd =~ m/^buildfilter$/  );
146
buildfilter(@ARGV)                      if ( $cmd =~ m/^buildfilter$/  );
-
 
147
skipBuild(0, @ARGV)                     if ( $cmd =~ m/^skip$/  );
-
 
148
skipBuild(1, @ARGV)                     if ( $cmd =~ m/^unskip$/  );
-
 
149
fingerPrintPkg(@ARGV)                   if ( $cmd =~ m/^finger/i );
141
 
150
 
142
Error ("Unknown sandbox command: $cmd");
151
Error ("Unknown sandbox command: $cmd");
143
exit 1;
152
exit 1;
144
 
153
 
145
 
154
 
Line 219... Line 228...
219
    }
228
    }
220
    exit 0;
229
    exit 0;
221
}
230
}
222
 
231
 
223
#-------------------------------------------------------------------------------
232
#-------------------------------------------------------------------------------
-
 
233
# Function        : skipBuild 
-
 
234
#
-
 
235
# Description     : Mark the building of a package for skipping
-
 
236
#
-
 
237
# Inputs          : Mode -: Skip, 1:Unskip
-
 
238
#                   User commaand line 
-
 
239
#
-
 
240
# Returns         : Nothing
-
 
241
#
-
 
242
sub skipBuild
-
 
243
{
-
 
244
    my ($mode, @cmd_opts ) = @_;
-
 
245
    my $machine;
-
 
246
 
-
 
247
    Getopt::Long::Configure('pass_through');
-
 
248
    getOptionsFromArray ( \@cmd_opts,
-
 
249
                        'machine!' => \$machine,
-
 
250
                        ) || Error ("Invalid command line" );
-
 
251
 
-
 
252
    SubCommandHelp( $opt_help, "Skip Build") if ($opt_help );
-
 
253
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
-
 
254
 
-
 
255
    #
-
 
256
    #   Determine Sandbox information
-
 
257
    #   Populate global variables
-
 
258
    #
-
 
259
    calc_sandbox_info(1);
-
 
260
 
-
 
261
    #
-
 
262
    #   Display only
-
 
263
    #   
-
 
264
    unless( @cmd_opts)
-
 
265
    {
-
 
266
        foreach my $pkg (keys %packages)
-
 
267
        {
-
 
268
            my $fe = $packages{$pkg};
-
 
269
            next unless $fe->{buildSkip};
-
 
270
 
-
 
271
            my $skipMsg = ($fe->{buildSkip}) ? ' (Build Skipped)' : ' (Build Suppressed)';
-
 
272
            if ($fe->{buildCurrent}) {
-
 
273
                $skipMsg .= ' (Current Package)';
-
 
274
            }
-
 
275
 
-
 
276
            Message( ' Name: ' . $fe->{dname} . $skipMsg );
-
 
277
 
-
 
278
        }
-
 
279
        exit 0;
-
 
280
    }
-
 
281
 
-
 
282
    foreach ( @cmd_opts )
-
 
283
    {
-
 
284
        #
-
 
285
        #   Locate the package
-
 
286
        #
-
 
287
        my $pe;
-
 
288
        if ($currentPkgTag && ($_ eq '.'))
-
 
289
        {
-
 
290
            if (exists $packages{$currentPkgTag})
-
 
291
            {
-
 
292
                $pe = $packages{$currentPkgTag}; 
-
 
293
            }
-
 
294
        }
-
 
295
        unless ($pe) {
-
 
296
            foreach my $pkg (keys %packages)
-
 
297
            {
-
 
298
                my $entry = $packages{$pkg};
-
 
299
                if ($entry->{dname} eq $_ || $entry->{fname} eq $_ )
-
 
300
                {
-
 
301
                    $pe = $entry;
-
 
302
                    last;
-
 
303
                }
-
 
304
            }
-
 
305
        }
-
 
306
        
-
 
307
        unless ($pe) {
-
 
308
            Warning("No package found matching: $_");
-
 
309
            next;
-
 
310
        }
-
 
311
        
-
 
312
        my $skipFile;
-
 
313
        if ($machine) {
-
 
314
            $skipFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', '_skip.' . $GBE_MACHTYPE . '.' . $pe->{dname});
-
 
315
        } else {
-
 
316
            $skipFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', '_skip.'. $pe->{dname});
-
 
317
        }
-
 
318
        Verbose("SkipFile: $skipFile");
-
 
319
        if ($mode)
-
 
320
        {
-
 
321
            unlink $skipFile;
-
 
322
        }
-
 
323
        else
-
 
324
        {
-
 
325
            TouchFile($skipFile);
-
 
326
        }
-
 
327
    }
-
 
328
    exit 0;
-
 
329
}
-
 
330
 
-
 
331
#-------------------------------------------------------------------------------
224
# Function        : info
332
# Function        : info
225
#
333
#
226
# Description     : Display Sandbox information
334
# Description     : Display Sandbox information
227
#
335
#
228
# Inputs          : Command line args
336
# Inputs          : Command line args
Line 232... Line 340...
232
#
340
#
233
sub info
341
sub info
234
{
342
{
235
    my (@cmd_opts ) = @_;
343
    my (@cmd_opts ) = @_;
236
    my $show = 0;
344
    my $show = 0;
-
 
345
    my $showUsage = 0;
-
 
346
    my $showFingerPrint = 0;
237
 
347
 
238
    Getopt::Long::Configure('pass_through');
348
    Getopt::Long::Configure('pass_through');
239
    getOptionsFromArray ( \@cmd_opts,
349
    getOptionsFromArray ( \@cmd_opts,
240
                           'verbose:+'  => \$show,
350
                          'verbose:+'   => \$show,
-
 
351
                          'usedby'      => \$showUsage,
-
 
352
                          'fingerprint' => \$showFingerPrint,
241
                        ) || Error ("Invalid command line" );
353
                        ) || Error ("Invalid command line" );
242
    SubCommandHelp( $opt_help, "Sandbox Information") if ($opt_help || $#cmd_opts >=0 );
354
    SubCommandHelp( $opt_help, "Sandbox Information") if ($opt_help || $#cmd_opts >=0 );
-
 
355
    $showUsage = 1 if ($show >= 2);
243
 
356
 
244
    #
357
    #
245
    #   Determine Sandbox information
358
    #   Determine Sandbox information
246
    #   Populate global variables
359
    #   Populate global variables
247
    #
360
    #
248
    calc_sandbox_info(1);
361
    calc_sandbox_info();
249
 
362
 
250
    #
363
    #
251
    #   Display information
364
    #   Display information
252
    #
365
    #
253
    Message ("Type       : " . ($opt_exact ? 'Exact' : 'Development') );
366
    Message ("Type       : " . ($opt_exact ? 'Exact' : 'Development') );
-
 
367
    Message ("Scope      : " . ($opt_allSandbox ? 'Entire Sandbox' : $packages{$currentPkgTag}{dname} ));
254
    Message ("Base       : $GBE_SANDBOX");
368
    Message ("Base       : $GBE_SANDBOX");
255
    Message ("Archive    : $GBE_DPKG_SBOX");
369
    Message ("Archive    : $GBE_DPKG_SBOX");
256
    Message ("BuildFilter: $GBE_BUILDFILTER" . ( (-f $GBE_SANDBOX . '/buildfilter')  ? ' - Local to sandbox' : ''));
370
    Message ("BuildFilter: $GBE_BUILDFILTER" . ( (-f $GBE_SANDBOX . '/buildfilter')  ? ' - Local to sandbox' : ''));
257
 
371
 
258
 
372
 
259
    Message ("Build Order");
373
    Message ("Build Order");
260
    foreach my $pname ( @stopped )
374
    foreach my $pname ( @stopped )
261
    {
375
    {
262
        Message( "    Level:" . "-"  . " Name: " . $pname . ' (Stopped)');
376
        Message( "    Level:" . "-"  . " [---] Name: " . $pname . ' (Stopped)');
263
    }
377
    }
264
    foreach my $fe ( @build_order )
378
    foreach my $fe ( @build_order )
265
    {
379
    {
266
        Message( "    Level:" . $fe->{level} . " Name: " . $fe->{dname} . ($fe->{buildActive} ? '' : ' (Build Suppressed)'));
-
 
267
        Message( DisplayPath ("        Path: $fe->{dir}" )) if $show;
380
        displayHeader($fe, { indent => '    ', testFingerPrint =>  $showFingerPrint, showIcons => 1});
268
 
381
 
269
        if ( $show )
382
        if ( $show )
270
        {
383
        {
-
 
384
            Message( DisplayPath ("        Path: $fe->{dir}" ));
271
            foreach my $idep ( sort values %{$fe->{'ideps'}} )
385
            foreach my $idep ( sort values %{$fe->{'ideps'}} )
272
            {
386
            {
273
                Message ("        I:$idep");
387
                Message ("        I:$idep");
274
            }
388
            }
275
 
389
 
276
            foreach my $edep ( sort keys %{$fe->{'edeps'}} )
390
            foreach my $edep ( sort keys %{$fe->{'edeps'}} )
277
            {
391
            {
278
                my ($ppn,$ppv) = split( $; , $edep);
392
                my ($ppn,$ppv) = split( $; , $edep);
279
                Message ("        E:$ppn $ppv");
393
                Message ("        E:$ppn $ppv");
280
            }
394
            }
-
 
395
        }
281
 
396
 
-
 
397
        if ($showUsage && exists($fe->{'usedBy'}))
-
 
398
        {
-
 
399
            foreach my $edep ( sort {uc($a) cmp uc($b)} @{$fe->{'usedBy'}} )
-
 
400
            {
-
 
401
                Message ("        U:$packages{$edep}{dname}");
-
 
402
            }
282
        }
403
        }
283
    }
404
    }
284
 
405
 
285
    #
406
    #
286
    #   External dependencies flags
407
    #   External dependencies flags
287
    #       * - Package does not exist in dpkg_archive
408
    #       * - Package does not exist in dpkg_archive
288
    #       + - Multiple versions of this package are used
409
    #       + - Multiple versions of this package are used
289
 
410
 
290
    Message("External Dependencies");
411
    Message("External Dependencies");
291
    foreach my $de ( sort keys %extern_deps )
412
    foreach my $de ( sort {uc($a) cmp uc($b)} keys %extern_deps )
292
    {
413
    {
293
        my @vlist = keys %{$extern_deps{$de}};
414
        my @vlist = keys %{$extern_deps{$de}};
294
        my $flag = $#vlist ? '+' : '';
415
        my $flag = $#vlist ? '+' : '';
295
        foreach my $pve ( @vlist )
416
        foreach my $pve ( sort {uc($a) cmp uc($b)} @vlist )
296
        {
417
        {
297
            my ($pn,$pv) = split( $; , $pve );
418
            my ($pn,$pv) = split( $; , $pve );
298
            my $exists = check_package_existance($pn,$pv  ) ? '' : '*';
419
            my $exists = check_package_existance($pn,$pv  ) ? '' : '*';
299
            my $flags = sprintf ("%4.4s", $flag . $exists);
420
            my $flags = sprintf ("%4.4s", $flag . $exists);
300
            Message ("${flags}${pn} ${pv}");
421
            Message ("${flags}${pn} ${pv}");
301
            if ( $show )
422
            if ( $show || $showUsage )
302
            {
423
            {
303
                foreach my $pkg ( @{$extern_deps{$de}{$pve}} )
424
                foreach my $pkg ( sort {uc($a) cmp uc($b)} @{$extern_deps{$de}{$pve}} )
304
                {
425
                {
305
                    my $ppn = join ('.', split( $; , $pkg));
426
                    my $ppn = join ('.', split( $; , $pkg));
306
                    Message ("        U:$ppn");
427
                    Message ("        U:$ppn");
307
                }
428
                }
308
            }
429
            }
Line 318... Line 439...
318
    }
439
    }
319
    exit (0);
440
    exit (0);
320
}
441
}
321
 
442
 
322
#-------------------------------------------------------------------------------
443
#-------------------------------------------------------------------------------
-
 
444
# Function        : fingerPrintPkg 
-
 
445
#
-
 
446
# Description     : Various finger print operations on the current package
-
 
447
#
-
 
448
# Inputs          : @ARGV   - Arguments
-
 
449
#
-
 
450
# Returns         : WIll not return
-
 
451
#
-
 
452
sub fingerPrintPkg
-
 
453
{
-
 
454
    my ( @cmd_opts ) = @_;
-
 
455
    my $opt_generate;
-
 
456
    my $opt_delete;
-
 
457
 
-
 
458
    Getopt::Long::Configure('pass_through');
-
 
459
    getOptionsFromArray ( \@cmd_opts,
-
 
460
                          'generate!' => \$opt_generate,
-
 
461
                          'delete!'   => \$opt_delete,
-
 
462
                        ) || Error ("Invalid command line" );
-
 
463
 
-
 
464
    SubCommandHelp( $opt_help, "Sandbox Finger Print") if ($opt_help );
-
 
465
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
-
 
466
 
-
 
467
    #
-
 
468
    #   Determine Sandbox information
-
 
469
    #   Populate global variables
-
 
470
    #
-
 
471
    calc_sandbox_info(1);
-
 
472
 
-
 
473
    #
-
 
474
    #   Determine the named packages, or use the current package
-
 
475
    #
-
 
476
    my @pkgList;
-
 
477
    if (@cmd_opts)
-
 
478
    {
-
 
479
        @pkgList = @cmd_opts;
-
 
480
    }
-
 
481
    else
-
 
482
    {
-
 
483
        if ( $currentPkgTag )
-
 
484
        {
-
 
485
            if (exists $packages{$currentPkgTag})
-
 
486
            {
-
 
487
                push @pkgList, $packages{$currentPkgTag}{fname};
-
 
488
            }
-
 
489
        }
-
 
490
    }
-
 
491
    Error ("Command must be used within a package, or with named packages.") 
-
 
492
        unless @pkgList;
-
 
493
 
-
 
494
 
-
 
495
    #
-
 
496
    #   Process all required packages
-
 
497
    #
-
 
498
    foreach my $pkgName ( @pkgList)
-
 
499
    {
-
 
500
        #
-
 
501
        #   Locate the package
-
 
502
        #
-
 
503
        my $pe;
-
 
504
        foreach my $pkg (keys %packages)
-
 
505
        {
-
 
506
            my $entry = $packages{$pkg};
-
 
507
            if ($entry->{dname} eq $pkgName || $entry->{fname} eq $pkgName )
-
 
508
            {
-
 
509
                $pe = $entry;
-
 
510
                last;
-
 
511
            }
-
 
512
        }
-
 
513
 
-
 
514
        unless ( $pe ) {
-
 
515
            Warning ("Cannot locate package: $pkgName");
-
 
516
            next;
-
 
517
        }
-
 
518
 
-
 
519
        #
-
 
520
        #   Recalculate finger print
-
 
521
        #
-
 
522
        my $tagFile = getPkgFingerPrintFile($pe);
-
 
523
        if ($opt_generate)
-
 
524
        {
-
 
525
            my $ifaceDir = getpkgInterface($pe);
-
 
526
            if ($ifaceDir)
-
 
527
            {
-
 
528
                Message ("Generate Fingerprint");
-
 
529
                FileCreate( $tagFile, genPkgFingerPrint($pe,'Generation') );
-
 
530
            }
-
 
531
            else
-
 
532
            {
-
 
533
                Warning("Package has not been built. Cannot generate fingerprint: $pkgName");
-
 
534
            }
-
 
535
        }
-
 
536
        elsif ($opt_delete)
-
 
537
        {
-
 
538
            unlink $tagFile;
-
 
539
            Message ("Fingerprint file removed");
-
 
540
        }
-
 
541
        else
-
 
542
        {
-
 
543
            #
-
 
544
            #   Test the finger print on the current package
-
 
545
            #
-
 
546
            if ( -e $tagFile )
-
 
547
            {
-
 
548
                if ( TagFileMatch($tagFile, genPkgFingerPrint($pe, 'Test')) )
-
 
549
                {
-
 
550
                    Message ("Fingerprint match");
-
 
551
                }
-
 
552
                else
-
 
553
                {
-
 
554
                    Message("Fingerprint missmatch");
-
 
555
                }
-
 
556
            }
-
 
557
            else
-
 
558
            {
-
 
559
                Message ("Package does not have a fingerprint file");
-
 
560
            }
-
 
561
        }
-
 
562
    }
-
 
563
 
-
 
564
    exit (0);
-
 
565
}
-
 
566
 
-
 
567
 
-
 
568
#-------------------------------------------------------------------------------
323
# Function        : check_package_existance
569
# Function        : check_package_existance
324
#
570
#
325
# Description     : Determine if a given package-version exists
571
# Description     : Determine if a given package-version exists
326
#
572
#
327
# Inputs          : $name           - Package Name
573
# Inputs          : $name           - Package Name
Line 350... Line 596...
350
        }
596
        }
351
    }
597
    }
352
   return 0;
598
   return 0;
353
}
599
}
354
 
600
 
-
 
601
#-------------------------------------------------------------------------------
-
 
602
# Function        : getpkgInterface 
-
 
603
#
-
 
604
# Description     : Locate the packages interface directory 
-
 
605
#
-
 
606
# Inputs          : $fe     - Package Entry 
-
 
607
#
-
 
608
# Returns         : Undef if not found
-
 
609
#                   Path to the packages interface directory
-
 
610
#
-
 
611
sub getpkgInterface
-
 
612
{
-
 
613
    my ($fe) = @_;
-
 
614
 
-
 
615
    #
-
 
616
    #   Determine the packages 'interface' directory
-
 
617
    #
-
 
618
    my $pSuffix = ($fe->{prj}) ? ( '.' . $fe->{prj}) : '';
-
 
619
    my $ifaceDir = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', $fe->{name}, 'sandbox' . $pSuffix . '.int');
-
 
620
    return unless -f $ifaceDir; 
-
 
621
    $ifaceDir = TagFileRead($ifaceDir);
-
 
622
    $ifaceDir =~ s~\\~/~g;
-
 
623
    $ifaceDir =~ s~GBE_SANDBOX/~$GBE_SANDBOX/~;
-
 
624
    return $ifaceDir; 
-
 
625
}
-
 
626
 
355
 
627
 
356
#-------------------------------------------------------------------------------
628
#-------------------------------------------------------------------------------
357
# Function        : calc_sandbox_info
629
# Function        : calc_sandbox_info
358
#
630
#
359
# Description     : Examine the sandbox and determine all the important
631
# Description     : Examine the sandbox and determine all the important
Line 363... Line 635...
363
#                       $opt_toPackage
635
#                       $opt_toPackage
364
#                       $opt_fromPackage
636
#                       $opt_fromPackage
365
#                       @opt_justPackage
637
#                       @opt_justPackage
366
#                       @opt_ignorePackage
638
#                       @opt_ignorePackage
367
#
639
#
368
# Inputs          : info                - True: Just for info
640
# Inputs          : quiet       undef - noisy
369
#                                               Keep supressed packages
641
#                               1 - quiet           
370
#
642
#
371
# Returns         : Will exit if not in a sandbox
643
# Returns         : Will exit if not in a sandbox
372
#                   Populates global variables
644
#                   Populates global variables
373
#                       @build_order - build ordered array of build entries
645
#                       @build_order - build ordered array of build entries
374
#
646
#
375
sub calc_sandbox_info
647
sub calc_sandbox_info
376
{
648
{
377
    my ($info) = @_;
649
    my ($quiet) = @_;
378
 
-
 
-
 
650
    my $cacheFile = $GBE_DPKG_SBOX . '/location_cache';
379
    #
651
    #
380
    #   Start from the root of the sandbox
652
    #   Start from the root of the sandbox
381
    #
653
    #
382
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
654
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
-
 
655
    my $startDir = Getcwd();
383
    chdir ($GBE_SANDBOX) || Error ("Cannot chdir to $GBE_SANDBOX");
656
    chdir ($GBE_SANDBOX) || Error ("Cannot chdir to $GBE_SANDBOX");
384
 
657
 
385
    #
658
    #
-
 
659
    #   Retain subdir so we can figure out a starting package
-
 
660
    # 
-
 
661
    $startDir = '' unless ($startDir =~ s~^$GBE_SANDBOX/~~);
-
 
662
 
-
 
663
    #
386
    #   Locate all packages within the sandbox
664
    #   Locate all packages within the sandbox
387
    #   These will be top-level directories - one per package
665
    #   These will be top-level directories - one per package
388
    #
666
    #
389
    my @dirlist;
-
 
390
    my @build_list;
667
    my @build_list;
-
 
668
    my $currentRootFingerPrint = calc_rootFingerPrint();
-
 
669
 
391
    foreach my $pname ( glob("*") )
670
    if (-f $cacheFile && !$opt_reScan) 
392
    {
671
    {
-
 
672
        #
393
        next if ( $pname =~ m~^\.~ );
673
        #   Read in the location cache
394
        next if ( $pname =~ m~dpkg_archive$~ );
674
        #   Greatly speeds up the location process
-
 
675
        #
-
 
676
        open( my $lf, '<', $cacheFile) || Error ("Read error: $cacheFile. $!");
-
 
677
 
-
 
678
        #
395
        next if ( $pname =~ m~^CVS$~ );
679
        #   Check root directory signature
-
 
680
        #       Has the user added or removed packages from the sandbox
-
 
681
        #
396
        next unless ( -d $pname );
682
        my $rootFingerPrint = <$lf>;
397
        Verbose ("Package discovered: $pname");
683
        $rootFingerPrint =~ s~\s*$~~;
398
 
684
 
399
        if ( -f "$pname/stop" || -f "$pname/stop.$GBE_MACHTYPE" )
685
        if ($rootFingerPrint eq $currentRootFingerPrint )
400
        {
686
        {
-
 
687
            while (<$lf>)
-
 
688
            {
-
 
689
                my @locationEntry = split($;, $_);
-
 
690
                my $pname = $locationEntry[0];
-
 
691
 
-
 
692
                #
-
 
693
                #   Locate the build files in each package
-
 
694
                #   Scan the build files and extract dependancy information
-
 
695
                #
-
 
696
                my $bscanner = BuildFileScanner( $pname, 'build.pl',
-
 
697
                                                         '--LocateAll',
-
 
698
                                                         '--LimitDepth=3',
-
 
699
                                                         '--ScanDependencies' );
-
 
700
                unless ($bscanner->setLocation($_)) {
-
 
701
                    Verbose("Build file missing: Force full scan");
-
 
702
                    @build_list = ();
-
 
703
                    last;
-
 
704
                }
401
            push @stopped, $pname;
705
                $bscanner->scan();
-
 
706
                my @blist = $bscanner->getInfo();
-
 
707
                unless ($quiet) {
402
            Warning("Package contains stop file: $pname");
708
                    Warning ("Package does not have build files: $pname") unless ( @blist );
-
 
709
                    Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
403
            next;
710
                }
-
 
711
                push @build_list, @blist;
-
 
712
            }
404
        }
713
        }
-
 
714
        close $lf;
-
 
715
    }
-
 
716
 
-
 
717
    unless (@build_list)
-
 
718
    {
-
 
719
        Message ("Scanning sandbox for build files");
-
 
720
        FileCreate($cacheFile, $currentRootFingerPrint );
405
 
721
 
-
 
722
        my @locationData;
-
 
723
        foreach my $pname ( glob("*") )
-
 
724
        {
-
 
725
            next if ( $pname =~ m~^\.~ );
-
 
726
            next if ( $pname =~ m~dpkg_archive$~ );
-
 
727
            next if ( $pname =~ m~^CVS$~ );
-
 
728
            next unless ( -d $pname );
-
 
729
            Verbose ("Package discovered: $pname");
-
 
730
 
-
 
731
            if ( -f "$pname/stop" || -f "$pname/stop.$GBE_MACHTYPE" )
-
 
732
            {
406
        push @dirlist, $pname;
733
                push @stopped, $pname;
-
 
734
                Warning("Package contains stop file: $pname");
-
 
735
                next;
-
 
736
            }
-
 
737
 
-
 
738
            #
-
 
739
            #   Locate the build files in each package
-
 
740
            #   Scan the build files and extract dependancy information
-
 
741
            #
-
 
742
            my $bscanner = BuildFileScanner( $pname, 'build.pl',
-
 
743
                                                     '--LocateAll',
-
 
744
                                                     '--LimitDepth=3',
-
 
745
                                                     '--ScanDependencies' );
-
 
746
            $bscanner->scan();
-
 
747
            my @blist = $bscanner->getInfo();
-
 
748
            unless ($quiet) {
-
 
749
                Warning ("Package does not have build files: $pname") unless ( @blist );
-
 
750
                Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
-
 
751
            }
-
 
752
            push @build_list, @blist;
-
 
753
            push @locationData, $bscanner->getLocation();
-
 
754
        }
407
 
755
 
408
        #
756
        #
409
        #   Locate the build files in each package
-
 
410
        #   Scan the build files and extract dependancy information
757
        #   Save (cache) location information
411
        #
758
        #
412
        my $bscanner = BuildFileScanner( $pname, 'build.pl',
-
 
413
                                                 '--LocateAll',
-
 
414
                                                 $opt_exact ? '--ScanExactDependencies' : '--ScanDependencies' );
-
 
415
        $bscanner->scan();
-
 
416
        my @blist = $bscanner->getInfo();
759
        FileAppend($cacheFile, @locationData);
417
        Warning ("Package does not have build files: $pname") unless ( @blist );
-
 
418
        Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
-
 
419
        push @build_list, @blist;
-
 
420
    }
760
    }
421
 
761
 
422
    #
762
    #
423
    #   Process each build file and extract
763
    #   Process each build file and extract
424
    #       Name of the Package
764
    #       Name of the Package
Line 463... Line 803...
463
    ErrorDoExit();
803
    ErrorDoExit();
464
 
804
 
465
#DebugDumpData ("depends", \%depends );
805
#DebugDumpData ("depends", \%depends );
466
 
806
 
467
    #
807
    #
468
    #   Determine the build order
-
 
469
    #
-
 
470
    @build_order = ();
-
 
471
    my $more = 1;
-
 
472
    my $level = 0;
-
 
473
 
-
 
474
    #
-
 
475
    #   Remove any dependencies to 'external' packages
808
    #   Remove any dependencies to 'external' packages
476
    #   These will not be met internally and can be regarded as constant
809
    #   These will not be met internally and can be regarded as constant
477
    #
810
    #
478
    #   Split 'depends' into internal (ideps) and external (edeps)
811
    #   Split 'depends' into internal (ideps) and external (edeps)
479
    #       edeps : External Dependencies
812
    #       edeps : External Dependencies
Line 500... Line 833...
500
        }
833
        }
501
    }
834
    }
502
 
835
 
503
#DebugDumpData ("depends", \%depends );
836
#DebugDumpData ("depends", \%depends );
504
 
837
 
505
 
-
 
506
    #
838
    #
507
    #   Determine package build order
839
    #   Determine package build order
508
    #       Scan the list of packages in the build set and determine
840
    #       Scan the list of packages in the build set and determine
509
    #       those with no dependencies. These can be built.
841
    #       those with no dependencies. These can be built.
510
    #       Remove those packages as dependents from all packages
842
    #       Remove those packages as dependents from all packages
511
    #       Repeat.
843
    #       Repeat.
512
    #
844
    #
-
 
845
    #
-
 
846
    #   Determine the build order
-
 
847
    #
-
 
848
    @build_order = ();
-
 
849
    my $more = 1;
-
 
850
    my $level = 0;
513
    my %found    = map { $_ => 1 } @opt_ignorePackage;
851
    my %found    = map { $_ => 1 } @opt_ignorePackage;
514
    my %notFound = map { $_ => 1 } @opt_justPackage;
852
    my %notFound = map { $_ => 1 } @opt_justPackage;
515
    my $scan_start = 0;
853
    my $scan_start = 0;
516
    my $scan_stop = 0;
854
    my $scan_stop = 0;
517
    my $scan_active = ($opt_fromPackage) ? 0 : 1;
855
    my $scan_active = ($opt_fromPackage) ? 0 : 1;
Line 524... Line 862...
524
        my @build;
862
        my @build;
525
 
863
 
526
        #
864
        #
527
        #   Locate packages with no dependencies
865
        #   Locate packages with no dependencies
528
        #
866
        #
529
        foreach my $key ( keys %depends )
867
        foreach my $key ( sort {lc($a) cmp lc($b)} keys %depends )
530
        {
868
        {
531
            next if ( keys( %{$depends{$key}{depends}} ) );
869
            next if ( keys( %{$depends{$key}{depends}} ) );
532
            push @build, $key;
870
            push @build, $key;
533
        }
871
        }
534
 
872
 
Line 574... Line 912...
574
                        delete $found{$pname};
912
                        delete $found{$pname};
575
                    }
913
                    }
576
                }
914
                }
577
            }
915
            }
578
 
916
 
-
 
917
            #
-
 
918
            #   Test for a skip marker
-
 
919
            #
-
 
920
            my $skipFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', '_skip.'. $fe->{dname});
-
 
921
            my $skipMachFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', '_skip.' . $GBE_MACHTYPE . '.' . $fe->{dname});
-
 
922
            if ( -f $skipFile || -f $skipMachFile )
-
 
923
            {
-
 
924
                Warning("Package marked for skip: $fe->{dname}, $fe->{dir}") unless $quiet;
-
 
925
                $scan_add = 0;
-
 
926
                $fe->{buildSkip} = 1;
-
 
927
            }
-
 
928
 
579
            $fe->{level} = $level;
929
            $fe->{level} = $level;
580
            $fe->{buildActive} = $scan_add;
930
            $fe->{buildActive} = $scan_add;
581
            $packages{$build} = $fe;
931
            $packages{$build} = $fe;
582
            push (@build_order, $fe) if ( $scan_add || $info );
932
            push (@build_order, $fe);
583
            delete $depends{$build};
933
            delete $depends{$build};
584
            delete $fe->{depends};                          # remove now its not needed
934
            delete $fe->{depends};                          # remove now its not needed
585
        }
935
        }
586
 
936
 
587
        foreach my $key ( keys %depends )
937
        foreach my $key ( keys %depends )
Line 601... Line 951...
601
    ReportError ("Specified ExactPackages not found: ", keys( %notFound) ) if ( %notFound );
951
    ReportError ("Specified ExactPackages not found: ", keys( %notFound) ) if ( %notFound );
602
    ReportError ("Specified IgnorePackages not found: ", keys( %found) ) if ( %found );
952
    ReportError ("Specified IgnorePackages not found: ", keys( %found) ) if ( %found );
603
    ErrorDoExit();
953
    ErrorDoExit();
604
 
954
 
605
    #
955
    #
-
 
956
    #   Just to be sure to be sure
-
 
957
    #
-
 
958
    if ( keys %depends )
-
 
959
    {
-
 
960
        #DebugDumpData ("depends", \%depends );
-
 
961
        Error( "Internal algorithm error: Bad dependancy walk",
-
 
962
               "Possible circular dependency");
-
 
963
    }
-
 
964
 
-
 
965
    #
-
 
966
    #   Determine FULL internal dependency list for each package
-
 
967
    #       Walk packages in build order so that we can leverage the calculations
-
 
968
    #       already done.
-
 
969
    # 
-
 
970
    foreach my $fe ( @build_order )
-
 
971
    {
-
 
972
        my @pkgBuildOrder;
-
 
973
        my %pkgSeen;
-
 
974
        my $key = $fe->{tag};
-
 
975
        if (exists $packages{$key}{'ideps'})
-
 
976
        {
-
 
977
            foreach ( keys %{$packages{$key}{'ideps'}} )
-
 
978
            {
-
 
979
                foreach my $ikey (@{$packages{$_}{'AllIdepsOrder'}})
-
 
980
                {
-
 
981
                    push @pkgBuildOrder, $ikey unless $pkgSeen{$ikey};
-
 
982
                    $pkgSeen{$ikey} = 1;
-
 
983
                }
-
 
984
            }
-
 
985
        }
-
 
986
        push @pkgBuildOrder, $key;
-
 
987
        $fe->{'AllIdepsOrder'} = \@pkgBuildOrder;
-
 
988
 
-
 
989
        #
-
 
990
        #   Is this package in the current directory
-
 
991
        #
-
 
992
        if ($startDir)
-
 
993
        {
-
 
994
            my $matchBase = $startDir . '/'; 
-
 
995
            if ($matchBase =~ m~^$fe->{dir}/~)
-
 
996
            {
-
 
997
                $fe->{buildCurrent} = 1;
-
 
998
                $currentPkgTag = $key;
-
 
999
            }
-
 
1000
        }
-
 
1001
    }
-
 
1002
 
-
 
1003
    #
-
 
1004
    #   Now that we have a full dependency list for each package we can calculate a full
-
 
1005
    #   usage list. This is a complete list of all package that depend on a package both directly 
-
 
1006
    #   and inderectly. Useful for regression testing
-
 
1007
    #   
-
 
1008
    foreach my $fe ( @build_order )
-
 
1009
    {
-
 
1010
        foreach my $itag (@{$fe->{'AllIdepsOrder'}})
-
 
1011
        {
-
 
1012
            next if ($itag eq $fe->{tag});
-
 
1013
            push @{$packages{$itag}{usedBy}}, $fe->{tag};
-
 
1014
        }
-
 
1015
    }
-
 
1016
 
-
 
1017
    #
-
 
1018
    #   If the CWD is within a package then limit the build to that package and
-
 
1019
    #   its dependents, unless user specifies entire sandbox.
-
 
1020
    #   
-
 
1021
    if ($currentPkgTag && ! $opt_allSandbox )
-
 
1022
    {
-
 
1023
        if (!$opt_processUsedBy )
-
 
1024
        {
-
 
1025
            #
-
 
1026
            #   Reform the build_order to reflect the current sandbox
-
 
1027
            #   The @build_order is an array of package entries
-
 
1028
            #   The per-package build order is an array of keys
-
 
1029
            #
-
 
1030
            my @pkgOrder;
-
 
1031
            foreach ( @{$packages{$currentPkgTag}{AllIdepsOrder}})
-
 
1032
            {
-
 
1033
                push @pkgOrder,  $packages{$_} ;
-
 
1034
            }
-
 
1035
 
-
 
1036
            # Reform the build order based on original level
-
 
1037
            #   Simply done to look pretty - and be consistient when compared with the entire sandbox
-
 
1038
            @build_order = sort {$a->{level} <=> $b->{level}} @pkgOrder;
-
 
1039
 
-
 
1040
        }
-
 
1041
        else
-
 
1042
        {
-
 
1043
            #
-
 
1044
            #   Reform the build order to reflect the consumers of the current package
-
 
1045
            #   This does not include the current package. The assumption is that the package
-
 
1046
            #   has been built. 
-
 
1047
            #
-
 
1048
            #   The @build_order is an array of package entries
-
 
1049
            #   The per-package build order is an array of keys
-
 
1050
            #
-
 
1051
            my @pkgOrder;
-
 
1052
            foreach ( @{$packages{$currentPkgTag}{'usedBy'}})
-
 
1053
            {
-
 
1054
                push @pkgOrder,  $packages{$_} ;
-
 
1055
            }
-
 
1056
 
-
 
1057
            # Reform the build order based on original level
-
 
1058
            #   Simply done to look pretty - and be consistient when compared with the entire sandbox
-
 
1059
            @build_order = sort {$a->{level} <=> $b->{level}} @pkgOrder;
-
 
1060
        }
-
 
1061
    }
-
 
1062
    else
-
 
1063
    {
-
 
1064
        $opt_allSandbox = 1;
-
 
1065
    }
-
 
1066
 
-
 
1067
    #
606
    #   Calculate the external dependencies
1068
    #   Calculate the external dependencies
607
    #       Only process packages that are a part of the build
1069
    #       Only process packages that are a part of the build
608
    #
1070
    #
609
    #   extern_deps structure
1071
    #   extern_deps structure
610
    #       Hash key: 'tag'   - Index into packages
1072
    #       Hash key: 'tag'   - Index into packages
Line 612... Line 1074...
612
    #                 Key  : Name;Version
1074
    #                 Key  : Name;Version
613
    #                 Value: Array of: 'tags' (Index into packages)
1075
    #                 Value: Array of: 'tags' (Index into packages)
614
    #                                   of packages that use the external
1076
    #                                   of packages that use the external
615
    #                                   component.
1077
    #                                   component.
616
    {
1078
    {
617
        Verbose ("Calculate external dependencies");
1079
        Verbose ("Calculate external dependencies on packages in build");
618
        %extern_deps = ();
1080
        %extern_deps = ();
619
 
1081
 
620
        foreach my $key ( keys %packages )
1082
        foreach my $pe (@build_order)
621
        {
1083
        {
622
                next unless ( $packages{$key}{buildActive} );
1084
                next unless ( $pe->{buildActive} );
623
                next unless ( $packages{$key}{'edeps'} );
1085
                next unless ( $pe->{'edeps'} );
624
                foreach ( keys %{$packages{$key}{'edeps'}} )
1086
                foreach ( keys %{$pe->{'edeps'}} )
625
                {
1087
                {
626
                    push @{$extern_deps{$packages{$key}{'edeps'}{$_}} {$_} }, $key;
1088
                    push @{$extern_deps{$pe->{'edeps'}{$_}} {$_} }, $pe->{tag};
627
                }
1089
                }
628
        }
1090
        }
629
    }
1091
    }
630
 
1092
 
631
    #
-
 
632
    #   Just to be sure to be sure
-
 
633
    #
-
 
634
    if ( keys %depends )
-
 
635
    {
-
 
636
        #DebugDumpData ("depends", \%depends );
-
 
637
        Error( "Internal algorithm error: Bad dependancy walk",
-
 
638
               "Possible circular dependency");
-
 
639
    }
-
 
640
 
1093
 
641
#   DebugDumpData("Packages", \%packages);
1094
#   DebugDumpData("Packages", \%packages);
642
#   DebugDumpData ("Order", \@build_order);
1095
#   DebugDumpData ("Order", \@build_order);
643
#   DebugDumpData("External Depends", \%extern_deps );
1096
#   DebugDumpData("External Depends", \%extern_deps );
644
}
1097
}
645
 
1098
 
646
#-------------------------------------------------------------------------------
1099
#-------------------------------------------------------------------------------
-
 
1100
# Function        : calc_rootFingerPrint 
-
 
1101
#
-
 
1102
# Description     : Calculate a finger print of all the directories in the
-
 
1103
#                   sandbox root.
-
 
1104
#                   
-
 
1105
#                   Used to determine if the user has added or remove a package
-
 
1106
#                   from the sandbox
-
 
1107
#
-
 
1108
# Inputs          : None
-
 
1109
#
-
 
1110
# Returns         : SHA1 hash
-
 
1111
#
-
 
1112
sub calc_rootFingerPrint
-
 
1113
{
-
 
1114
    my $fpSha1 = Digest->new("SHA-1");
-
 
1115
 
-
 
1116
    foreach my $pname ( glob("*") )
-
 
1117
    {
-
 
1118
        next if ( $pname =~ m~^\.~ );
-
 
1119
        next if ( $pname =~ m~dpkg_archive$~ );
-
 
1120
        next if ( $pname =~ m~^CVS$~ );
-
 
1121
        next unless ( -d $pname );
-
 
1122
 
-
 
1123
        $fpSha1->add($pname);
-
 
1124
 
-
 
1125
        #
-
 
1126
        #   Include stop files in fingerprint too
-
 
1127
        #
-
 
1128
        $fpSha1->add("$pname/stop" ) if ( -f "$pname/stop" ); 
-
 
1129
        $fpSha1->add("$pname/stop.$GBE_MACHTYPE" ) if ( -f "$pname/stop.$GBE_MACHTYPE" ); 
-
 
1130
 
-
 
1131
    }
-
 
1132
    return $fpSha1->hexdigest;
-
 
1133
}
-
 
1134
 
-
 
1135
#-------------------------------------------------------------------------------
647
# Function        : cmd
1136
# Function        : cmd
648
#
1137
#
649
# Description     : Execute a command in all the sandboxes
1138
# Description     : Execute a command in all the sandboxes
650
#                       Locate the base of the sandbox
1139
#                       Locate the base of the sandbox
651
#                       Locate all packages in the sandbox
1140
#                       Locate all packages in the sandbox
Line 658... Line 1147...
658
# Returns         : Will exit
1147
# Returns         : Will exit
659
#
1148
#
660
sub cmd
1149
sub cmd
661
{
1150
{
662
    my ($hcmd, @cmd_opts ) = @_;
1151
    my ($hcmd, @cmd_opts ) = @_;
663
    my $opt_keepgoing;
-
 
664
 
1152
 
665
    Getopt::Long::Configure('pass_through');
1153
    Getopt::Long::Configure('pass_through');
666
    getOptionsFromArray ( \@cmd_opts,
-
 
667
                           'keepgoing!'  => \$opt_keepgoing,
-
 
668
                        ) || Error ("Invalid command line" );
1154
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
669
    SubCommandHelp( $opt_help, $hcmd) if ($opt_help  );
1155
    SubCommandHelp( $opt_help, $hcmd) if ($opt_help  );
670
 
1156
 
671
    #
1157
    #
672
    #   Determine Sandbox information
1158
    #   Determine Sandbox information
673
    #   Populate global variables
1159
    #   Populate global variables
674
    #
1160
    #
675
    calc_sandbox_info();
1161
    calc_sandbox_info();
676
    foreach my $fe ( @build_order )
1162
    foreach my $fe ( @build_order )
677
    {
1163
    {
678
        my $dir = $fe->{dir};
-
 
679
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
-
 
680
                  DisplayPath ("        Path: $fe->{dir}" ));
1164
        my $active = displayHeader($fe, { showPath => 1 });
681
 
1165
 
-
 
1166
        if ($active)
-
 
1167
        {
-
 
1168
            my $dir = $fe->{dir};
682
        my $result = JatsCmd( "-cd=$dir", @cmd_opts);
1169
            my $result = JatsCmd( "-cd=$dir", @cmd_opts);
683
        if ( $result ) {
1170
            if ( $result ) {
684
            if ( $opt_keepgoing ) {
1171
                if ( $opt_keepgoing ) {
685
                Warning ("Cmd failure");
1172
                    Warning ("Cmd failure");
686
            } else {
1173
                } else {
687
                Error   ("Cmd failure");
1174
                    Error   ("Cmd failure");
-
 
1175
                }
688
            }
1176
            }
689
        }
1177
        }
690
    }
1178
    }
691
 
1179
 
692
    exit 0;
1180
    exit 0;
Line 709... Line 1197...
709
sub buildcmd
1197
sub buildcmd
710
{
1198
{
711
    my ($cmd, @cmd_opts) = @_;
1199
    my ($cmd, @cmd_opts) = @_;
712
    my @build_opts;
1200
    my @build_opts;
713
    my @make_opts;
1201
    my @make_opts;
-
 
1202
    my $opt_skip = 1;
-
 
1203
    my $opt_clean = 0;
714
 
1204
 
715
    #
1205
    #
716
    #   Extract and options
1206
    #   Extract and options
717
    #
1207
    #
718
    Getopt::Long::Configure('pass_through');
1208
    Getopt::Long::Configure('pass_through');
-
 
1209
    getOptionsFromArray ( \@cmd_opts,
-
 
1210
                          'skip!' => \$opt_skip,
-
 
1211
                          'clean!' => \$opt_clean,
719
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
1212
    ) || Error ("Invalid command line" );
720
    SubCommandHelp( $opt_help, "Command $cmd") if ($opt_help );
1213
    SubCommandHelp( $opt_help, "Command $cmd") if ($opt_help );
721
 
1214
 
722
    #
1215
    #
723
    #   Insert default options
1216
    #   Insert default options
724
    #
1217
    #
725
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
1218
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
726
    push @build_opts, '-force' if ( $cmd ne 'all' );
1219
    push @build_opts, '-force'   if ( $cmd ne 'all' );
727
 
1220
 
728
    #
1221
    #
729
    #   Attempt to split the options into build and make options
1222
    #   Attempt to split the options into build and make options
730
    #   Only handle the often used options to build.
1223
    #   Only handle the often used options to build.
731
    #
1224
    #
Line 736... Line 1229...
736
        } else {
1229
        } else {
737
            push @make_opts, $_;
1230
            push @make_opts, $_;
738
        }
1231
        }
739
    }
1232
    }
740
 
1233
 
741
    push @make_opts, 'all'  unless ( @make_opts  );
1234
    push @make_opts, 'all'  unless ( @make_opts );
742
 
1235
 
743
    #
1236
    #
744
    #   Determine Sandbox information
1237
    #   Determine Sandbox information
745
    #   Populate global variables
1238
    #   Populate global variables
746
    #
1239
    #
747
    calc_sandbox_info();
1240
    calc_sandbox_info();
748
    foreach my $fe ( @build_order )
1241
    foreach my $fe ( @build_order )
749
    {
1242
    {
-
 
1243
        my $active = displayHeader($fe, { showPath => 1 });
-
 
1244
        if ($active) {
-
 
1245
 
-
 
1246
            #
-
 
1247
            #   Determine build success tag file
-
 
1248
            #   If the tag file exists, then see if any files in the files in the package source are more
-
 
1249
            #   recent than the tag file
-
 
1250
            #
-
 
1251
            my $mustBuild = 1;
-
 
1252
            my $sigMatch = 0;
-
 
1253
            my $tagFile = getPkgFingerPrintFile($fe);
-
 
1254
 
-
 
1255
            if ( -e $tagFile ) {
-
 
1256
                if ( TagFileMatch($tagFile, genPkgFingerPrint($fe, 'Test')) ) {
-
 
1257
                    $sigMatch = 1;
-
 
1258
                    if ($opt_skip) {
-
 
1259
                        $mustBuild = 0;
-
 
1260
                    } else {
-
 
1261
                        $mustBuild = 2;
-
 
1262
                    }
-
 
1263
                } else {
-
 
1264
                }
-
 
1265
            } else {
-
 
1266
                    $mustBuild = 2;
-
 
1267
                    $sigMatch = -1;
-
 
1268
            }
-
 
1269
 
-
 
1270
#Debug0("Skip: $opt_skip, sigMatch: $sigMatch, Build: $mustBuild, Opts: @make_opts",);
-
 
1271
            if ($mustBuild)
-
 
1272
            {
-
 
1273
                if (1)
-
 
1274
                {
-
 
1275
                    unlink $tagFile;
750
        my $dir = $fe->{dir};
1276
                    my $dir = $fe->{dir};
-
 
1277
                    my $result;
-
 
1278
 
-
 
1279
                    $result = JatsCmd( "-cd=$dir", 'build', @build_opts);
-
 
1280
                    if ($result)
-
 
1281
                    {
-
 
1282
                        if ($opt_keepgoing)
-
 
1283
                        {
751
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
1284
                            Warning( "Build Cmd failure - Keep going");
-
 
1285
                            next;
-
 
1286
                        }
752
                  DisplayPath ("        Path: $fe->{dir}" ));
1287
                        Error ("Build Cmd failure");
-
 
1288
                    }
-
 
1289
 
-
 
1290
                    #
-
 
1291
                    #   Skip make if we have a prebuilt package
-
 
1292
                    #
-
 
1293
                    my $mustMake = 1;
753
 
1294
 
-
 
1295
                    if ($mustMake)
-
 
1296
                    {
-
 
1297
                        JatsCmd( "-cd=$dir", 'make', 'clean') if $opt_clean;
-
 
1298
                        $result = JatsCmd( "-cd=$dir", 'make',  @make_opts);
-
 
1299
                        if ($result)
-
 
1300
                        {
-
 
1301
                            if ($opt_keepgoing)
-
 
1302
                            {
754
        JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
1303
                                Warning( "Make Cmd failure - Keep going");
-
 
1304
                                next;
-
 
1305
                            }
755
        JatsCmd( "-cd=$dir", 'make',  @make_opts)  && Error ("Make Cmd failure")  if ( $result );
1306
                            Error ("Make Cmd failure");
-
 
1307
                        }
-
 
1308
                    }
-
 
1309
                }
-
 
1310
 
-
 
1311
                FileCreate( $tagFile, genPkgFingerPrint($fe,'Generation') );
-
 
1312
            }
-
 
1313
            else
-
 
1314
            {
-
 
1315
                Message ("No file changes since last build. Skipping")
-
 
1316
            }
-
 
1317
        }
756
    }
1318
    }
757
 
1319
 
758
    exit 0;
1320
    exit 0;
759
}
1321
}
760
 
1322
 
Line 795... Line 1357...
795
    #
1357
    #
796
    #   Clobber and clean need to be done in the reverse order
1358
    #   Clobber and clean need to be done in the reverse order
797
    #
1359
    #
798
    foreach my $fe ( reverse @build_order )
1360
    foreach my $fe ( reverse @build_order )
799
    {
1361
    {
-
 
1362
        my $active = displayHeader($fe, { showPath => 1 });
-
 
1363
        if ($active)
-
 
1364
        {
800
        my $dir = $fe->{dir};
1365
            my $dir = $fe->{dir};
801
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
1366
            my $result = JatsCmd( "-cd=$dir", @cmd, @cmd_opts);
-
 
1367
            if ($result)
-
 
1368
            {
802
                  DisplayPath ("        Path: $fe->{dir}" ));
1369
                if ($opt_keepgoing)
803
 
-
 
-
 
1370
                {
804
        my $result = JatsCmd( "-cd=$dir", @cmd, @cmd_opts);
1371
                    Warning("Command Failure");
-
 
1372
                }
-
 
1373
                else
-
 
1374
                {
805
        Error ("Cmd failure") if ( $result );
1375
                    Error ("Cmd failure") if ( $result );
-
 
1376
                }
-
 
1377
            }
-
 
1378
        }
806
    }
1379
    }
807
 
1380
 
808
    exit 0;
1381
    exit 0;
809
}
1382
}
810
 
1383
 
Line 828... Line 1401...
828
    #
1401
    #
829
    #   Determine Sandbox information
1402
    #   Determine Sandbox information
830
    #   Populate global variables
1403
    #   Populate global variables
831
    #
1404
    #
832
    Message("Cache External Dependencies");
1405
    Message("Cache External Dependencies");
-
 
1406
    Error ("GBE_DPKG_CACHE not defined") unless $GBE_DPKG_CACHE;
833
    calc_sandbox_info();
1407
    calc_sandbox_info();
834
 
1408
 
-
 
1409
    JatsTool ('cache_dpkg', "core_devl/jats2_current" );
-
 
1410
 
835
    #
1411
    #
836
    #   Walk the list of external dependencies and cache each one
1412
    #   Walk the list of external dependencies and cache each one
837
    #
1413
    #
838
    foreach my $de ( sort keys %extern_deps )
1414
    foreach my $de ( sort keys %extern_deps )
839
    {
1415
    {
Line 1377... Line 1953...
1377
        'verbose:+'         => \$opt_verbose,
1953
        'verbose:+'         => \$opt_verbose,
1378
        'topackage:s'       => \$opt_toPackage,
1954
        'topackage:s'       => \$opt_toPackage,
1379
        'frompackage:s'     => \$opt_fromPackage,
1955
        'frompackage:s'     => \$opt_fromPackage,
1380
        'justpackage:s'     => sub{ opts_add2List( \@opt_justPackage, @_ )},
1956
        'justpackage:s'     => sub{ opts_add2List( \@opt_justPackage, @_ )},
1381
        'ignorepackage:s'   => sub{ opts_add2List( \@opt_ignorePackage, @_ )},
1957
        'ignorepackage:s'   => sub{ opts_add2List( \@opt_ignorePackage, @_ )},
-
 
1958
        'entireSandBox!'    => \$opt_allSandbox,
-
 
1959
        'users!'            => \$opt_processUsedBy,
-
 
1960
        'keepgoing!'        => \$opt_keepgoing,
-
 
1961
        'rescan!'           => \$opt_reScan,
1382
        );
1962
        );
1383
 
1963
 
1384
    #
1964
    #
1385
    #   Merge in the user options
1965
    #   Merge in the user options
1386
    #
1966
    #
Line 1394... Line 1974...
1394
    ErrorConfig('verbose' => $opt_verbose );
1974
    ErrorConfig('verbose' => $opt_verbose );
1395
    return $rv;
1975
    return $rv;
1396
}
1976
}
1397
 
1977
 
1398
#-------------------------------------------------------------------------------
1978
#-------------------------------------------------------------------------------
-
 
1979
# Function        : displayHeader 
-
 
1980
#
-
 
1981
# Description     : Display a build header
-
 
1982
#
-
 
1983
# Inputs          : $fe             - Build entry
-
 
1984
#                   $indent         - Indent text
-
 
1985
#                   $showPath       - Boolean
-
 
1986
#
-
 
1987
# Returns         : True if this entry is to be fully process
-
 
1988
#                   False if its being skipped 
-
 
1989
#
-
 
1990
sub displayHeader
-
 
1991
{
-
 
1992
    my $fe = shift @_;
-
 
1993
    my $args = pop @_ if (@_ > 0 and UNIVERSAL::isa($_[-1],'HASH'));
-
 
1994
    #    my ($fe, %args) = @_;
-
 
1995
 
-
 
1996
    my $indent = $args->{indent} || '';
-
 
1997
    my $showPath = $args->{showPath};
-
 
1998
 
-
 
1999
    my ($status, $estatus) = addBuildInfo($fe, $args);
-
 
2000
 
-
 
2001
    my $msg1 = $indent . 'Level:' . $fe->{level} . " [$status]" . ' Name: ' . $fe->{dname} . $estatus;
-
 
2002
    if ( $showPath) {
-
 
2003
        my $msg1Len = length($msg1);
-
 
2004
        if ($msg1Len < 80) {
-
 
2005
            $msg1 .= ' ' . '=' x (79 - $msg1Len);
-
 
2006
        }
-
 
2007
    }
-
 
2008
    Message( $msg1 ,  $showPath ? DisplayPath ("        Path: $fe->{dir}" ) : undef);
-
 
2009
 
-
 
2010
   return $fe->{buildActive};
-
 
2011
}
-
 
2012
 
-
 
2013
#-------------------------------------------------------------------------------
-
 
2014
# Function        : addBuildInfo 
-
 
2015
#
-
 
2016
# Description     : Add some build info status
-
 
2017
#                   It will have a .sig file if its been sucessfully built
-
 
2018
#
-
 
2019
# Inputs          : $fe     - Package info 
-
 
2020
#
-
 
2021
# Returns         : True - sig file present
-
 
2022
#
-
 
2023
sub addBuildInfo
-
 
2024
{
-
 
2025
    my ($fe, $args) = @_;
-
 
2026
    my $txt = '';
-
 
2027
    my $statusB = ' ';
-
 
2028
    my $statusF = ' ';
-
 
2029
    my $statusS = ' ';
-
 
2030
 
-
 
2031
    unless ($fe->{buildActive}) {
-
 
2032
        $txt .= ($fe->{buildSkip}) ? ' (Build Skipped)' : ' (Build Suppressed)';
-
 
2033
        $statusS = ($fe->{buildSkip}) ? 'S' : 's';
-
 
2034
    }
-
 
2035
 
-
 
2036
    if ($fe->{buildCurrent})
-
 
2037
    {
-
 
2038
        $statusB = '*';
-
 
2039
        $txt .= ' (Current Package)';
-
 
2040
    }
-
 
2041
 
-
 
2042
    my $sigFile = getPkgFingerPrintFile($fe);
-
 
2043
    my $tagFile = $sigFile;
-
 
2044
    if (-f $sigFile)
-
 
2045
    {
-
 
2046
        $sigFile =~ s~ffp$~nob~;
-
 
2047
        if (-f $sigFile) {
-
 
2048
            $txt .= ' [NoBuild]';
-
 
2049
            $statusB = '-';
-
 
2050
#        } elsif (locatePreBuiltPackage($fe)) {
-
 
2051
#            $txt .= ' [PreBuilt]';
-
 
2052
#            $statusB = 'P';
-
 
2053
        } else {
-
 
2054
            $txt .= ' [Built]';
-
 
2055
            $statusB = 'B';
-
 
2056
        }
-
 
2057
 
-
 
2058
        if ($args->{testFingerPrint})
-
 
2059
        {
-
 
2060
            if ( TagFileMatch($tagFile, genPkgFingerPrint($fe, 'Test')) )
-
 
2061
            {
-
 
2062
                $txt .= ' [GoodFinger]';
-
 
2063
                $statusF = 'G';
-
 
2064
            } else {
-
 
2065
                $txt .= ' [BadFinger]';
-
 
2066
                $statusF = 'b';
-
 
2067
            }
-
 
2068
        }
-
 
2069
 
-
 
2070
    }
-
 
2071
    return "$statusS$statusB$statusF", $txt ;
-
 
2072
 
-
 
2073
}
-
 
2074
 
-
 
2075
#-------------------------------------------------------------------------------
1399
# Function        : opts_add2List
2076
# Function        : opts_add2List
1400
#
2077
#
1401
# Description     : Option processing helper
2078
# Description     : Option processing helper
1402
#                   Add comma separated options to an array
2079
#                   Add comma separated options to an array
1403
#                   User can then add items one at a time, or several at once
2080
#                   User can then add items one at a time, or several at once
Line 1419... Line 2096...
1419
        }
2096
        }
1420
    }
2097
    }
1421
}
2098
}
1422
 
2099
 
1423
#-------------------------------------------------------------------------------
2100
#-------------------------------------------------------------------------------
-
 
2101
# Function        : genPkgFingerPrint 
-
 
2102
#
-
 
2103
# Description     : Generate a fingerprint over all files in the packages tree as
-
 
2104
#                   well as the package dependencies
-
 
2105
# 
-
 
2106
#                   Only used to detect changes to files in the subdir
-
 
2107
# 
-
 
2108
#                   This version does not actually generate a fingerprint over
-
 
2109
#                   the data file, rather the metadata of the file. This is much (much)
-
 
2110
#                   faster as there is no file i/o.
-
 
2111
#                   
-
 
2112
#                   It does assume that the file metadata will change if the file is changed
-
 
2113
#                   Will also detect the addition / deletion of files
-
 
2114
#                   
-
 
2115
#                   Note: This siganture is not machine - type safe
-
 
2116
#                         It will vary between machines (windows/Linux/...)
-
 
2117
#
-
 
2118
# Inputs          : $fe            - Package entry of the package to process
-
 
2119
#                   $mode          - Diagnostic: mode
-
 
2120
#
-
 
2121
# Returns         : A SHA1 hash over all the files
-
 
2122
#                   
-
 
2123
#
-
 
2124
sub genPkgFingerPrint
-
 
2125
{
-
 
2126
    my ($fe, $mode) = @_;
-
 
2127
    my $genPkgFingerPrintSha1;
-
 
2128
    my $genPkgFingerPrintCount;
-
 
2129
    my @fpdata;
-
 
2130
 
-
 
2131
    #
-
 
2132
    #   Get the package GbeFiles.cfg file
-
 
2133
    #       This is held in the interface directory and is created during the build
-
 
2134
    #       Since the fingerprint is only genertated AFTER a successful build the file will always
-
 
2135
    #       be available
-
 
2136
    #       
-
 
2137
    #       All we need from this file is a list of Src directories that were discovered during
-
 
2138
    #       the build. Unfortuanatley they are not always below the root of the package.
-
 
2139
    #
-
 
2140
    my $ifaceDir = getpkgInterface($fe);
-
 
2141
    return 0 unless defined $ifaceDir;
-
 
2142
    return 0 unless ToolsetFiles::GetDataFile($ifaceDir); 
-
 
2143
 
-
 
2144
    #
-
 
2145
    #   Generate a list of directories in the package
-
 
2146
    #   This is the root directory and all other Src directories discovered
-
 
2147
    #
-
 
2148
    my @dirList = ToolsetFiles::GetSubTrees($ifaceDir);
-
 
2149
    Error ("Internal:ToolsetFiles::GetDirList for $fe->{dname} not populated" ) unless @dirList;
-
 
2150
 
-
 
2151
    #
-
 
2152
    #   Create the hash
-
 
2153
    #
-
 
2154
    $genPkgFingerPrintSha1 = Digest->new("SHA-1");
-
 
2155
    push @fpdata, $mode;
-
 
2156
 
-
 
2157
    #
-
 
2158
    #   Include all dependent packages in the fingerprint
-
 
2159
    #       We are using the sandbox fingerprint of dependent packages
-
 
2160
    #       This will ensure that a change in a package will ripple through
-
 
2161
    #
-
 
2162
    foreach my $idep ( sort keys %{$fe->{ideps}})
-
 
2163
    {
-
 
2164
        my $ipkg = $packages{$idep};
-
 
2165
        my $tagFile = getPkgFingerPrintFile($ipkg); 
-
 
2166
        my $tag = TagFileRead($tagFile);
-
 
2167
        my $text = "$tagFile: $tag";
-
 
2168
        $genPkgFingerPrintSha1->add($text);
-
 
2169
#Debug0("genPkgFingerPrint: $text, ", $genPkgFingerPrintSha1->clone->hexdigest() );
-
 
2170
        push @fpdata, $text . ':' . $genPkgFingerPrintSha1->clone->hexdigest();
-
 
2171
    }
-
 
2172
    
-
 
2173
    #
-
 
2174
    #   Anonymous sub: findFile wanted function
-
 
2175
    #   Unlike the generation of the package signature, we don't need to
-
 
2176
    #   exclude any files.
-
 
2177
    #
-
 
2178
    my $wanted = sub {
-
 
2179
        my $item = $File::Find::name;
-
 
2180
 
-
 
2181
        #
-
 
2182
        #   Get file info
-
 
2183
        #       Kill of the last access time - not useful
-
 
2184
        #       
-
 
2185
        #       Need to exclude files that change during a null build
-
 
2186
        #           /interface/GbeFiles.cfg
-
 
2187
        #           /build.log
-
 
2188
        #           
-
 
2189
        #       Symlinks present problems.
-
 
2190
        #       Some packages generate symlinks as they create file system images. The
-
 
2191
        #       links are not designed to be interpreted in the context of the current
-
 
2192
        #       computer. As a result.
-
 
2193
        #           Some may be broken - on the current machine
-
 
2194
        #           Some may address files that change - ie: /proc, /var, /dev
-
 
2195
        #           Some may address files that such as /afc, /root
-
 
2196
        #       Don't want to discard all symlinks. Many of them will address package
-
 
2197
        #       dependencies and we do want to detect changes, but those changes will
-
 
2198
        #       be picked up by the packages fingerprint.
-
 
2199
        #       
-
 
2200
        #       Directories also appear to be a problem
-
 
2201
        #       The created and modified date-times appear to be modified for no good reason
-
 
2202
        #       
-
 
2203
        #       Current solution: Do not include 'stat' data for ANY symlink or directory
-
 
2204
        #
-
 
2205
        my @data = stat($item);
-
 
2206
        my $text;
-
 
2207
        if ( $item =~ m~/build.log$~ || $item =~ m~/GbeFiles.cfg$~) {
-
 
2208
            $text = "$item : SKIPPED FILE : ";
-
 
2209
 
-
 
2210
        }  elsif (-d $item ) {
-
 
2211
                $text = "$item : DIRECTORY"
-
 
2212
        }  elsif (-l $item ) {
-
 
2213
            if ( ! @data) {
-
 
2214
                $text = "$item : BROKEN SYMLINK : ";
-
 
2215
            } else {
-
 
2216
                my $linkTarget = readlink($item) || 'Read Error';
-
 
2217
                $text = "$item :SYMLINK: $linkTarget";
-
 
2218
            }
-
 
2219
 
-
 
2220
        } else {
-
 
2221
            $data[8] = 0;               # atime - will change
-
 
2222
            $data[12] = '-';            # blocks - seen to change for unknown reasons
-
 
2223
            $text = "$item : @data";
-
 
2224
        }
-
 
2225
        $genPkgFingerPrintCount++;
-
 
2226
        $genPkgFingerPrintSha1->add($text);
-
 
2227
#Debug0("genPkgFingerPrint: $text, ", $genPkgFingerPrintSha1->clone->hexdigest() );
-
 
2228
        push @fpdata, $text . ':' . $genPkgFingerPrintSha1->clone->hexdigest();
-
 
2229
    };
-
 
2230
 
-
 
2231
    #
-
 
2232
    #   Process all files in the package
-
 
2233
    #
-
 
2234
    $genPkgFingerPrintCount = 0;
-
 
2235
    my $dir = $fe->{dir};
-
 
2236
    File::Find::find( { wanted => $wanted , no_chdir => 1}, @dirList );
-
 
2237
#Debug0("genPkgFingerPrint: $dir, $genPkgFingerPrintCount, ", $genPkgFingerPrintSha1->clone->hexdigest() );
-
 
2238
    push @fpdata, $dir . ':'. $genPkgFingerPrintCount . ':' . $genPkgFingerPrintSha1->clone->hexdigest();
-
 
2239
 
-
 
2240
    #
-
 
2241
    #   Debugging - delete later
-
 
2242
    #   Save FP data to a file
-
 
2243
    #
-
 
2244
#   my $fpDebugFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', $fe->{name} . '.' . $fe->{prj} . '_' . time() . '.fpd');
-
 
2245
#   Debug0("fpDebugFile: $fpDebugFile");
-
 
2246
#   FileCreate($fpDebugFile, @fpdata);
-
 
2247
 
-
 
2248
    return $genPkgFingerPrintSha1->hexdigest;
-
 
2249
}
-
 
2250
 
-
 
2251
 
-
 
2252
#-------------------------------------------------------------------------------
-
 
2253
# Function        : getPkgFingerPrintFile 
-
 
2254
#
-
 
2255
# Description     : Return the package file that contains the packages Fast Finger Print
-
 
2256
#
-
 
2257
# Inputs          : $fe     - Package entry 
-
 
2258
#
-
 
2259
# Returns         : Full path to the packages fingerprint tag file
-
 
2260
#
-
 
2261
sub getPkgFingerPrintFile
-
 
2262
{
-
 
2263
    my ($fe) = @_;
-
 
2264
    my $tagFile = catdir($GBE_SANDBOX, 'sandbox_dpkg_archive', $fe->{name}, 'sandbox.' . $fe->{prj} . '.ffp');
-
 
2265
    return $tagFile;
-
 
2266
}
-
 
2267
 
-
 
2268
 
-
 
2269
#-------------------------------------------------------------------------------
1424
# Function        : SubCommandHelp
2270
# Function        : SubCommandHelp
1425
#
2271
#
1426
# Description     : Provide help on a subcommand
2272
# Description     : Provide help on a subcommand
1427
#
2273
#
1428
# Inputs          : $help_level             - Help Level 1,2,3
2274
# Inputs          : $help_level             - Help Level 1,2,3
Line 1490... Line 2336...
1490
 Options for recursion control:
2336
 Options for recursion control:
1491
    -toPackage=name            - Stop building after package
2337
    -toPackage=name            - Stop building after package
1492
    -fromPackage=name          - Start building from package
2338
    -fromPackage=name          - Start building from package
1493
    -justPackage=name[,name]   - Build named packages
2339
    -justPackage=name[,name]   - Build named packages
1494
    -ignorePackage=name[,name] - Do not build named packages
2340
    -ignorePackage=name[,name] - Do not build named packages
-
 
2341
    -entireSandbox             - Process the entire sandbox
-
 
2342
    -users                     - Process package users, not dependencies
-
 
2343
    -[no]keepgoing             - Ignore errors
-
 
2344
    -[no]reScan                - Recalculate and cache sandbox structure
1495
 
2345
 
1496
 Commands:
2346
 Commands:
1497
    help                - Same as -help
2347
    help                - Same as -help
1498
    create              - Create a sandbox in the current directory
2348
    create              - Create a sandbox in the current directory
1499
    populate            - Populate the sandbox with packages
2349
    populate            - Populate the sandbox with packages
1500
    delete              - Delete the sandbox
2350
    delete              - Delete the sandbox
1501
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
2351
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
1502
    buildfilter         - Modify and display sandbox buildfilter
2352
    buildfilter         - Modify and display sandbox buildfilter
-
 
2353
    [un]skip            - Mark a package to be skipped during the build
-
 
2354
    fingerprint         - Various fingerprint operations
1503
    cmd                 - Do commands in all sandbox components
2355
    cmd                 - Do commands in all sandbox components
1504
    all                 - Do 'build', if required, then a make in all components
2356
    all                 - Do 'build', if required, then a make in all components
1505
    build               - Force 'build and make' in all sandbox components
2357
    build               - Force 'build and make' in all sandbox components
1506
    make                - Do 'make' in all sandbox components
2358
    make                - Do 'make' in all sandbox components
1507
    clean               - Do 'make clean' in all sandbox components
2359
    clean               - Do 'make clean' in all sandbox components
Line 1597... Line 2449...
1597
 
2449
 
1598
The exclusion of a package takes precedence over its inclusion.
2450
The exclusion of a package takes precedence over its inclusion.
1599
 
2451
 
1600
The package names can be specified as a mix of the three forms described under the '-toPackage' option.
2452
The package names can be specified as a mix of the three forms described under the '-toPackage' option.
1601
 
2453
 
-
 
2454
=item B<-[no]entireSandbox>
-
 
2455
 
-
 
2456
This option will override the automatic package localisation that will occur if the user starts the comamnd
-
 
2457
within a subdirectory of a package within the sandbox and will process the entire sabdbox.
-
 
2458
 
-
 
2459
If the user start the command within a subdirectory of a package then the sandbox commands will be localised
-
 
2460
to the current package and the dependencies of the package.
-
 
2461
 
-
 
2462
=item B<-[no]users>
-
 
2463
 
-
 
2464
This option will completely change the packages considered to be built. The normal operation is to consider
-
 
2465
the current package and all packages that it depends upon.
-
 
2466
 
-
 
2467
This option will consider all packages that 'use' the current package, either directly or indirectly. It does not 
-
 
2468
include the 'current' pakage in this list. The assumption is that the current package has been sucessfully built 
-
 
2469
and needs to tested.
-
 
2470
 
-
 
2471
This option will work when they is a current package to be processed and not the entire sandbox.
-
 
2472
 
-
 
2473
The intended purpose of this option is to simplify regression testing.
-
 
2474
 
-
 
2475
=item B<-[no]keepgoing>
-
 
2476
 
-
 
2477
This options controls the behaviour of the command when an error is encountered.
-
 
2478
 
-
 
2479
The default operation is to terminate the command on the package with the
-
 
2480
error. This can be modified so that errors are ignored.
-
 
2481
 
-
 
2482
=item B<-[no]reScan>
-
 
2483
 
-
 
2484
This option controls the process of locating build files within the sandbox.
-
 
2485
 
-
 
2486
The default operation is to scan the sandbox and to cache the location of the build files.
-
 
2487
 
-
 
2488
If a package is added or removed from the sandbox, then the sandbox will need to be rescanned.
-
 
2489
Jats will detect when a package has been added or removed, but if the internal structure of the
-
 
2490
packages has changed the cached data may be incorrect. 
-
 
2491
 
1602
=back
2492
=back
1603
 
2493
 
1604
=head1 DESCRIPTION
2494
=head1 DESCRIPTION
1605
 
2495
 
1606
This program is the primary tool for the maintenance of Development Sandboxes.
2496
This program is the primary tool for the maintenance of Development Sandboxes.
Line 1619... Line 2509...
1619
 
2509
 
1620
The sandbox directory contains sub directories, each should contain a single
2510
The sandbox directory contains sub directories, each should contain a single
1621
package. Sub directories may be created with the 'jats extract' command or with the
2511
package. Sub directories may be created with the 'jats extract' command or with the
1622
'jats sandbox populate' command.
2512
'jats sandbox populate' command.
1623
 
2513
 
1624
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
2514
Note: Symbolic links are not supported. They cannot work as the sandbox mechanism
1625
requires that all the packages be contained within a sub directory tree so
2515
requires that all the packages be contained within a sub directory tree so
1626
that the root of the sandbox can be located by a simple scan of the directory
2516
that the root of the sandbox can be located by a simple scan of the directory
1627
tree.
2517
tree.
1628
 
2518
 
1629
If a package subdirectory contains a file called 'stop' or 'stop.
2519
If a package subdirectory contains a file called 'stop' or 'stop.
1630
<GBE_MACHTYPE>', then that package will not be considered as a part of the
2520
<GBE_MACHTYPE>', then that package will not be considered as a part of the
1631
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
2521
build-set. A 'stop' file will prevent consideration for all build platforms. The 'stop.
1632
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
2522
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
1633
type of computer.
2523
type of computer.
1634
 
2524
 
1635
If the sandbox contains a file called 'buildfilter', then the contents of the
2525
If the sandbox contains a file called 'buildfilter', then the contents of the
1636
file will be read and used a buildfilter. The file is processed by reading each
2526
file will be read and used a buildfilter. The file is processed by reading each
Line 1713... Line 2603...
1713
    -help[=n]                  - Command specific help, [n=1,2,3]
2603
    -help[=n]                  - Command specific help, [n=1,2,3]
1714
    -toPackage=name            - Stop building after package
2604
    -toPackage=name            - Stop building after package
1715
    -fromPackage=name          - Start building from package
2605
    -fromPackage=name          - Start building from package
1716
    -justPackage=name[,name]   - Build named packages
2606
    -justPackage=name[,name]   - Build named packages
1717
    -ignorePackage=name[,name] - Do not build named packages
2607
    -ignorePackage=name[,name] - Do not build named packages
-
 
2608
    -entireSandbox             - Process the entire sandbox
-
 
2609
    -users                     - Process package users, not dependencies
1718
    -excludePackage=name[,name]- Do not extract named package
2610
    -excludePackage=name[,name]- Do not extract named package
1719
    -recurse[=n]               - Locate dependencies within packages
2611
    -recurse[=n]               - Locate dependencies within packages
1720
    -all                       - Populate with all dependencies
2612
    -all                       - Populate with all dependencies
1721
    -missing                   - Locate missing packages
2613
    -missing                   - Locate missing packages
1722
    -show                      - Show packages that would be extracted
2614
    -show                      - Show packages that would be extracted
Line 1921... Line 2813...
1921
jats sandbox info [command options]
2813
jats sandbox info [command options]
1922
 
2814
 
1923
 Command Options
2815
 Command Options
1924
    -help[=n]                  - Command specific help, [n=1,2,3]
2816
    -help[=n]                  - Command specific help, [n=1,2,3]
1925
    -verbose[=n]               - Display more information
2817
    -verbose[=n]               - Display more information
-
 
2818
    -usedby                    - Display package usage information
1926
    -toPackage=name            - Stop building after package
2819
    -toPackage=name            - Stop building after package
1927
    -fromPackage=name          - Start building from package
2820
    -fromPackage=name          - Start building from package
1928
    -justPackage=name[,name]   - Build named packages
2821
    -justPackage=name[,name]   - Build named packages
1929
    -ignorePackage=name[,name] - Do not build named packages
2822
    -ignorePackage=name[,name] - Do not build named packages
-
 
2823
    -entireSandbox             - Process the entire sandbox
-
 
2824
    -users                     - Process package users, not dependencies
-
 
2825
    -fingerprint               - Display fingerprint information
1930
 
2826
 
1931
=head2 OPTIONS
2827
=head2 OPTIONS
1932
 
2828
 
1933
=over
2829
=over
1934
 
2830
 
Line 1936... Line 2832...
1936
 
2832
 
1937
This options will increase the verbosity of the information being displayed.
2833
This options will increase the verbosity of the information being displayed.
1938
Values 1 and 2 are described in the detailed 'DESCRIPTION'. Other values are
2834
Values 1 and 2 are described in the detailed 'DESCRIPTION'. Other values are
1939
reserved for diagnostic use.
2835
reserved for diagnostic use.
1940
 
2836
 
-
 
2837
=item B<-usedby>
-
 
2838
 
-
 
2839
This option will list all packages that use the current package, both directly and
-
 
2840
indirectly. These are packages that should be tested whan changes are made to the 
-
 
2841
package.
-
 
2842
 
-
 
2843
=item B<-fingerprint>
-
 
2844
 
-
 
2845
This option will cause the information display to include that status of each packages fingerprint.
-
 
2846
 
-
 
2847
This will slow down the display as the calculation can be time consuming.
-
 
2848
 
1941
=back
2849
=back
1942
 
2850
 
1943
=head2 DESCRIPTION
2851
=head2 DESCRIPTION
1944
 
2852
 
1945
The 'info' command will display information about the build order and the
2853
The 'info' command will display information about the build order and the
Line 1986... Line 2894...
1986
 
2894
 
1987
=item *
2895
=item *
1988
 
2896
 
1989
Verbosity of 2
2897
Verbosity of 2
1990
 
2898
 
-
 
2899
Usage information will also be displayed. This is the same as invoking the 
1991
Reserved for future use
2900
'-usedby' option.
1992
 
2901
 
1993
=item *
2902
=item *
1994
 
2903
 
1995
Verbosity over 2
2904
Verbosity over 2
1996
 
2905
 
Line 2078... Line 2987...
2078
    jats sandbox buildfilter COBRA +PPC_603E
2987
    jats sandbox buildfilter COBRA +PPC_603E
2079
 or jats sandbox buildfilter COBRA PPC_603E
2988
 or jats sandbox buildfilter COBRA PPC_603E
2080
 
2989
 
2081
will set the buildfilter to be COBRA and PPC_603E
2990
will set the buildfilter to be COBRA and PPC_603E
2082
 
2991
 
-
 
2992
=head1 Skip Build
-
 
2993
 
-
 
2994
=head2 NAME
-
 
2995
 
-
 
2996
Mark a package to be skipped during the build
-
 
2997
 
-
 
2998
=head2 SYNOPSIS
-
 
2999
 
-
 
3000
jats sandbox [un]skip [command options] [PackageName]+
-
 
3001
 
-
 
3002
 Command Options
-
 
3003
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
3004
    -man                    - Same as -help=3
-
 
3005
    -[no]machine            - Skip on on this type of machine
-
 
3006
 
-
 
3007
=head2 ARGUMENTS
-
 
3008
 
-
 
3009
Arguments to the 'skip' command are the names of packages to be marked.
-
 
3010
 
-
 
3011
If no packages are named then the command will display all packages that are marked to be skipped.
-
 
3012
 
-
 
3013
If the named package is '.', then the current package will be excluded.
-
 
3014
 
-
 
3015
=head2 OPTIONS
-
 
3016
 
-
 
3017
The 'skip' command takes the following options:
-
 
3018
 
-
 
3019
=over 8
-
 
3020
 
-
 
3021
=item -[no]machine
-
 
3022
 
-
 
3023
This option will flag that the package will be skipped only on this type of build machine.
-
 
3024
 
-
 
3025
=back
-
 
3026
 
-
 
3027
=head2 DESCRIPTION
-
 
3028
 
-
 
3029
The 'skip' command marked the named packages to be skipped during the build, or the mark will be removed.
-
 
3030
 
-
 
3031
=head2 EXAMPLES
-
 
3032
 
-
 
3033
The command
-
 
3034
 
-
 
3035
    jats sandbox skip package1 
-
 
3036
 
-
 
3037
will mark package1 to be skipped during the following builds.
-
 
3038
 
-
 
3039
=head1 Sandbox Finger Print
-
 
3040
 
-
 
3041
=head2 NAME
-
 
3042
 
-
 
3043
Various fingerprint operations
-
 
3044
 
-
 
3045
=head2 SYNOPSIS
-
 
3046
 
-
 
3047
jats sandbox finger[print] [options]
-
 
3048
 
-
 
3049
 Command Options
-
 
3050
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
3051
    -man                    - Same as -help=3
-
 
3052
    -[no]generate           - Generate a fingerprint over a package
-
 
3053
    -[no]delete             - Delete the fingerprint information
-
 
3054
 
-
 
3055
=head2 ARGUMENTS
-
 
3056
 
-
 
3057
Arguments to the 'fingerprint' command are the names of packages to be processed.
-
 
3058
 
-
 
3059
If no packages are named then the command will process the current package, if any.
-
 
3060
 
-
 
3061
=head2 OPTIONS
-
 
3062
 
-
 
3063
The 'fingerprint' command takes the following options:
-
 
3064
 
-
 
3065
=over 8
-
 
3066
 
-
 
3067
=item -[no]generate
-
 
3068
 
-
 
3069
This option will cause the fingerprint of the package to be regenerated.
-
 
3070
 
-
 
3071
=item -[no]delete
-
 
3072
 
-
 
3073
This option will delete the fingerprint information associated wit a package.
-
 
3074
 
-
 
3075
=back
-
 
3076
 
-
 
3077
=head2 DESCRIPTION
-
 
3078
 
-
 
3079
The 'fingerprint' command, will by default, examine the packages fingerprint and report
-
 
3080
if the package has been modified since the fingerprint was created.
-
 
3081
 
-
 
3082
Options allow different modes of operation.
-
 
3083
 
-
 
3084
A fingerprint may only be created after the 'build.pl' file has been created. It requires the
-
 
3085
build process to generate metadata about the package.
-
 
3086
 
-
 
3087
=head2 EXAMPLES
-
 
3088
 
-
 
3089
The command
-
 
3090
 
-
 
3091
    jats sandbox fingerprint -generate
-
 
3092
 
-
 
3093
will regenerate the fingerprint of the current package. Useful after trivial edits to 
-
 
3094
enable the sandbox builder to bypass the package and not to rebuild it and all of its dependents.
-
 
3095
 
2083
=head1 Command all
3096
=head1 Command all
2084
 
3097
 
2085
=head2 NAME
3098
=head2 NAME
2086
 
3099
 
2087
Build packages in the sandbox
3100
Build packages in the sandbox
Line 2094... Line 3107...
2094
    -help[=n]                  - Command specific help, [n=1,2,3]
3107
    -help[=n]                  - Command specific help, [n=1,2,3]
2095
    -toPackage=name            - Stop building after package
3108
    -toPackage=name            - Stop building after package
2096
    -fromPackage=name          - Start building from package
3109
    -fromPackage=name          - Start building from package
2097
    -justPackage=name[,name]   - Build named packages
3110
    -justPackage=name[,name]   - Build named packages
2098
    -ignorePackage=name[,name] - Do not build named packages
3111
    -ignorePackage=name[,name] - Do not build named packages
-
 
3112
    -entireSandbox             - Process the entire sandbox
-
 
3113
    -users                     - Process package users, not dependencies
-
 
3114
    -[no]keepgoing             - Ignore errors
-
 
3115
    -[no]skip                  - Skip if no source change (default:skip)
-
 
3116
 
2099
 
3117
 
2100
=head2 ARGUMENTS
3118
=head2 ARGUMENTS
2101
 
3119
 
2102
Arguments are passed to the 'make' phase of the process.
3120
Arguments are passed to the 'make' phase of the process.
2103
 
3121
 
2104
=head2 OPTIONS
3122
=head2 OPTIONS
2105
 
3123
 
-
 
3124
=over
-
 
3125
 
-
 
3126
=item B<-[no]skip>
-
 
3127
 
2106
The are command specific options.
3128
This operation overides the default smart building mechanism.
-
 
3129
 
-
 
3130
By default, a package will not be built if the last build was successful and 
-
 
3131
there has not been any change to the source of the package, since the last 
-
 
3132
succesful build.
-
 
3133
 
-
 
3134
=back
2107
 
3135
 
2108
=head2 DESCRIPTION
3136
=head2 DESCRIPTION
2109
 
3137
 
2110
The 'all' command will perform build, if the build files are out of date,
3138
The 'all' command will perform build, if the build files are out of date,
2111
followed by a make in each of the packages within the sandbox, in the correct
3139
followed by a make in each of the packages within the sandbox, in the correct
Line 2141... Line 3169...
2141
    -help[=n]                  - Command specific help, [n=1,2,3]
3169
    -help[=n]                  - Command specific help, [n=1,2,3]
2142
    -toPackage=name            - Stop building after package
3170
    -toPackage=name            - Stop building after package
2143
    -fromPackage=name          - Start building from package
3171
    -fromPackage=name          - Start building from package
2144
    -justPackage=name[,name]   - Build named packages
3172
    -justPackage=name[,name]   - Build named packages
2145
    -ignorePackage=name[,name] - Do not build named packages
3173
    -ignorePackage=name[,name] - Do not build named packages
-
 
3174
    -entireSandbox             - Process the entire sandbox
-
 
3175
    -users                     - Process package users, not dependencies
-
 
3176
    -[no]keepgoing             - Ignore errors
-
 
3177
    -[no]skip                  - Skip if no source change (default:skip)
2146
 
3178
 
2147
=head2 ARGUMENTS
3179
=head2 ARGUMENTS
2148
 
3180
 
2149
Arguments are passed to the 'make' phase of the process.
3181
Arguments are passed to the 'make' phase of the process.
2150
 
3182
 
2151
=head2 OPTIONS
3183
=head2 OPTIONS
2152
 
3184
 
-
 
3185
=over
-
 
3186
 
-
 
3187
=item B<-[no]skip>
-
 
3188
 
2153
The are no command specific options.
3189
This operation overides the default smart building mechanism.
-
 
3190
 
-
 
3191
By default, a package will not be built if the last build was successful and 
-
 
3192
there has not been any change to the source of the package, since the last 
-
 
3193
succesful build.
-
 
3194
 
-
 
3195
=back
2154
 
3196
 
2155
=head2 DESCRIPTION
3197
=head2 DESCRIPTION
2156
 
3198
 
2157
The 'build' command will force a build followed by a make in each of the packages
3199
The 'build' command will force a build followed by a make in each of the packages
2158
within the sandbox, in the correct build order.
3200
within the sandbox, in the correct build order.
Line 2175... Line 3217...
2175
    -help[=n]                  - Command specific help, [n=1,2,3]
3217
    -help[=n]                  - Command specific help, [n=1,2,3]
2176
    -toPackage=name            - Stop building after package
3218
    -toPackage=name            - Stop building after package
2177
    -fromPackage=name          - Start building from package
3219
    -fromPackage=name          - Start building from package
2178
    -justPackage=name[,name]   - Build named packages
3220
    -justPackage=name[,name]   - Build named packages
2179
    -ignorePackage=name[,name] - Do not build named packages
3221
    -ignorePackage=name[,name] - Do not build named packages
-
 
3222
    -entireSandbox             - Process the entire sandbox
-
 
3223
    -users                     - Process package users, not dependencies
-
 
3224
    -[no]keepgoing             - Ignore errors
2180
 
3225
 
2181
=head2 ARGUMENTS
3226
=head2 ARGUMENTS
2182
 
3227
 
2183
None
3228
None
2184
 
3229
 
2185
=head2 OPTIONS
3230
=head2 OPTIONS
2186
 
3231
 
-
 
3232
=over
-
 
3233
 
2187
No command specific options
3234
=item B<-[no]keepgoing>
-
 
3235
 
-
 
3236
This options controls the behaviour of the command when an error is encountered.
-
 
3237
 
-
 
3238
The default operation is to terminate the command on the package with the
-
 
3239
error. This can be modified so that errors are ignored.
-
 
3240
 
-
 
3241
=back
2188
 
3242
 
2189
=head2 DESCRIPTION
3243
=head2 DESCRIPTION
2190
 
3244
 
2191
The 'clean' command will perform a 'jats make clean' in all components in the
3245
The 'clean' command will perform a 'jats make clean' in all components in the
2192
sandbox.
3246
sandbox.
Line 2208... Line 3262...
2208
    -help[=n]                  - Command specific help, [n=1,2,3]
3262
    -help[=n]                  - Command specific help, [n=1,2,3]
2209
    -toPackage=name            - Stop building after package
3263
    -toPackage=name            - Stop building after package
2210
    -fromPackage=name          - Start building from package
3264
    -fromPackage=name          - Start building from package
2211
    -justPackage=name[,name]   - Build named packages
3265
    -justPackage=name[,name]   - Build named packages
2212
    -ignorePackage=name[,name] - Do not build named packages
3266
    -ignorePackage=name[,name] - Do not build named packages
-
 
3267
    -entireSandbox             - Process the entire sandbox
-
 
3268
    -users                     - Process package users, not dependencies
2213
 
3269
 
2214
=head2 ARGUMENTS
3270
=head2 ARGUMENTS
2215
 
3271
 
2216
Arguments are passed to the 'make' phase of the process.
3272
Arguments are passed to the 'make' phase of the process.
2217
 
3273
 
Line 2241... Line 3297...
2241
    -[no]keepgoing             - Ignore errors
3297
    -[no]keepgoing             - Ignore errors
2242
    -toPackage=name            - Stop building after package
3298
    -toPackage=name            - Stop building after package
2243
    -fromPackage=name          - Start building from package
3299
    -fromPackage=name          - Start building from package
2244
    -justPackage=name[,name]   - Build named packages
3300
    -justPackage=name[,name]   - Build named packages
2245
    -ignorePackage=name[,name] - Do not build named packages
3301
    -ignorePackage=name[,name] - Do not build named packages
-
 
3302
    -entireSandbox             - Process the entire sandbox
-
 
3303
    -users                     - Process package users, not dependencies
2246
 
3304
 
2247
=head2 ARGUMENTS
3305
=head2 ARGUMENTS
2248
 
3306
 
2249
Arguments are passed to a JATS command.
3307
Arguments are passed to a JATS command.
2250
 
3308