Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
227 dpurdie 1
########################################################################
263 dpurdie 2
# Copyright (C) 2008 ERG Limited, All rights reserved
227 dpurdie 3
#
263 dpurdie 4
# Module name   : jats_sandbox.pl
5
# Module type   : JATS Utility
6
# Compiler(s)   : Perl
7
# Environment(s): JATS
227 dpurdie 8
#
9
# Description   : A script to build a collection of packages in the
10
#                 same sandbox. This script will:
11
#
12
#                   Determine the packages in the sandbox
13
#                   Determine the build order of the packages
14
#                   Build the packages in the correct order
15
#                   Make the packages in the correct order
16
#
17
#                 The script will allow for:
18
#                   The creation of a sandbox
19
#                   The addition of packages to the sandbox
20
#                   Removal of packages from the sandbox
21
#
22
#
23
#                 Command syntax (basic)
24
#                   jats sandbox <command> (options | actions)@
25
#
26
#                 Commands include:
27
#                   create              - Create a sandbox
28
#                   delete              - Delete a sandbox
337 dpurdie 29
#                   info                - Show sandbox info
227 dpurdie 30
#
31
#                   build               - Build all packages in the sandbox
32
#                   make                - make all packages in the sandbox
33
#
34
#......................................................................#
35
 
263 dpurdie 36
require 5.008_002;
227 dpurdie 37
use strict;
38
use warnings;
39
use JatsError;
40
use JatsSystem;
41
use FileUtils;
245 dpurdie 42
use JatsBuildFiles;
227 dpurdie 43
use JatsVersionUtils;
299 dpurdie 44
use File::Path qw(rmtree);
227 dpurdie 45
 
46
 
47
use Pod::Usage;                             # required for help support
48
use Getopt::Long qw(:config require_order); # Stop on non-option
49
my $VERSION = "1.0.0";                      # Update this
50
 
51
#
52
#   Options
53
#
54
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
55
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
56
my $opt_help = 0;
57
 
58
#
59
#   Globals - Provided by the JATS environment
60
#
61
my $USER         = $ENV{'USER'};
62
my $UNIX         = $ENV{'GBE_UNIX'};
63
my $HOME         = $ENV{'HOME'};
64
my $GBE_SANDBOX  = $ENV{'GBE_SANDBOX'};
65
my $GBE_DPKG_SBOX= $ENV{'GBE_DPKG_SBOX'};
325 dpurdie 66
my $GBE_MACHTYPE = $ENV{'GBE_MACHTYPE'};
227 dpurdie 67
 
335 dpurdie 68
my $GBE_DPKG_LOCAL = $ENV{'GBE_DPKG_LOCAL'};
69
my $GBE_DPKG_CACHE = $ENV{'GBE_DPKG_CACHE'};
70
my $GBE_DPKG       = $ENV{'GBE_DPKG'};
71
my $GBE_DPLY       = $ENV{'GBE_DPLY'};
72
my $GBE_DPKG_STORE = $ENV{'GBE_DPKG_STORE'};
73
 
227 dpurdie 74
#
75
#   Globals
76
#
77
my @build_order = ();                     # Build Ordered list of entries
255 dpurdie 78
my %extern_deps;                          # Hash of external dependencies
227 dpurdie 79
my %packages;                             # Hash of packages
80
 
81
 
82
#-------------------------------------------------------------------------------
83
# Function        : Mainline Entry Point
84
#
85
# Description     :
86
#
87
# Inputs          :
88
#
89
my $result = GetOptions (
299 dpurdie 90
                "help|h:+"      => \$opt_help,
91
                "manual:3"      => \$opt_help,
337 dpurdie 92
                "verbose:+"     => \$opt_verbose,           # flag, multiple use allowed
227 dpurdie 93
                );
94
 
95
                #
96
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
97
                #
98
 
99
#
100
#   Process help and manual options
101
#
102
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
103
pod2usage(-verbose => 1)  if ($opt_help == 2 );
299 dpurdie 104
pod2usage(-verbose => 2)  if ($opt_help > 2 );
227 dpurdie 105
 
106
#
107
#   Configure the error reporting process now that we have the user options
108
#
109
ErrorConfig( 'name'    => 'SANDBOX',
110
             'verbose' => $opt_verbose );
111
 
