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