112
#
113
#   Validate user options
114
#
115
 
116
#
117
#   Parse the user command and decide what to do
118
#
119
#
120
my $cmd = shift @ARGV || "";
121
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
299 dpurdie 122
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
227 dpurdie 123
create_sandbox()                        if ( $cmd =~ m/^create$/ );
124
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
125
cmd(@ARGV)                              if ( $cmd =~ m/^cmd$/ );
331 dpurdie 126
buildcmd($cmd, @ARGV )                  if ( $cmd =~ m/(^all$)|(^build$)/  );
127
cmd($cmd, @ARGV )                       if ( $cmd =~ m/(^make$)/  );
273 dpurdie 128
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
337 dpurdie 129
cache(@ARGV)                            if ( $cmd =~ m/^cache$/  );
227 dpurdie 130
 
131
Error ("Unknown sandbox command: $cmd");
132
exit 1;
133
 
134
 
135
#-------------------------------------------------------------------------------
136
#
137
#   Give the user a clue
138
#
139
sub help
140
{
141
    my ($level) = @_;
142
    $level = $opt_help unless ( $level );
143
 
144
    pod2usage(-verbose => 0, -message => "Version: ". $VERSION)  if ($level == 1 );
145
    pod2usage(-verbose => $level -1 );
146
}
147
 
148
#-------------------------------------------------------------------------------
149
# Function        : create_sandbox
150
#
151
# Description     : create a sandbox in the current current directory
152
#
153
# Inputs          : None
154
#
155
#
156
sub create_sandbox
157
{
331 dpurdie 158
    Error ("Unexpected arguments: @ARGV") if ( @ARGV );
227 dpurdie 159
    Error ("Cannot create a sandbox within a sandbox",
160
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
161
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
341 dpurdie 162
    Message ('Sandbox created');
227 dpurdie 163
    exit  0;
164
}
165
 
166
#-------------------------------------------------------------------------------
299 dpurdie 167
# Function        : delete_sandbox
168
#
169
# Description     : Delete a sandbox
170
#                   Its up to the user the delete the components in the sandbox
171
#
172
# Inputs          : None
173
#
174
# Returns         : 
175
#
176
sub delete_sandbox
177
{
331 dpurdie 178
    Error ("Unexpected arguments: @ARGV") if ( @ARGV );
299 dpurdie 179
    unless ( $GBE_SANDBOX )
180
    {
181
        Warning("No sandbox found to delete");
182
    }
183
    else
184
    {
185
        my $sdir = "$GBE_SANDBOX/sandbox_dpkg_archive";
186
        rmtree($sdir,0,0);
187
        Error ("Sandbox directory not completly removed")
188
            if ( -e $sdir );
189
 
190
        Message("Sandbox information deleted",
191
                "Sandbox components must be manually deleted");
192
    }
193
    exit 0;
194
}
195
 
196
#-------------------------------------------------------------------------------
227 dpurdie 197
# Function        : info
198
#
199
# Description     : Display Sandbox information
200
#
201
# Inputs          : Command line args
202
#                   -v  - Be more verbose
203
#
204
# Returns         : Will exit
205
#
206
sub info
207
{
208
    #
209
    #   Allow user to specify verboseness as an argument
210
    #
335 dpurdie 211
    my @unknown;
227 dpurdie 212
    foreach  ( @_ )
213
    {
335 dpurdie 214
        $opt_verbose++, next if ( m/^-v/ );
215
        push @unknown, $_;
227 dpurdie 216
    }
335 dpurdie 217
    Error ("sandbox info: Unknown options: @unknown") if @unknown;
227 dpurdie 218
 
219
    #
220
    #   Determine Sandbox information
221
    #   Populate global variables
222
    #
223
    calc_sandbox_info();
224
 
225
    #
226
    #   Display information
227
    #
228
    Message ("Base: $GBE_SANDBOX");
229
    Message ("Archive: $GBE_DPKG_SBOX");
230
 
231
    Message ("Build Order");
232
    foreach my $fe ( @build_order )
233
    {
245 dpurdie 234
        Message( "    Level:" . $fe->{level} . " Name: " . $fe->{mname} );
227 dpurdie 235
        Message( DisplayPath ("        Path: $fe->{dir}" )) if $opt_verbose;
236
 
237
        if ( $opt_verbose )
238
        {
239
            foreach my $idep ( sort keys %{$fe->{ideps}} )
240
            {
241
                my ($ppn,$pps) = split( $; , $idep);
242
                Message ("        I:$ppn.$pps");
243
            }
244
 
245
            foreach my $edep ( sort keys %{$fe->{edeps}} )
246
            {
247
                my ($ppn,$pps) = split( $; , $edep);
248
                my $pv = $fe->{edeps}{$edep};
249
                Message ("        E:$ppn $pv.$pps");
250
            }
251
 
252
        }
253
    }
254
 
255 dpurdie 255
    Message("External Dependencies");
227 dpurdie 256
    foreach my $de ( sort keys %extern_deps )
257
    {
258
        my ($pn,$ps) = split( $; , $de);
259
        my @vlist = keys %{$extern_deps{$de}};
335 dpurdie 260
        my $flag = $#vlist ? '+' : '';
227 dpurdie 261
        foreach my $pv ( @vlist )
262
        {
335 dpurdie 263
            my $exists = check_package_existance( $pn, "$pv.$ps") ? '' : '*';
264
            my $flags = sprintf ("%4.4s", $flag . $exists);
265
            Message ("${flags}${pn} ${pv}.${ps}");
227 dpurdie 266
            if ( $opt_verbose )
267
            {
268
                foreach my $pkg ( @{$extern_deps{$de}{$pv}} )
269
                {
270
                    my ($ppn,$pps) = split( $; , $pkg);
271
                    Message ("        U:$ppn.$pps");
272
 
273
                }
274
            }
275
        }
276
    }
277
 
278
    if ( $opt_verbose > 2 )
279
    {
280
        DebugDumpData( "extern_deps", \%extern_deps);
281
        DebugDumpData( "build_order", \@build_order);
282
        DebugDumpData( "packages", \%packages);
283
    }
284
    exit (0);
285
}
286
 
287
#-------------------------------------------------------------------------------
335 dpurdie 288
# Function        : check_package_existance
289
#
290
# Description     : Determine if a given package-version exists
291
#
292
# Inputs          : $name           - Package Name
293
#                   $ver            - Package Version
294
#
295
# Returns         : true            - Package exists
296
#
297
sub check_package_existance
298
{
299
    my ($name, $ver) = @_;
300
    #
301
    #   Look in each package archive directory
302
    #
303
    foreach my $dpkg ( $GBE_DPKG_SBOX,
304
                       $GBE_DPKG_LOCAL,
305
                       $GBE_DPKG_CACHE,
306
                       $GBE_DPKG,
307
                       $GBE_DPLY,
308
                       $GBE_DPKG_STORE )
309
    {
310
        next unless ( $dpkg );
311
        if ( -d "$dpkg/$name/$ver" )
312
        {
313
            return 1;
314
        }
315
    }
316
   return 0;
317
}
318
 
319
 
320
#-------------------------------------------------------------------------------
227 dpurdie 321
# Function        : calc_sandbox_info
322
#
323
# Description     : Examine the sandbox and determine all the important
324
#                   information
325
#
326
# Inputs          : None
327
#
328
# Returns         : Will exit if not in a sandbox
329
#                   Populates global variables
330
#                       @build_order - build ordered array of build entries
331
#
332
sub calc_sandbox_info
333
{
334
    #
335
    #   Start from the root of the sandbox
336
    #
337
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
338
    chdir ($GBE_SANDBOX) || Error ("Cannot chdir to $GBE_SANDBOX");
339
 
340
    #
341
    #   Locate all packages within the sandbox
342
    #   These will be top-level directories - one per package
343
    #
344
    my @dirlist;
345
    my @build_list;
255 dpurdie 346
    foreach my $pname ( glob("*") )
227 dpurdie 347
    {
255 dpurdie 348
        next if ( $pname =~ m~^\.~ );
349
        next if ( $pname =~ m~dpkg_archive$~ );
297 dpurdie 350
        next if ( $pname =~ m~^CVS$~ );
255 dpurdie 351
        next unless ( -d $pname );
352
        Verbose ("Package discovered: $pname");
275 dpurdie 353
 
325 dpurdie 354
        if ( -f "$pname/stop" || -f "$pname/stop.$GBE_MACHTYPE" )
275 dpurdie 355
        {
356
            Warning("Package contains stop file: $pname");
357
            next;
358
        }
359
 
255 dpurdie 360
        push @dirlist, $pname;
227 dpurdie 361
 
362
        #
363
        #   Locate the build files in each package
245 dpurdie 364
        #   Scan the build files and extract dependancy information
227 dpurdie 365
        #
255 dpurdie 366
        my $bscanner = BuildFileScanner( $pname, 'build.pl', '--LocateAll', '--ScanDependencies' );
245 dpurdie 367
        $bscanner->scan();
368
        my @blist = $bscanner->getInfo();
255 dpurdie 369
        Warning ("Package does not have build files: $pname") unless ( @blist );
370
        Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
245 dpurdie 371
        push @build_list, @blist;
227 dpurdie 372
    }
373
 
374
    #
375
    #   Process each build file and extract
376
    #       Name of the Package
377
    #       Dependency list
378
    #   Build up a hash of dependence information
379
    #
380
 
381
    my %depends;
299 dpurdie 382
    my %multi;
245 dpurdie 383
    foreach my $be ( @build_list )
227 dpurdie 384
    {
245 dpurdie 385
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
386
#        DebugDumpData ("be", $be );
227 dpurdie 387
 
388
        #
299 dpurdie 389
        #   Catch multiple builds for the same package
390
        #   Report later - when we have all
391
        #
321 dpurdie 392
        next unless ( $be->{mname} );
299 dpurdie 393
        push @{$multi{$be->{mname}}},$be->{dir};
394
 
395
        #
227 dpurdie 396
        #   Add into dependency struct
397
        #
245 dpurdie 398
        $depends{$be->{package}}{depends} = $be->{depends};
399
        $depends{$be->{package}}{entry} = $be;
227 dpurdie 400
    }
401
 
299 dpurdie 402
    foreach my $mname ( sort keys %multi )
403
    {
404
        ReportError ("Mutiple builders for : $mname", @{$multi{$mname}} )
405
            if ( scalar @{$multi{$mname}} > 1 );
406
    }
407
    ErrorDoExit();
408
 
245 dpurdie 409
#DebugDumpData ("depends", \%depends );
410
 
227 dpurdie 411
    #
412
    #   Determine the build order
413
    #
414
    @build_order = ();
415
    my $more = 1;
416
    my $level = 0;
417
 
418
    #
255 dpurdie 419
    #   Remove any dependencies to 'external' packages
227 dpurdie 420
    #   These will not be met internally and can be regarded as constant
421
    #
422
    foreach my $key ( keys %depends )
423
    {
424
        foreach my $build ( keys( %{$depends{$key}{depends}} ))
425
        {
426
            unless (exists $depends{$build})
427
            {
428
                push @{$extern_deps{$build}{$depends{$key}{depends}{$build}}}, $key;
429
                $depends{$key}{entry}{edeps}{$build} = $depends{$key}{depends}{$build};
430
                delete ($depends{$key}{depends}{$build}) ;
431
                Verbose2( "Not in set: $build");
432
            }
433
            else
434
            {
435
                $depends{$key}{entry}{ideps}{$build} = 1;
436
            }
437
        }
438
    }
439
    while ( $more )
440
    {
441
        $more = 0;
442
        $level++;
443
        my @build;
444
 
445
        #
446
        #   Locate packages with no dependencies
447
        #
448
        foreach my $key ( keys %depends )
449
        {
450
            next if ( keys( %{$depends{$key}{depends}} ) );
451
            push @build, $key;
452
        }
453
 
454
        foreach my $build ( @build )
455
        {
456
            $more = 1;
457
            my $fe = $depends{$build}{entry};
458
            $fe->{level} = $level;
459
            $packages{$build} = $fe;
460
            push @build_order, $fe;
461
            delete $depends{$build};
462
            delete $fe->{depends};                          # remove now its not needed
463
        }
464
 
465
        foreach my $key ( keys %depends )
466
        {
467
            foreach my $build ( @build )
468
            {
469
                delete $depends{$key}{depends}{$build};
470
            }
471
        }
472
    }
473
 
474
    #
475
    #   Just to be sure to be sure
476
    #
245 dpurdie 477
    if ( keys %depends )
478
    {
479
        #DebugDumpData ("depends", \%depends );
480
        Error( "Internal algorithm error: Bad dependancy walk",
481
               "Possible circular dependency");
482
    }
227 dpurdie 483
 
484
#    DebugDumpData ("Order", \@build_order);
485
}
486
 
487
#-------------------------------------------------------------------------------
488
# Function        : cmd
489
#
490
# Description     : Execute a command in all the sandboxes
491
#                       Locate the base of the sandbox
492
#                       Locate all packages in the sandbox
493
#                       Locate all build files in each sandbox
494
#                       Determine build order
495
#                       Issue commands for each sandbox in order
496
#
255 dpurdie 497
# Inputs          : Arguments passed to jats build
227 dpurdie 498
#
499
# Returns         : Will exit
500
#
501
sub cmd
502
{
503
    my @cmds = @_;
504
    #
505
    #   Determine Sandbox information
506
    #   Populate global variables
507
    #
508
    calc_sandbox_info();
509
    foreach my $fe ( @build_order )
510
    {
511
        my $dir = $fe->{dir};
255 dpurdie 512
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
227 dpurdie 513
                  DisplayPath ("        Path: $fe->{dir}" ));
514
 
263 dpurdie 515
        my $result = JatsCmd( "-cd=$dir", @cmds);
255 dpurdie 516
        Error ("Cmd failure") if ( $result );
227 dpurdie 517
    }
518
 
519
    exit 0;
520
}
521
 
522
#-------------------------------------------------------------------------------
331 dpurdie 523
# Function        : buildcmd
524
#
525
# Description     : Build the entire sandbox
526
#                   The all and the build are similar.
527
#                   Its not really useful to do a build without a make
528
#                   so we don't try
529
#
530
# Inputs          : Arguments passed to jats make
531
#
532
#
533
# Returns         : Will exit
534
#
535
 
536
sub buildcmd
537
{
337 dpurdie 538
    my ($cmd, @cmd_opts) = @_;
331 dpurdie 539
    my @build_opts;
337 dpurdie 540
    my @make_opts;
331 dpurdie 541
 
542
    #
543
    #   Insert default options
544
    #
545
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
546
    push @build_opts, '-force' if ( $cmd ne 'all' );
547
 
337 dpurdie 548
    #
549
    #   Attempt to split the options into build and make options
550
    #   Only handle the often used options to build.
551
    #
552
    foreach  ( @cmd_opts )
553
    {
554
        if ( m/^-cache/ || m/^-package/ || m/^-forcebuildpkg/ || m/-expert/) {
555
            push @build_opts, $_;
556
        } else {
557
            push @make_opts, $_;
558
        }
559
    }
560
 
331 dpurdie 561
    push @make_opts, 'all'  unless ( @make_opts  );
562
 
563
    #
564
    #   Determine Sandbox information
565
    #   Populate global variables
566
    #
567
    calc_sandbox_info();
568
    foreach my $fe ( @build_order )
569
    {
570
        my $dir = $fe->{dir};
571
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
572
                  DisplayPath ("        Path: $fe->{dir}" ));
573
 
574
        JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
575
        JatsCmd( "-cd=$dir", 'make',  @make_opts)  && Error ("Make Cmd failure")  if ( $result );
576
    }
577
 
578
    exit 0;
579
}
580
 
581
 
582
#-------------------------------------------------------------------------------
273 dpurdie 583
# Function        : clean
584
#
585
# Description     : Execute a command in all the sandboxes
586
#                       Locate the base of the sandbox
587
#                       Locate all packages in the sandbox
588
#                       Locate all build files in each sandbox
589
#                       Determine build order
590
#                       Issue commands for each sandbox in order
591
#
592
# Inputs          : Arguments passed to jats build
593
#
594
# Returns         : Will exit
595
#
596
sub clean
597
{
598
    my ($mode, @cmds ) = @_;
599
    #
600
    #   Determine Sandbox information
601
    #   Populate global variables
602
    #
603
    calc_sandbox_info();
604
 
605
    my @cmd = $mode eq 'clobber' ? ('clobber') : ('make', 'clean' );
606
 
607
    #
608
    #   Clobber and clean need to be done in the reverse order
609
    #
610
    foreach my $fe ( reverse @build_order )
611
    {
612
        my $dir = $fe->{dir};
613
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
614
                  DisplayPath ("        Path: $fe->{dir}" ));
615
 
616
        my $result = JatsCmd( "-cd=$dir", @cmd, @cmds);
617
        Error ("Cmd failure") if ( $result );
618
    }
619
 
620
    exit 0;
621
}
622
 
623
 
624
#-------------------------------------------------------------------------------
337 dpurdie 625
# Function        : cache
626
#
627
# Description     : Cache external packages into the sandbox
628
#
629
# Inputs          : @opts                   - User options
630
#
631
# Returns         : Nothing
632
#
633
sub cache
634
{
635
    my (@opts) = @_;
636
    Warning("Unknown options: @opts") if ( @opts );
637
 
638
    #
639
    #   Determine Sandbox information
640
    #   Populate global variables
641
    #
642
    Message("Cache External Dependencies");
643
    calc_sandbox_info();
644
 
645
    #
646
    #   Walk the list of external depenedencies and cache each one
647
    #
648
    foreach my $de ( sort keys %extern_deps )
649
    {
650
        my ($pn,$ps) = split( $; , $de);
651
        my @vlist = keys %{$extern_deps{$de}};
652
        foreach my $pv ( @vlist )
653
        {
654
            Message ("Cache ${pn} ${pv}.${ps}");
655
            JatsTool ('cache_dpkg', "${pn}/${pv}.${ps}" );
656
        }
657
    }
658
 
659
    exit 0;
660
 
661
}
662
 
663
 
664
#-------------------------------------------------------------------------------
227 dpurdie 665
#   Documentation
666
#
667
 
668
=pod
669
 
670
=head1 NAME
671
 
672
jats_sandbox - Build in a Development Sandbox
673
 
674
=head1 SYNOPSIS
675
 
255 dpurdie 676
  jats sandbox [options] [commands]
227 dpurdie 677
 
678
 Options:
299 dpurdie 679
    -help[=n]          - Display help with specified detail
227 dpurdie 680
    -help -help        - Detailed help message
681
    -man               - Full documentation
682
 
683
 Commands:
684
    help                - Same as -help
685
    create              - Create a sandbox in the current directory
299 dpurdie 686
    delete              - Delete the sandbox
255 dpurdie 687
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
227 dpurdie 688
    cmd                 - Do commands in all sandbox components
331 dpurdie 689
    all                 - Do 'build', if required, then a make in all sandbox components
690
    build               - Force 'build and make' in all sandbox components
275 dpurdie 691
    make                - Do 'make' in all sandbox components
273 dpurdie 692
    clean               - Do 'make clean' in all sandbox components
693
    clobber             - Do 'build clobber' is all sandbox components
337 dpurdie 694
    cache               - Cache external dependent packages
227 dpurdie 695
 
696
=head1 OPTIONS
697
 
698
=over 8
699
 
299 dpurdie 700
=item B<-help[=n]>
227 dpurdie 701
 
702
Print a brief help message and exits.
299 dpurdie 703
There are three levels of help
227 dpurdie 704
 
299 dpurdie 705
=over 8
706
 
707
=item   1 Brief synopsis
708
 
709
=item   2 Synopsis and option summary
710
 
711
=item   3 Detailed help in man format
712
 
713
=back 8
714
 
227 dpurdie 715
=item B<-help -help>
716
 
717
Print a detailed help message with an explanation for each option.
718
 
719
=item B<-man>
720
 
299 dpurdie 721
Prints the manual page and exits. This is the same a -help=3
227 dpurdie 722
 
279 dpurdie 723
=back
724
 
227 dpurdie 725
=head1 DESCRIPTION
726
 
299 dpurdie 727
This program is the primary tool for the maintenance of Development Sandboxes.
728
 
227 dpurdie 729
More documentation will follow.
730
 
279 dpurdie 731
=head2 SANDBOX DIRECTORY
732
 
299 dpurdie 733
The sandbox directory is marked as being a sandbox through the use of the
734
'sandbox create' command. This will create a suitable structure within the
279 dpurdie 735
current directory.
736
 
737
Several JATS commands operate differently within a sandbox. The 'extract' and
738
'release' commands will create static viwes within the sandbox and not the
739
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
740
 
741
The sandbox directory contains sub directories, each should contain a single
742
package. Sub directories may be created with the 'jats extract' command.
743
 
744
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
745
requires that all the packages be conatined within a sub directory tree so
746
that the root of the sandbox can be located by a simple scan of the directory
747
tree.
748
 
325 dpurdie 749
If a package subdirectory contains a file called 'stop' or 'stop.
750
<GBE_MACHTYPE>', then that package will not be considered as a part of the
751
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
752
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
753
type of computer.
279 dpurdie 754
 
299 dpurdie 755
=head2 COMMAND SUMMARY
756
 
757
=head3 create
758
 
759
The 'create' command will create a sandbox in the users current directory. It is
760
not possible to create a sandbox within a sandbox.
761
 
762
A sandbox can be created in a directory that contains files and subdirectories.
763
 
764
The create command simply places a known directory in the current directory.
765
This dorectory is used by the sandboxing process. It may be manually deleted, or
766
deleted with the 'delete' command.
767
 
768
=head3 delete
769
 
770
The 'delete' command will delete the sandbox's marker directory. The command may
771
be executed anywhere within the sandbox.
772
 
773
Once the sanbox has been deleted, the user must remove the components within the
774
sandbox.
775
 
776
=head3 info
777
 
778
The 'info' command will display information about the build order and the
779
depenedencies of packages that it finds within the sandbox.
780
 
781
The command will accept one option '-v' to increase the verbosity of the
782
information being displayed.
783
 
784
=over 8
785
 
786
=item * No Verbosity
787
 
788
The basic command will display the build order and the external
335 dpurdie 789
dependencies. External dependencies may be prefixed with one of the
790
following indicators:
299 dpurdie 791
 
335 dpurdie 792
=over 8
793
 
794
=item   +   Multiple versions of this package are being used by sandboxed components.
795
 
796
=item   *   The package cannot be found in any of the package archives.
797
 
798
=back
799
 
299 dpurdie 800
=item Verbosity of 1
801
 
802
This level of verbosoity will display the build order and detailed information
803
on the dependencies. The dependencies will be prefixed with:
804
 
805
=over 8
806
 
807
=item   E   Dependent Package is external to the sandbox
808
 
809
=item   I   Dependent Package is internal to the sandbox
810
 
811
=back
812
 
335 dpurdie 813
External dependencies may be prefixed with one of the indicators described for
814
no-verbosity. Additionally the internal consumer of the external package is also
815
shown. These are prefixed with a 'U'.
299 dpurdie 816
 
817
=item Verbosity of 2
818
 
819
Reserved forfuture use
820
 
821
=item Verbosity over 2
822
 
823
This should be considered a debug option. Undocument internal information will
824
be displayed.
825
 
826
=back
827
 
331 dpurdie 828
=head3 all
829
 
830
The 'all' command will perform build, if the build files are out of date,
831
followed by a make in each of the packages within the sandbox, in the correct
832
build order.
833
 
834
Any arguments are passed to the 'make' phase of the process.
835
 
836
This command may be used to:
837
 
838
=over 8
839
 
840
=item * Pickup any build file changes.
841
 
842
=item * Resume a failed build.
843
 
844
=back
845
 
846
=head3 build
847
 
848
The 'build' command will force a build followed by a make in each of the packages
849
within the sandbox, in the correct build order.
850
 
851
Any arguments are passed to the 'make' phase of the process.
852
 
853
In practice, the 'sandbox all' command is quicker.
854
 
855
=head3 make
856
 
857
The 'make' command will perform a 'make' operation in each of the packages
858
within the sandbox, in the correct build order.
859
 
860
Any arguments are passed to the 'make'.
861
 
862
=head3 cmd
863
 
864
The 'cmd' command will pass all of its arguments to JATS in the build directory
865
of each of the packages within the sandbox, in the package build order.
866
 
867
=head3 clean
868
 
869
The 'clean' command will perform a 'jats make clean' in all components in the
870
sandbox.
871
 
872
=head3 clobber
873
 
874
The 'clobber' command will perform a 'jats clobber' in all components in the
875
sandbox.
876
 
337 dpurdie 877
=head3 cache
878
 
879
The 'cache' command will cache all external dependent packages into the sandbox.
880
 
881
This allows the simple creation of a small development environment that is
882
not tied to the larger Development Environment. It may then be used in a
883
disconnected mode to perform development.
884
 
885
 
227 dpurdie 886
=cut
887
 
255 dpurdie 888