Subversion Repositories DevTools

Rev

Rev 1273 | Rev 2053 | Go to most recent revision | Details | Compare with Previous | 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;
44
 
45
 
46
use Pod::Usage;                             # required for help support
47
use Getopt::Long qw(:config require_order); # Stop on non-option
48
my $VERSION = "1.0.0";                      # Update this
49
 
50
#
51
#   Options
52
#
53
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
54
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
359 dpurdie 55
my $opt_help = 0;                           # Help level
56
my $opt_exact = 0;                          # Exact (escrow) build
1273 dpurdie 57
my $opt_toPackage;                          # Control recursion
58
my $opt_fromPackage;                        # Control recursion
1328 dpurdie 59
my @opt_justPackage;                        # Control recursion
1273 dpurdie 60
my @opt_ignorePackage;                      # Control recursion
227 dpurdie 61
 
62
#
63
#   Globals - Provided by the JATS environment
64
#
65
my $USER         = $ENV{'USER'};
66
my $UNIX         = $ENV{'GBE_UNIX'};
67
my $HOME         = $ENV{'HOME'};
68
my $GBE_SANDBOX  = $ENV{'GBE_SANDBOX'};
69
my $GBE_DPKG_SBOX= $ENV{'GBE_DPKG_SBOX'};
325 dpurdie 70
my $GBE_MACHTYPE = $ENV{'GBE_MACHTYPE'};
227 dpurdie 71
 
335 dpurdie 72
my $GBE_DPKG_LOCAL = $ENV{'GBE_DPKG_LOCAL'};
73
my $GBE_DPKG_CACHE = $ENV{'GBE_DPKG_CACHE'};
74
my $GBE_DPKG       = $ENV{'GBE_DPKG'};
75
my $GBE_DPLY       = $ENV{'GBE_DPLY'};
76
my $GBE_DPKG_STORE = $ENV{'GBE_DPKG_STORE'};
77
 
227 dpurdie 78
#
79
#   Globals
80
#
1273 dpurdie 81
my @stopped = ();                         # Stopped entries
227 dpurdie 82
my @build_order = ();                     # Build Ordered list of entries
255 dpurdie 83
my %extern_deps;                          # Hash of external dependencies
227 dpurdie 84
my %packages;                             # Hash of packages
85
 
86
 
87
#-------------------------------------------------------------------------------
88
# Function        : Mainline Entry Point
89
#
90
# Description     :
91
#
92
# Inputs          :
93
#
94
 
95
#
96
#   Process help and manual options
97
#
1328 dpurdie 98
my $result = getOptionsFromArray ( \@ARGV );
227 dpurdie 99
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
100
pod2usage(-verbose => 1)  if ($opt_help == 2 );
299 dpurdie 101
pod2usage(-verbose => 2)  if ($opt_help > 2 );
227 dpurdie 102
 
103
#
104
#   Configure the error reporting process now that we have the user options
105
#
106
ErrorConfig( 'name'    => 'SANDBOX',
107
             'verbose' => $opt_verbose );
108
 
109
#
359 dpurdie 110
#   Reconfigure the options parser to allow subcommands to parse options
227 dpurdie 111
#
359 dpurdie 112
Getopt::Long::Configure('permute');
227 dpurdie 113
 
114
#
359 dpurdie 115
#   Determine Sandbox type. Exact or local
116
#
117
$opt_exact = (-f  $GBE_SANDBOX . '/sandbox_dpkg_archive/.exact' )
118
    if ( $GBE_SANDBOX );
119
 
120
#
227 dpurdie 121
#   Parse the user command and decide what to do
122
#
359 dpurdie 123
#   Remove user command from the command line. This will leave command options
124
#   in @ARGV so that they can be parsed by the subcommand.
227 dpurdie 125
#
126
my $cmd = shift @ARGV || "";
127
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
359 dpurdie 128
buildcmd($cmd, @ARGV )                  if ( $cmd =~ m/(^all$)|(^build$)/  );
129
cache(@ARGV)                            if ( $cmd =~ m/^cache$/  );
130
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
131
cmd('make', $cmd, @ARGV )               if ( $cmd =~ m/(^make$)/  );
132
cmd('cmd', @ARGV)                       if ( $cmd =~ m/^cmd$/ );
133
create_sandbox()                        if ( $cmd =~ m/^create$/ );
299 dpurdie 134
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
227 dpurdie 135
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
359 dpurdie 136
populate(@ARGV)                         if ( $cmd =~ m/^populate$/  );
227 dpurdie 137
 
138
Error ("Unknown sandbox command: $cmd");
139
exit 1;
140
 
141
 
142
#-------------------------------------------------------------------------------
143
#
144
#   Give the user a clue
145
#
146
sub help
147
{
148
    my ($level) = @_;
149
    $level = $opt_help unless ( $level );
150
 
151
    pod2usage(-verbose => 0, -message => "Version: ". $VERSION)  if ($level == 1 );
152
    pod2usage(-verbose => $level -1 );
153
}
154
 
155
#-------------------------------------------------------------------------------
156
# Function        : create_sandbox
157
#
158
# Description     : create a sandbox in the current current directory
159
#
160
# Inputs          : None
161
#
162
#
163
sub create_sandbox
164
{
359 dpurdie 165
    GetOptions (
166
                "help:+"        => \$opt_help,
167
                "manual:3"      => \$opt_help,
168
                "exact"         => \$opt_exact,
169
                ) || Error ("Invalid command line" );
170
 
171
    SubCommandHelp( $opt_help, "Create Sandbox") if ($opt_help || $#ARGV >= 0 );
172
 
227 dpurdie 173
    Error ("Cannot create a sandbox within a sandbox",
174
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
359 dpurdie 175
 
227 dpurdie 176
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
359 dpurdie 177
 
178
    TouchFile( 'sandbox_dpkg_archive/.exact', 'Sandbox marker file')
179
        if ($opt_exact);
180
 
181
    Message ('Sandbox created' . ($opt_exact ? ' - With exact version number processing' : ''));
227 dpurdie 182
    exit  0;
183
}
184
 
185
#-------------------------------------------------------------------------------
299 dpurdie 186
# Function        : delete_sandbox
187
#
188
# Description     : Delete a sandbox
189
#                   Its up to the user the delete the components in the sandbox
190
#
191
# Inputs          : None
192
#
361 dpurdie 193
# Returns         :
299 dpurdie 194
#
195
sub delete_sandbox
196
{
359 dpurdie 197
    GetOptions (
198
                "help:+"        => \$opt_help,
199
                "manual:3"      => \$opt_help,
200
                ) || Error ("Invalid command line" );
201
 
202
    SubCommandHelp( $opt_help, "Delete Sandbox") if ($opt_help || $#ARGV >= 0 );
203
 
299 dpurdie 204
    unless ( $GBE_SANDBOX )
205
    {
206
        Warning("No sandbox found to delete");
207
    }
208
    else
209
    {
365 dpurdie 210
        Error ("Sandbox directory not completely removed")
361 dpurdie 211
            if RmDirTree( "$GBE_SANDBOX/sandbox_dpkg_archive" );
299 dpurdie 212
 
213
        Message("Sandbox information deleted",
214
                "Sandbox components must be manually deleted");
215
    }
216
    exit 0;
217
}
218
 
219
#-------------------------------------------------------------------------------
227 dpurdie 220
# Function        : info
221
#
222
# Description     : Display Sandbox information
223
#
224
# Inputs          : Command line args
225
#                   -v  - Be more verbose
226
#
227
# Returns         : Will exit
228
#
229
sub info
230
{
1328 dpurdie 231
    my (@cmd_opts ) = @_;
232
    my $show = 0;
227 dpurdie 233
 
1328 dpurdie 234
    Getopt::Long::Configure('pass_through');
235
    getOptionsFromArray ( \@cmd_opts,
236
                           'verbose:+'  => \$show,
237
                        ) || Error ("Invalid command line" );
238
    SubCommandHelp( $opt_help, "Sandbox Information") if ($opt_help || $#cmd_opts >=0 );
361 dpurdie 239
 
227 dpurdie 240
    #
241
    #   Determine Sandbox information
242
    #   Populate global variables
243
    #
1273 dpurdie 244
    calc_sandbox_info(1);
227 dpurdie 245
 
246
    #
247
    #   Display information
248
    #
359 dpurdie 249
    Message ("Type   : " . ($opt_exact ? 'Exact' : 'Development') );
250
    Message ("Base   : $GBE_SANDBOX");
227 dpurdie 251
    Message ("Archive: $GBE_DPKG_SBOX");
252
 
1273 dpurdie 253
 
227 dpurdie 254
    Message ("Build Order");
1273 dpurdie 255
    foreach my $pname ( @stopped )
256
    {
257
        Message( "    Level:" . "-"  . " Name: " . $pname . ' (Stopped)');
258
    }
227 dpurdie 259
    foreach my $fe ( @build_order )
260
    {
1273 dpurdie 261
        Message( "    Level:" . $fe->{level} . " Name: " . $fe->{dname} . ($fe->{buildActive} ? '' : ' (Build Suppressed)'));
1328 dpurdie 262
        Message( DisplayPath ("        Path: $fe->{dir}" )) if $show;
227 dpurdie 263
 
1328 dpurdie 264
        if ( $show )
227 dpurdie 265
        {
359 dpurdie 266
            foreach my $idep ( sort values %{$fe->{'ideps'}} )
227 dpurdie 267
            {
359 dpurdie 268
                Message ("        I:$idep");
227 dpurdie 269
            }
270
 
359 dpurdie 271
            foreach my $edep ( sort keys %{$fe->{'edeps'}} )
227 dpurdie 272
            {
359 dpurdie 273
                my ($ppn,$ppv) = split( $; , $edep);
274
                Message ("        E:$ppn $ppv");
227 dpurdie 275
            }
361 dpurdie 276
 
227 dpurdie 277
        }
278
    }
279
 
359 dpurdie 280
    #
281
    #   External dependencies flags
282
    #       * - Package does not exist in dpkg_archive
283
    #       + - Multiple versions of this package are used
284
 
255 dpurdie 285
    Message("External Dependencies");
227 dpurdie 286
    foreach my $de ( sort keys %extern_deps )
287
    {
288
        my @vlist = keys %{$extern_deps{$de}};
335 dpurdie 289
        my $flag = $#vlist ? '+' : '';
359 dpurdie 290
        foreach my $pve ( @vlist )
227 dpurdie 291
        {
359 dpurdie 292
            my ($pn,$pv) = split( $; , $pve );
293
            my $exists = check_package_existance($pn,$pv  ) ? '' : '*';
335 dpurdie 294
            my $flags = sprintf ("%4.4s", $flag . $exists);
359 dpurdie 295
            Message ("${flags}${pn} ${pv}");
1328 dpurdie 296
            if ( $show )
227 dpurdie 297
            {
359 dpurdie 298
                foreach my $pkg ( @{$extern_deps{$de}{$pve}} )
227 dpurdie 299
                {
359 dpurdie 300
                    my $ppn = join ('.', split( $; , $pkg));
301
                    Message ("        U:$ppn");
227 dpurdie 302
                }
303
            }
359 dpurdie 304
 
227 dpurdie 305
        }
306
    }
307
 
1328 dpurdie 308
    if ( $show > 2 || $opt_verbose > 2 )
227 dpurdie 309
    {
310
        DebugDumpData( "extern_deps", \%extern_deps);
311
        DebugDumpData( "build_order", \@build_order);
312
        DebugDumpData( "packages", \%packages);
313
    }
314
    exit (0);
315
}
316
 
317
#-------------------------------------------------------------------------------
335 dpurdie 318
# Function        : check_package_existance
319
#
320
# Description     : Determine if a given package-version exists
321
#
322
# Inputs          : $name           - Package Name
323
#                   $ver            - Package Version
324
#
325
# Returns         : true            - Package exists
326
#
327
sub check_package_existance
328
{
329
    my ($name, $ver) = @_;
330
    #
331
    #   Look in each package archive directory
332
    #
333
    foreach my $dpkg ( $GBE_DPKG_SBOX,
334
                       $GBE_DPKG_LOCAL,
335
                       $GBE_DPKG_CACHE,
336
                       $GBE_DPKG,
337
                       $GBE_DPLY,
338
                       $GBE_DPKG_STORE )
339
    {
340
        next unless ( $dpkg );
341
        if ( -d "$dpkg/$name/$ver" )
342
        {
343
            return 1;
344
        }
345
    }
346
   return 0;
347
}
348
 
349
 
350
#-------------------------------------------------------------------------------
227 dpurdie 351
# Function        : calc_sandbox_info
352
#
353
# Description     : Examine the sandbox and determine all the important
354
#                   information
355
#
1273 dpurdie 356
#                   Operation will be modified by
357
#                       $opt_toPackage
358
#                       $opt_fromPackage
1328 dpurdie 359
#                       @opt_justPackage
1273 dpurdie 360
#                       @opt_ignorePackage
227 dpurdie 361
#
1273 dpurdie 362
# Inputs          : info                - True: Just for info
363
#                                               Keep supressed packages
364
#
227 dpurdie 365
# Returns         : Will exit if not in a sandbox
366
#                   Populates global variables
367
#                       @build_order - build ordered array of build entries
368
#
369
sub calc_sandbox_info
370
{
1273 dpurdie 371
    my ($info) = @_;
372
 
227 dpurdie 373
    #
374
    #   Start from the root of the sandbox
375
    #
376
    Error ("Command must be executed from within a Sandbox") unless ( $GBE_SANDBOX );
377
    chdir ($GBE_SANDBOX) || Error ("Cannot chdir to $GBE_SANDBOX");
378
 
379
    #
380
    #   Locate all packages within the sandbox
381
    #   These will be top-level directories - one per package
382
    #
383
    my @dirlist;
384
    my @build_list;
255 dpurdie 385
    foreach my $pname ( glob("*") )
227 dpurdie 386
    {
255 dpurdie 387
        next if ( $pname =~ m~^\.~ );
388
        next if ( $pname =~ m~dpkg_archive$~ );
297 dpurdie 389
        next if ( $pname =~ m~^CVS$~ );
255 dpurdie 390
        next unless ( -d $pname );
391
        Verbose ("Package discovered: $pname");
275 dpurdie 392
 
325 dpurdie 393
        if ( -f "$pname/stop" || -f "$pname/stop.$GBE_MACHTYPE" )
275 dpurdie 394
        {
1273 dpurdie 395
            push @stopped, $pname;
275 dpurdie 396
            Warning("Package contains stop file: $pname");
397
            next;
398
        }
399
 
255 dpurdie 400
        push @dirlist, $pname;
227 dpurdie 401
 
402
        #
403
        #   Locate the build files in each package
245 dpurdie 404
        #   Scan the build files and extract dependancy information
227 dpurdie 405
        #
359 dpurdie 406
        my $bscanner = BuildFileScanner( $pname, 'build.pl',
407
                                                 '--LocateAll',
408
                                                 $opt_exact ? '--ScanExactDependencies' : '--ScanDependencies' );
245 dpurdie 409
        $bscanner->scan();
410
        my @blist = $bscanner->getInfo();
255 dpurdie 411
        Warning ("Package does not have build files: $pname") unless ( @blist );
412
        Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
245 dpurdie 413
        push @build_list, @blist;
227 dpurdie 414
    }
415
 
416
    #
417
    #   Process each build file and extract
418
    #       Name of the Package
419
    #       Dependency list
420
    #   Build up a hash of dependence information
421
    #
422
 
423
    my %depends;
299 dpurdie 424
    my %multi;
245 dpurdie 425
    foreach my $be ( @build_list )
227 dpurdie 426
    {
245 dpurdie 427
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
359 dpurdie 428
        #
429
        #   Sandbox vs Exact processing
430
        #       Set a suitable display name
431
        #       Set a suitable tag
432
        #
433
        $be->{dname} = $opt_exact ? $be->{full}    : $be->{mname};
434
        $be->{tag}   = $opt_exact ? $be->{fullTag} : $be->{package};
435
 
245 dpurdie 436
#        DebugDumpData ("be", $be );
227 dpurdie 437
 
438
        #
299 dpurdie 439
        #   Catch multiple builds for the same package
440
        #   Report later - when we have all
441
        #
359 dpurdie 442
        next unless ( $be->{dname} );
443
        push @{$multi{$be->{dname}}},$be->{dir};
299 dpurdie 444
 
445
        #
227 dpurdie 446
        #   Add into dependency struct
447
        #
1273 dpurdie 448
        $depends{$be->{tag}} = $be;
227 dpurdie 449
    }
450
 
359 dpurdie 451
    foreach my $dname ( sort keys %multi )
299 dpurdie 452
    {
365 dpurdie 453
        ReportError ("Multiple builders for : $dname", @{$multi{$dname}} )
359 dpurdie 454
            if ( scalar @{$multi{$dname}} > 1 );
299 dpurdie 455
    }
456
    ErrorDoExit();
457
 
245 dpurdie 458
#DebugDumpData ("depends", \%depends );
459
 
227 dpurdie 460
    #
461
    #   Determine the build order
462
    #
463
    @build_order = ();
464
    my $more = 1;
465
    my $level = 0;
466
 
467
    #
255 dpurdie 468
    #   Remove any dependencies to 'external' packages
227 dpurdie 469
    #   These will not be met internally and can be regarded as constant
470
    #
1273 dpurdie 471
    #   Split 'depends' into internal (ideps) and external (edeps)
472
    #       edeps : External Dependencies
473
    #               Key:        Name;Version
474
    #               Value:      'tag' - index into packages
475
    #       ideps : Internal Dependencies
476
    #               Key:        'tag'   - Index into packages
477
    #               Value:      'dname' - Display Name
478
    #
227 dpurdie 479
    foreach my $key ( keys %depends )
480
    {
481
        foreach my $build ( keys( %{$depends{$key}{depends}} ))
482
        {
483
            unless (exists $depends{$build})
484
            {
1273 dpurdie 485
                $depends{$key}{'edeps'}{$depends{$key}{depends}{$build}} = $build;
227 dpurdie 486
                delete ($depends{$key}{depends}{$build}) ;
487
                Verbose2( "Not in set: $build");
488
            }
489
            else
490
            {
1273 dpurdie 491
                $depends{$key}{'ideps'}{$build} = $depends{$build}{dname};
227 dpurdie 492
            }
493
        }
494
    }
359 dpurdie 495
 
496
#DebugDumpData ("depends", \%depends );
497
 
361 dpurdie 498
 
359 dpurdie 499
    #
500
    #   Determine package build order
501
    #       Scan the list of packages in the build set and determine
502
    #       those with no dependencies. These can be built.
503
    #       Remove those packages as dependents from all packages
504
    #       Repeat.
505
    #
1328 dpurdie 506
    my %found    = map { $_ => 1 } @opt_ignorePackage;
507
    my %notFound = map { $_ => 1 } @opt_justPackage;
1273 dpurdie 508
    my $scan_start = 0;
509
    my $scan_stop = 0;
1328 dpurdie 510
    my $scan_active = ($opt_fromPackage) ? 0 : 1;
511
    $scan_active = 0 if ( !$opt_fromPackage && !$opt_fromPackage && !@opt_ignorePackage && @opt_justPackage );
1273 dpurdie 512
 
227 dpurdie 513
    while ( $more )
514
    {
515
        $more = 0;
516
        $level++;
517
        my @build;
518
 
519
        #
520
        #   Locate packages with no dependencies
521
        #
522
        foreach my $key ( keys %depends )
523
        {
524
            next if ( keys( %{$depends{$key}{depends}} ) );
525
            push @build, $key;
526
        }
527
 
528
        foreach my $build ( @build )
529
        {
530
            $more = 1;
1273 dpurdie 531
            my $fe = $depends{$build};
532
            my $scan_add = $scan_active ? 1 : 0;
533
 
1328 dpurdie 534
            if ( $opt_fromPackage && (($fe->{mname} eq $opt_fromPackage) || ($fe->{name} eq $opt_fromPackage)))
1273 dpurdie 535
            {
1328 dpurdie 536
                $scan_add = 1;
537
                $scan_active = 1;
538
                $scan_start = 1;
539
            }
540
 
541
            if ( $opt_toPackage && (($fe->{mname} eq $opt_toPackage) || ($fe->{name} eq $opt_toPackage)))
542
            {
1273 dpurdie 543
                $scan_add = 0;
1328 dpurdie 544
                $scan_active = 0;
545
                $scan_stop = 1;
546
            }
547
 
548
            if ( @opt_justPackage )
549
            {
550
                foreach my $pname ( @opt_justPackage )
1273 dpurdie 551
                {
552
                    if ( (($fe->{mname} eq $pname) || ($fe->{name} eq $pname)))
553
                    {
554
                        $scan_add = 1;
555
                        delete $notFound{$pname};
556
                    }
557
                }
558
            }
1328 dpurdie 559
 
1273 dpurdie 560
            if ( @opt_ignorePackage )
561
            {
562
                foreach my $pname ( @opt_ignorePackage )
563
                {
564
                    if ( (($fe->{mname} eq $pname) || ($fe->{name} eq $pname)))
565
                    {
566
                        $scan_add = 0;
567
                        delete $found{$pname};
568
                    }
569
                }
570
            }
571
 
227 dpurdie 572
            $fe->{level} = $level;
1273 dpurdie 573
            $fe->{buildActive} = $scan_add;
227 dpurdie 574
            $packages{$build} = $fe;
1273 dpurdie 575
            push (@build_order, $fe) if ( $scan_add || $info );
227 dpurdie 576
            delete $depends{$build};
577
            delete $fe->{depends};                          # remove now its not needed
578
        }
579
 
580
        foreach my $key ( keys %depends )
581
        {
582
            foreach my $build ( @build )
583
            {
584
                delete $depends{$key}{depends}{$build};
585
            }
586
        }
587
    }
588
 
589
    #
1273 dpurdie 590
    #   Detect bad user specifications
591
    #
592
    ReportError ("Specified FromPackage not found: $opt_fromPackage") if ( $opt_fromPackage && !$scan_start );
593
    ReportError ("Specified ToPackage not found: $opt_toPackage") if ( $opt_toPackage && !$scan_stop );
594
    ReportError ("Specified ExactPackages not found: ", keys( %notFound) ) if ( %notFound );
595
    ReportError ("Specified IgnorePackages not found: ", keys( %found) ) if ( %found );
596
    ErrorDoExit();
597
 
598
    #
599
    #   Calculate the external dependencies
600
    #       Only process packages that are a part of the build
601
    #
602
    #   extern_deps structure
603
    #       Hash key: 'tag'   - Index into packages
604
    #          Value: Hash of:
605
    #                 Key  : Name;Version
606
    #                 Value: Array of: 'tags' (Index into packages)
607
    #                                   of packages that use the external
608
    #                                   component.
609
    {
610
        Verbose ("Calculate external dependencies");
611
        %extern_deps = ();
612
 
613
        foreach my $key ( keys %packages )
614
        {
615
                next unless ( $packages{$key}{buildActive} );
616
                next unless ( $packages{$key}{'edeps'} );
617
                foreach ( keys %{$packages{$key}{'edeps'}} )
618
                {
619
                    push @{$extern_deps{$packages{$key}{'edeps'}{$_}} {$_} }, $key;
620
                }
621
        }
622
    }
623
 
624
    #
227 dpurdie 625
    #   Just to be sure to be sure
626
    #
245 dpurdie 627
    if ( keys %depends )
628
    {
629
        #DebugDumpData ("depends", \%depends );
630
        Error( "Internal algorithm error: Bad dependancy walk",
631
               "Possible circular dependency");
632
    }
227 dpurdie 633
 
1273 dpurdie 634
#   DebugDumpData("Packages", \%packages);
359 dpurdie 635
#   DebugDumpData ("Order", \@build_order);
636
#   DebugDumpData("External Depends", \%extern_deps );
227 dpurdie 637
}
638
 
639
#-------------------------------------------------------------------------------
640
# Function        : cmd
641
#
642
# Description     : Execute a command in all the sandboxes
643
#                       Locate the base of the sandbox
644
#                       Locate all packages in the sandbox
645
#                       Locate all build files in each sandbox
646
#                       Determine build order
647
#                       Issue commands for each sandbox in order
648
#
255 dpurdie 649
# Inputs          : Arguments passed to jats build
227 dpurdie 650
#
651
# Returns         : Will exit
652
#
653
sub cmd
654
{
1328 dpurdie 655
    my ($hcmd, @cmd_opts ) = @_;
359 dpurdie 656
 
657
    Getopt::Long::Configure('pass_through');
1328 dpurdie 658
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
359 dpurdie 659
    SubCommandHelp( $opt_help, $hcmd) if ($opt_help  );
660
 
227 dpurdie 661
    #
662
    #   Determine Sandbox information
663
    #   Populate global variables
664
    #
665
    calc_sandbox_info();
666
    foreach my $fe ( @build_order )
667
    {
668
        my $dir = $fe->{dir};
359 dpurdie 669
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
227 dpurdie 670
                  DisplayPath ("        Path: $fe->{dir}" ));
671
 
1328 dpurdie 672
        my $result = JatsCmd( "-cd=$dir", @cmd_opts);
255 dpurdie 673
        Error ("Cmd failure") if ( $result );
227 dpurdie 674
    }
675
 
676
    exit 0;
677
}
678
 
679
#-------------------------------------------------------------------------------
331 dpurdie 680
# Function        : buildcmd
681
#
682
# Description     : Build the entire sandbox
683
#                   The all and the build are similar.
684
#                   Its not really useful to do a build without a make
685
#                   so we don't try
686
#
687
# Inputs          : Arguments passed to jats make
688
#
689
#
690
# Returns         : Will exit
691
#
692
 
693
sub buildcmd
694
{
337 dpurdie 695
    my ($cmd, @cmd_opts) = @_;
331 dpurdie 696
    my @build_opts;
337 dpurdie 697
    my @make_opts;
331 dpurdie 698
 
699
    #
359 dpurdie 700
    #   Extract and options
701
    #
702
    Getopt::Long::Configure('pass_through');
1328 dpurdie 703
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
359 dpurdie 704
    SubCommandHelp( $opt_help, "Command $cmd") if ($opt_help );
361 dpurdie 705
 
359 dpurdie 706
    #
331 dpurdie 707
    #   Insert default options
708
    #
709
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
710
    push @build_opts, '-force' if ( $cmd ne 'all' );
711
 
337 dpurdie 712
    #
713
    #   Attempt to split the options into build and make options
714
    #   Only handle the often used options to build.
715
    #
716
    foreach  ( @cmd_opts )
717
    {
718
        if ( m/^-cache/ || m/^-package/ || m/^-forcebuildpkg/ || m/-expert/) {
719
            push @build_opts, $_;
720
        } else {
721
            push @make_opts, $_;
722
        }
723
    }
724
 
331 dpurdie 725
    push @make_opts, 'all'  unless ( @make_opts  );
726
 
727
    #
728
    #   Determine Sandbox information
729
    #   Populate global variables
730
    #
731
    calc_sandbox_info();
732
    foreach my $fe ( @build_order )
733
    {
734
        my $dir = $fe->{dir};
359 dpurdie 735
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
331 dpurdie 736
                  DisplayPath ("        Path: $fe->{dir}" ));
737
 
738
        JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
739
        JatsCmd( "-cd=$dir", 'make',  @make_opts)  && Error ("Make Cmd failure")  if ( $result );
740
    }
741
 
742
    exit 0;
743
}
744
 
745
 
746
#-------------------------------------------------------------------------------
273 dpurdie 747
# Function        : clean
748
#
749
# Description     : Execute a command in all the sandboxes
750
#                       Locate the base of the sandbox
751
#                       Locate all packages in the sandbox
752
#                       Locate all build files in each sandbox
753
#                       Determine build order
754
#                       Issue commands for each sandbox in order
755
#
756
# Inputs          : Arguments passed to jats build
757
#
758
# Returns         : Will exit
759
#
760
sub clean
761
{
1328 dpurdie 762
    my ($mode, @cmd_opts ) = @_;
359 dpurdie 763
 
273 dpurdie 764
    #
359 dpurdie 765
    #   Extract and options
766
    #
767
    Getopt::Long::Configure('pass_through');
1328 dpurdie 768
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
359 dpurdie 769
    SubCommandHelp( $opt_help, "Clean") if ($opt_help );
770
 
771
    #
273 dpurdie 772
    #   Determine Sandbox information
773
    #   Populate global variables
774
    #
775
    calc_sandbox_info();
776
 
777
    my @cmd = $mode eq 'clobber' ? ('clobber') : ('make', 'clean' );
778
 
779
    #
780
    #   Clobber and clean need to be done in the reverse order
781
    #
782
    foreach my $fe ( reverse @build_order )
783
    {
784
        my $dir = $fe->{dir};
359 dpurdie 785
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
273 dpurdie 786
                  DisplayPath ("        Path: $fe->{dir}" ));
787
 
1328 dpurdie 788
        my $result = JatsCmd( "-cd=$dir", @cmd, @cmd_opts);
273 dpurdie 789
        Error ("Cmd failure") if ( $result );
790
    }
791
 
792
    exit 0;
793
}
794
 
795
 
796
#-------------------------------------------------------------------------------
337 dpurdie 797
# Function        : cache
798
#
799
# Description     : Cache external packages into the sandbox
800
#
801
# Inputs          : @opts                   - User options
802
#
803
# Returns         : Nothing
804
#
805
sub cache
806
{
1328 dpurdie 807
    my (@cmd_opts) = @_;
337 dpurdie 808
 
1328 dpurdie 809
    getOptionsFromArray ( \@cmd_opts ) || Error ("Invalid command line" );
810
    SubCommandHelp( $opt_help, "Cache") if ($opt_help || $#cmd_opts >= 0 );
359 dpurdie 811
 
337 dpurdie 812
    #
813
    #   Determine Sandbox information
814
    #   Populate global variables
815
    #
816
    Message("Cache External Dependencies");
817
    calc_sandbox_info();
818
 
819
    #
1273 dpurdie 820
    #   Walk the list of external dependencies and cache each one
337 dpurdie 821
    #
822
    foreach my $de ( sort keys %extern_deps )
823
    {
824
        my @vlist = keys %{$extern_deps{$de}};
359 dpurdie 825
        foreach my $pve ( @vlist )
337 dpurdie 826
        {
359 dpurdie 827
            my ($pn,$pv) = split( $; , $pve );
828
            Message ("Cache ${pn} ${pv}");
829
            JatsTool ('cache_dpkg', "${pn}/${pv}" );
337 dpurdie 830
        }
831
    }
361 dpurdie 832
 
337 dpurdie 833
    exit 0;
361 dpurdie 834
 
337 dpurdie 835
}
836
 
359 dpurdie 837
#-------------------------------------------------------------------------------
838
# Function        : populate
839
#
840
# Description     : Populate the sandbox with package versions
841
#
842
#
843
# Inputs          : commands            - Array of command line arguments
844
#                   Mode-0:
845
#
846
#                       pkg_name pkg_version        - Import files for named package
847
#                       options:
848
#                           -recurse                - Import dependent packages too
849
#                           -missing                - Import dependencies not in dpkg_archive
850
#                           -test                   - Show what would be done
851
#                           -extractfiles           - Extract file, no view
852
#
853
#
854
#
855
#
856
# Returns         : Does not return
857
#
858
use JatsRmApi;
859
use DBI;
337 dpurdie 860
 
359 dpurdie 861
#
862
#   Data Base Interface
863
#
864
my $RM_DB;
865
my $PopLevel = 0;
866
my %PopPackage;
867
my @StrayPackages;
868
my @PopBase;
869
 
870
sub populate
871
{
1328 dpurdie 872
    my (@cmd_opts ) = @_;
359 dpurdie 873
    my $opt_missing = 0;
874
    my $opt_recurse = 0;
875
    my $opt_test = 0;
1328 dpurdie 876
    my $opt_show = 0;
359 dpurdie 877
    my $opt_extractfiles;
878
    my @opt_extract = qw(-extract);
879
    my @opt_fnames;
1328 dpurdie 880
    my @opt_exclude;
881
    my $opt_all;
359 dpurdie 882
 
1328 dpurdie 883
 
359 dpurdie 884
    Getopt::Long::Configure('pass_through');
1328 dpurdie 885
    getOptionsFromArray ( \@cmd_opts,
886
                "all"               => \$opt_all,
887
                "missing"           => \$opt_missing,
888
                "test"              => \$opt_test,
889
                "show"              => \$opt_show,
890
                "recurse:100"       => \$opt_recurse,
891
                'excludePackage:s'  => sub{ opts_add2List( \@opt_exclude, @_ )},
359 dpurdie 892
                ) || Error ("Invalid command line" );
893
 
894
    SubCommandHelp( $opt_help, "Populate Sandbox") if ($opt_help );
895
 
896
    #
1328 dpurdie 897
    #   Sanity tests
898
    #
899
    Error ("Populate: -missing and -all options are mutually exclusive")
900
        if ( $opt_missing && $opt_all );
901
 
902
    #
359 dpurdie 903
    #   Extract options for the jats extract utility
904
    #
1328 dpurdie 905
    foreach ( @cmd_opts )
359 dpurdie 906
    {
907
        if ( m~^-~ ) {
908
            push ( @opt_extract, $_);
909
        } else {
910
            push ( @opt_fnames, $_);
911
        }
912
    }
913
 
914
    #
915
    #   Allow exactly zero or two 'bare' arguments
916
    #   Create an array of package-versions to be processed.
917
    #
918
    if ( $#opt_fnames >= 0 )
919
    {
365 dpurdie 920
        Error ("Populate: Must specify both a package name and version")
359 dpurdie 921
            if ( $#opt_fnames != 1 );
922
        push @PopBase, join( $;, @opt_fnames );
923
    }
1328 dpurdie 924
    elsif ( $opt_missing || $opt_all )
359 dpurdie 925
    {
926
        #
927
        #   User has not provided a package name to extract
1328 dpurdie 928
        #   Assume that the user will want all or missing dependencies
359 dpurdie 929
        #
930
        #   Determine packages that are not present
931
        #
932
        calc_sandbox_info();
933
 
934
        #
935
        # Scan for missing dependencies
936
        #
937
        foreach my $de ( sort keys %extern_deps )
938
        {
939
            my @vlist = keys %{$extern_deps{$de}};
940
            foreach my $pve ( @vlist )
941
            {
942
                my ($pn,$pv) = split( $; , $pve );
1328 dpurdie 943
                unless ($opt_missing && check_package_existance( $pn, $pv ))
359 dpurdie 944
                {
945
                    push @PopBase, join( $;, $pn , $pv );
946
                }
947
            }
948
        }
949
    }
950
    else
951
    {
952
        Error ("No command or option specified. See help for command usage");
953
    }
954
 
955
    #
956
    #   Process the list of package-versions
957
    #   These are top level packages. Get details from Release Manager
958
    #
959
    #DebugDumpData("Data", \@PopBase );
960
    $PopLevel = 0;
961
    foreach my $entry ( @PopBase )
962
    {
963
        my ($pname, $pver ) = split( $; , $entry);
964
 
965
        my $pv_id = getPkgDetailsByName($pname, $pver);
966
        Error ("populate: $pname, $pver not found in Release Manager" )
967
            unless ( $pv_id );
968
        getPkgDetailsByPV_ID($pv_id);
969
    }
970
    #
971
    #   If recursing then process packages that have yet to
972
    #   be processed. At the start there will be the initial user specified
973
    #   packages on the list. Place a marker at the end so that we can
974
    #   determine how far we are recursing down the dependency tree.
975
    #
1328 dpurdie 976
    $opt_recurse = ($opt_all ? 100 : $opt_recurse);
359 dpurdie 977
    if ( $opt_recurse )
978
    {
979
        my $marker = join($; , '_NEXT_LEVEL_', 0, 0 );
980
        push @StrayPackages, $marker;
981
        $PopLevel++;
982
 
983
        while ( $#StrayPackages >= 0 )
984
        {
985
            my ($name, $ver, $pv_id) = split($;, shift @StrayPackages);
986
 
987
            #
988
            #   Marker.
989
            #   Increment the level of recursion
990
            #   Detect end conditions
991
            #
992
            if ( $name eq '_NEXT_LEVEL_' )
993
            {
994
                last unless ($#StrayPackages >= 0 );
995
                $PopLevel++;
996
                last if ( $PopLevel > $opt_recurse );
997
                push @StrayPackages, $marker;
998
                next;
999
            }
1000
 
1001
            next if ( exists $PopPackage{$name}{$ver}{done} );
1002
            getPkgDetailsByPV_ID ( $pv_id );
1003
            #print "Stray: $pv_id, $name, $ver\n";
1004
        }
1005
    }
1006
    #DebugDumpData("Data", \%PopPackage );
1007
 
1008
    #
1009
    #   Determine packages that need to be extracted
1328 dpurdie 1010
    #   Sort alphabetically - case insensitive
359 dpurdie 1011
    #
1328 dpurdie 1012
    foreach my $pname ( sort {lc($a) cmp lc($b)} keys %PopPackage )
359 dpurdie 1013
    {
1328 dpurdie 1014
        pkgscan:
359 dpurdie 1015
        foreach my $pver ( sort keys %{$PopPackage{$pname}} )
1016
        {
1017
            #
1018
            #   Create a nice view name for the extraction
365 dpurdie 1019
            #   Will also be used to test for package existence
359 dpurdie 1020
            #
1021
            my $vname = "$pname $pver";
1022
            $vname =~ s~ ~_~g;
1023
            $vname =~ s~__~~g;
1024
 
1025
            if ( -d "$GBE_SANDBOX/$vname" )
1026
            {
1027
                Warning("Package already in sandbox: $pname, $pver");
1028
                next;
1029
            }
1030
 
1031
            #
1032
            #   If scanning for missing packages, then examine archives
1033
            #   for the packages existence. Don't do this on level-0 packages
1034
            #   These have been user specified.
1035
            #
1036
            if ( $opt_missing && $PopPackage{$pname}{$pver}{level}  )
1037
            {
1038
                my $found = check_package_existance( $pname, $pver );
1039
                if ( $found )
1040
                {
1041
                    Verbose ("Package found in archive - skipped: $pname, $pver");
1042
                    next;
1043
                }
1044
            }
1045
 
1046
            #
1328 dpurdie 1047
            #   Has the user specifically excluded this package
1048
            #   Allow three forms
1049
            #       packageName
1050
            #       packageName_Version
1051
            #       packageName.projectName
1052
            #
1053
            my $excluded;
1054
            foreach my $ename ( @opt_exclude )
1055
            {
1056
                if ( $ename eq $pname ) {
1057
                    $excluded = 1;
1058
                } elsif ($ename eq $pname .'_' . $pver ) {
1059
                    $excluded = 1;
1060
                } else {
1061
                    if ( $pver =~ m~(\.[a-z]{2,4})$~ )
1062
                    {
1063
                        $excluded = ($ename eq $pname . $1 );
1064
                    }
1065
                }
1066
 
1067
                if ( $excluded )
1068
                {
1069
                    Message ("Package excluded by user - skipped: $pname, $pver");
1070
                    next pkgscan;
1071
                }
1072
            }
1073
 
1074
            #
359 dpurdie 1075
            #   Generate commands to extract the package
1076
            #
1077
            my $vcstag = $PopPackage{$pname}{$pver}{vcstag};
1078
            my @cmd = qw(jats_vcsrelease);
1079
            push @cmd, "-view=$vname", "-label=$vcstag", @opt_extract;
1328 dpurdie 1080
            if ( $opt_show )
359 dpurdie 1081
            {
1328 dpurdie 1082
                Message ("$pname $pver");
1083
            }
1084
            elsif ( $opt_test )
1085
            {
359 dpurdie 1086
                Message "jats " . QuoteCommand (@cmd );
1087
            }
1088
            else
1089
            {
1090
                Message "Extracting: $pname $pver";
1091
                my $rv = JatsCmd (@cmd);
1092
                Error ("Package version not extracted")
1093
                    if ( $rv );
1094
            }
1095
        }
1096
    }
1097
 
1098
    #
1099
    # This command does not return
1100
    #
1101
    exit (0);
1102
}
1103
 
337 dpurdie 1104
#-------------------------------------------------------------------------------
359 dpurdie 1105
# Function        : getPkgDetailsByName
1106
#
1107
# Description     : Determine the PVID for a given package name and version
1108
#
1109
# Inputs          : $pname          - Package name
1110
#                   $pver           - Package Version
1111
#
361 dpurdie 1112
# Returns         :
359 dpurdie 1113
#
1114
 
1115
sub getPkgDetailsByName
1116
{
1117
    my ($pname, $pver) = @_;
1118
    my $pv_id;
1119
    my (@row);
1120
 
1121
    connectRM(\$RM_DB) unless ($RM_DB);
1122
 
1123
    # First get details for a given package version
1124
 
1125
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION" .
1126
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
1127
                    " WHERE pkg.PKG_NAME = \'$pname\' AND pv.PKG_VERSION = \'$pver\' AND pv.PKG_ID = pkg.PKG_ID";
1128
    my $sth = $RM_DB->prepare($m_sqlstr);
1129
    if ( defined($sth) )
1130
    {
1131
        if ( $sth->execute( ) )
1132
        {
1133
            if ( $sth->rows )
1134
            {
1135
                while ( @row = $sth->fetchrow_array )
1136
                {
1137
                    $pv_id = $row[0];
1138
                    my $name = $row[1];
1139
                    my $ver = $row[2];
1140
                    Verbose( "getPkgDetailsByName :PV_ID= $pv_id");
1141
                }
1142
            }
1143
            $sth->finish();
1144
        }
1145
    }
1146
    else
1147
    {
1148
        Error("Prepare failure" );
1149
    }
1150
    return $pv_id;
1151
}
1152
 
1153
#-------------------------------------------------------------------------------
1154
# Function        : getPkgDetailsByPV_ID
1155
#
1156
# Description     : Populate the Packages structure given a PV_ID
1157
#                   Called for each package in the SBOM
1158
#
1159
# Inputs          : PV_ID           - Package Unique Identifier
1160
#
1161
# Returns         : Populates Package
1162
#
1163
sub getPkgDetailsByPV_ID
1164
{
1165
    my ($PV_ID) = @_;
1166
    my $foundDetails = 0;
1167
    my (@row);
1168
 
1169
    connectRM(\$RM_DB) unless ($RM_DB);
1170
 
1171
    # First get details from pv_id
1172
 
1173
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, release_manager.PK_RMAPI.return_vcs_tag($PV_ID)" .
1174
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg " .
1175
                    " WHERE pv.PV_ID = \'$PV_ID\' AND pv.PKG_ID = pkg.PKG_ID";
1176
 
1177
    my $sth = $RM_DB->prepare($m_sqlstr);
1178
    if ( defined($sth) )
1179
    {
1180
        if ( $sth->execute( ) )
1181
        {
1182
            if ( $sth->rows )
1183
            {
1184
                while ( @row = $sth->fetchrow_array )
1185
                {
1186
                    my $pv_id       = $row[0];
1187
                    my $name        = $row[1];
1188
                    my $ver         = $row[2];
1189
                    my $vcstag      = $row[3] || '';
1190
 
1191
                    $vcstag =~ tr~\\/~/~;
1192
                    Verbose ("getPkgDetailsByPV_ID: $PV_ID, $name, $ver, $vcstag");
1193
 
1194
                    $PopPackage{$name}{$ver}{pvid} = $PV_ID;
1195
                    $PopPackage{$name}{$ver}{done} = 1;
1196
                    $PopPackage{$name}{$ver}{vcstag} = $vcstag;
1197
                    $PopPackage{$name}{$ver}{level} = $PopLevel;
1198
                    getDependsByPV_ID( $pv_id, $name, $ver );
1199
                }
1200
            }
1201
            else
1202
            {
1203
                Warning ("No Package details for: PVID: $PV_ID");
1204
            }
1205
            $sth->finish();
1206
        }
1207
        else
1208
        {
1209
            Error("getPkgDetailsByPV_ID: Execute failure", $m_sqlstr );
1210
        }
1211
    }
1212
    else
1213
    {
1214
        Error("Prepare failure" );
1215
    }
1216
}
1217
 
1218
#-------------------------------------------------------------------------------
1219
# Function        : getDependsByPV_ID
1220
#
1221
# Description     : Extract the dependancies for a given package version
1222
#
1223
# Inputs          : $pvid
1224
#
1225
# Returns         :
1226
#
1227
sub getDependsByPV_ID
1228
{
1229
    my ($pv_id, $pname, $pver) = @_;
1230
 
1231
    connectRM(\$RM_DB) unless ($RM_DB);
1232
 
1233
    #
365 dpurdie 1234
    #   Now extract the package dependencies
359 dpurdie 1235
    #
1236
    my $m_sqlstr = "SELECT pkg.PKG_NAME, pv.PKG_VERSION, pd.DPV_ID" .
1237
                   " FROM RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
1238
                   " WHERE pd.PV_ID = \'$pv_id\' AND pd.DPV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
1239
    my $sth = $RM_DB->prepare($m_sqlstr);
1240
    if ( defined($sth) )
1241
    {
1242
        if ( $sth->execute( ) )
1243
        {
1244
            if ( $sth->rows )
1245
            {
1246
                while ( my @row = $sth->fetchrow_array )
1247
                {
1248
                    my $name = $row[0];
1249
                    my $ver = $row[1];
1250
 
1251
                    Verbose2( "       Depends: $name, $ver");
1252
                    unless ( exists $PopPackage{$name} && exists $PopPackage{$name}{$ver} && exists $PopPackage{$name}{$ver}{done} )
1253
                    {
1254
                        push @StrayPackages, join($;, $name, $ver, $row[2] );
1255
                    }
1256
                }
1257
            }
1258
            $sth->finish();
1259
        }
1260
    }
1261
    else
1262
    {
1263
        Error("GetDepends:Prepare failure" );
1264
    }
1265
}
1266
 
1267
#-------------------------------------------------------------------------------
1273 dpurdie 1268
# Function        : getOptionsFromArray
1269
#
1270
# Description     : Like getOptions, but handles an array
1271
#                   Provided as the version of Perl used does not have one
1272
#
1273
# Inputs          : pArray                  - Ref to array
1274
#                   ....                    - GetOptions arguments
1275
#
1276
# Returns         : 
1277
#
1278
sub getOptionsFromArray
1279
{
1280
    my ($pArray, %args) = @_;
1281
 
1328 dpurdie 1282
    #
1283
    #   Common arguments
1284
    #
1285
    my %commonOptions = (
1286
        'help|h:+'          => \$opt_help,
1287
        'manual:3'          => \$opt_help,
1288
        'verbose:+'         => \$opt_verbose,
1289
        'topackage:s'       => \$opt_toPackage,
1290
        'frompackage:s'     => \$opt_fromPackage,
1291
        'justpackage:s'     => sub{ opts_add2List( \@opt_justPackage, @_ )},
1292
        'ignorepackage:s'   => sub{ opts_add2List( \@opt_ignorePackage, @_ )},
1293
        );
1294
 
1295
    #
1296
    #   Merge in the user options
1297
    #
1298
    @commonOptions{keys %args} = values %args;
1299
 
1273 dpurdie 1300
    local ( @ARGV );
1301
    @ARGV = @$pArray;
1328 dpurdie 1302
    my $rv = GetOptions ( %commonOptions );
1273 dpurdie 1303
    @$pArray = @ARGV;
1304
 
1328 dpurdie 1305
    ErrorConfig('verbose' => $opt_verbose );
1273 dpurdie 1306
    return $rv;
1307
}
1308
 
1328 dpurdie 1309
#-------------------------------------------------------------------------------
1310
# Function        : opts_add2List
1311
#
1312
# Description     : Option processing helper
1313
#                   Add comma separated options to an array
1314
#                   User can then add items one at a time, or several at once
1315
#
1316
# Inputs          : aref        - Ref to an array to extent
1317
#                   arg2        - Option name
1318
#                   arg3        - Option value
1319
#
1320
# Returns         : 
1321
#
1322
sub opts_add2List
1323
{
1324
    my( $ref, $name, $value) = @_;
1325
    if ( $value )
1326
    {
1327
        foreach ( split(/\s*,\s*/,$value) )
1328
        {
1329
            push @{$ref}, $_;
1330
        }
1331
    }
1332
}
1273 dpurdie 1333
 
1334
#-------------------------------------------------------------------------------
359 dpurdie 1335
# Function        : SubCommandHelp
1336
#
1337
# Description     : Provide help on a subcommand
1338
#
1339
# Inputs          : $help_level             - Help Level 1,2,3
1340
#                   $topic                  - Topic Name
1341
#
1342
# Returns         : This function does not return
1343
#
1344
sub SubCommandHelp
1345
{
1346
    my ($help_level, $topic) = @_;
1347
    my @sections;
1348
    #
1349
    #   Spell out the section we want to display
1350
    #
1351
    #   Note:
1352
    #   Due to bug in pod2usage can't use 'head1' by itself
1353
    #   Each one needs a subsection.
1354
    #
1355
    push @sections, qw( NAME SYNOPSIS ) ;
1356
    push @sections, qw( ARGUMENTS OPTIONS )     if ( $help_level > 1 );
1357
    push @sections, qw( DESCRIPTION EXAMPLES )  if ( $help_level > 2 );
1358
 
1359
    #
1360
    #   Extract section from the POD
1361
    #
1362
    pod2usage({-verbose => 99,
1363
               -noperldoc => 1,
1364
               -sections => $topic . '/' . join('|', @sections) } );
1365
}
1366
 
1367
#-------------------------------------------------------------------------------
227 dpurdie 1368
#   Documentation
359 dpurdie 1369
#   NOTE
227 dpurdie 1370
#
359 dpurdie 1371
#   Each subcommand MUST have
1372
#   head1 section as used by the subcommand
1373
#       This should be empty, as the contents will NOT be displayed
1374
#   head2 sections called
1375
#       NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION EXAMPLES
1376
#
1377
#=head1 xxxxxx
1378
#=head2 NAME
1379
#=head2 SYNOPSIS
1380
#=head2 ARGUMENTS
1381
#=head2 OPTIONS
1382
#=head2 DESCRIPTION
1383
#=head2 EXAMPLES
1384
#
227 dpurdie 1385
 
1386
=pod
1387
 
1388
=head1 NAME
1389
 
1390
jats_sandbox - Build in a Development Sandbox
1391
 
1392
=head1 SYNOPSIS
1393
 
361 dpurdie 1394
  jats sandbox [options] command [command options]
227 dpurdie 1395
 
1396
 Options:
1328 dpurdie 1397
    -help[=n]                  - Display help with specified detail
1398
    -help -help                - Detailed help message
1399
    -man                       - Full documentation
227 dpurdie 1400
 
1328 dpurdie 1401
 Options for recursion control:
1402
    -toPackage=name            - Stop building after package
1273 dpurdie 1403
    -fromPackage=name          - Start building from package
1404
    -justPackage=name[,name]   - Build named packages
1405
    -ignorePackage=name[,name] - Do not build named packages
1406
 
227 dpurdie 1407
 Commands:
1408
    help                - Same as -help
1409
    create              - Create a sandbox in the current directory
359 dpurdie 1410
    populate            - Populate the sandbox with packages
299 dpurdie 1411
    delete              - Delete the sandbox
255 dpurdie 1412
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
227 dpurdie 1413
    cmd                 - Do commands in all sandbox components
1328 dpurdie 1414
    all                 - Do 'build', if required, then a make in all components
331 dpurdie 1415
    build               - Force 'build and make' in all sandbox components
275 dpurdie 1416
    make                - Do 'make' in all sandbox components
273 dpurdie 1417
    clean               - Do 'make clean' in all sandbox components
1418
    clobber             - Do 'build clobber' is all sandbox components
337 dpurdie 1419
    cache               - Cache external dependent packages
227 dpurdie 1420
 
359 dpurdie 1421
 Use the command
1422
    jats sandbox 'command' -h
1423
 for command specific help
361 dpurdie 1424
 
227 dpurdie 1425
=head1 OPTIONS
1426
 
1427
=over 8
1428
 
299 dpurdie 1429
=item B<-help[=n]>
227 dpurdie 1430
 
1431
Print a brief help message and exits.
299 dpurdie 1432
There are three levels of help
227 dpurdie 1433
 
299 dpurdie 1434
=over 8
1435
 
361 dpurdie 1436
=item   1
299 dpurdie 1437
 
361 dpurdie 1438
Brief synopsis
299 dpurdie 1439
 
361 dpurdie 1440
=item   2
299 dpurdie 1441
 
361 dpurdie 1442
Synopsis and option summary
1443
 
1444
=item   3
1445
 
1446
Detailed help in man format
1447
 
299 dpurdie 1448
=back 8
1449
 
227 dpurdie 1450
=item B<-help -help>
1451
 
1452
Print a detailed help message with an explanation for each option.
1453
 
1454
=item B<-man>
1455
 
299 dpurdie 1456
Prints the manual page and exits. This is the same a -help=3
227 dpurdie 1457
 
1328 dpurdie 1458
=item B<-toPackage=name>
1273 dpurdie 1459
 
1460
This option is available in all commands that process multiple packages.
1328 dpurdie 1461
Package processing will stop at the named package.
1273 dpurdie 1462
 
1463
The default operation is to process all packages.
1464
 
1328 dpurdie 1465
=item B<-fromPackage=name>
1273 dpurdie 1466
 
1467
This option is available in all commands that process multiple packages.
1328 dpurdie 1468
Package processing will start at the named package.
1273 dpurdie 1469
 
1328 dpurdie 1470
The default operation is to process no packages.
1273 dpurdie 1471
 
1328 dpurdie 1472
=item B<-justPackage=name[,name]>
1273 dpurdie 1473
 
1474
This option is available in all commands that process multiple packages. The
1328 dpurdie 1475
named packages will be processed in the correct build order. Packages that are
1476
not named will be skipped, unless the package is being processed due to
1477
being in the 'fromPackage' to 'toPackage' range.
1273 dpurdie 1478
 
1479
Multiple packages can be named either by separating names with a comma, or
1480
with multiple options.
1481
 
1328 dpurdie 1482
=item B<-ignorePackage=name[,name]>
1273 dpurdie 1483
 
1484
This option is available in all commands that process multiple packages. The
1485
named packages will not be processed.
1486
 
1487
Multiple packages can be named either by separating names with a comma, or
1488
with multiple options.
1489
 
1490
The exclusion of a package takes precedence over its inclusion.
1491
 
279 dpurdie 1492
=back
1493
 
227 dpurdie 1494
=head1 DESCRIPTION
1495
 
299 dpurdie 1496
This program is the primary tool for the maintenance of Development Sandboxes.
1497
 
227 dpurdie 1498
More documentation will follow.
1499
 
279 dpurdie 1500
=head2 SANDBOX DIRECTORY
1501
 
299 dpurdie 1502
The sandbox directory is marked as being a sandbox through the use of the
1503
'sandbox create' command. This will create a suitable structure within the
279 dpurdie 1504
current directory.
1505
 
1506
Several JATS commands operate differently within a sandbox. The 'extract' and
365 dpurdie 1507
'release' commands will create static views within the sandbox and not the
279 dpurdie 1508
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
1509
 
1510
The sandbox directory contains sub directories, each should contain a single
359 dpurdie 1511
package. Sub directories may be created with the 'jats extract' command or with the
1512
'jats sandbox populate' command.
279 dpurdie 1513
 
1514
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
365 dpurdie 1515
requires that all the packages be contained within a sub directory tree so
279 dpurdie 1516
that the root of the sandbox can be located by a simple scan of the directory
1517
tree.
1518
 
325 dpurdie 1519
If a package subdirectory contains a file called 'stop' or 'stop.
1520
<GBE_MACHTYPE>', then that package will not be considered as a part of the
1521
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
1522
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
1523
type of computer.
279 dpurdie 1524
 
359 dpurdie 1525
=head1 Create Sandbox
299 dpurdie 1526
 
359 dpurdie 1527
=head2 NAME
299 dpurdie 1528
 
359 dpurdie 1529
Create Sandbox
1530
 
1531
=head2 SYNOPSIS
1532
 
1328 dpurdie 1533
jats sandbox create [command options]
359 dpurdie 1534
 
1535
 Command Options
1536
    -help[=n]               - Command specific help, [n=1,2,3]
1537
    -verbose[=n]            - Verbose operation
1538
    -exact                  - Create sandbox to reproduce exact versions
1539
 
1540
=head2 OPTIONS
1541
 
1542
The 'create' command takes the following options:
1543
 
1544
=over 8
1545
 
1546
=item -exact
1547
 
1548
When this option is specified the sandbox is marked for exact processing of
1549
package versions. In this mode the version numbers of the packages in the
1550
sandbox are significant. This is ideal for recreating a package-version.
1551
 
1552
The default is for in-exact processing, in which the version numbers of packages
1553
within the sandbox are not significant. The is ideal for development.
1554
 
1555
=back
1556
 
1557
=head2 DESCRIPTION
1558
 
299 dpurdie 1559
The 'create' command will create a sandbox in the users current directory. It is
1560
not possible to create a sandbox within a sandbox.
1561
 
1562
A sandbox can be created in a directory that contains files and subdirectories.
1563
 
1564
The create command simply places a known directory in the current directory.
359 dpurdie 1565
This directory is used by the sandboxing process. It may be manually deleted, or
299 dpurdie 1566
deleted with the 'delete' command.
1567
 
359 dpurdie 1568
=head1 Populate Sandbox
1569
 
1570
=head2 NAME
1571
 
1572
Populate a Sandbox
1573
 
1574
=head2 SYNOPSIS
1575
 
1328 dpurdie 1576
jats sandbox populate [command options] [packageName packageVersion]
359 dpurdie 1577
 
1578
 Command Options
1328 dpurdie 1579
    -help[=n]                  - Command specific help, [n=1,2,3]
1580
    -toPackage=name            - Stop building after package
1581
    -fromPackage=name          - Start building from package
1582
    -justPackage=name[,name]   - Build named packages
1583
    -ignorePackage=name[,name] - Do not build named packages
1584
    -excludePackage=name[,name]- Do not extract named package
1585
    -recurse[=n]               - Locate dependencies within packages
1586
    -all                       - Populate with all dependencies
1587
    -missing                   - Locate missing packages
1588
    -show                      - Show packages that would be extracted
1589
    -test                      - Do not extract packages
1590
    -<Other>                   - Pass options to jats extract
359 dpurdie 1591
 
1592
=head2 ARGUMENTS
1593
 
1594
The 'populate' command can take a package name and version as arguments. It will
1595
then populate the sandbox with this package. See 'DESCRIPTION' for details.
1596
 
1597
=head2 OPTIONS
1598
 
1599
The 'populate' command takes the following options:
1600
 
1601
=over 4
1602
 
1328 dpurdie 1603
=item -excludePackage=name[,name]
1604
 
1605
This option prevents one, or more, packages from populating the sandbox.
1606
Packages specified with this option will not be extracted from version control
1607
and added to the sandbox.
1608
 
1609
Packages can be itentified in three ways:
1610
 
1611
=over 4
1612
 
1613
=item 1. Package Name
1614
 
1615
All package versions matching the named package will be excluded.
1616
 
1617
=item 2. Package Name and Version
1618
 
1619
Only the specified version of the named package will be excluded. The
1620
user specifies the package name and version as a single string separated with
1621
an underscore. ie: core_devl_2.100.5000.cr
1622
 
1623
=item 3. Package Name and Suffix
1624
 
1625
All packages matching the named package and project will be excluded. The
1626
user specifies the package name and project as a single string separated with
1627
a dot. ie: core_devl.cr
1628
 
1629
 
1630
=back
1631
 
359 dpurdie 1632
=item -recurse[=N]
1633
 
1634
This option will modify the operation of the command such that dependencies
1635
of named packages can also be extracted into the sandbox.
1636
 
1637
The default operation is to only extract named packages. If the option is
1638
specified then all dependent packages are processed. An optional numeric argument
1639
can be specified to limit the depth of the recursion.
1640
 
1328 dpurdie 1641
=item -all
1642
 
1643
This option will populate the sandbox will all dependencies of packages that are
1644
currently in the sandbox.
1645
 
1646
The global options that control recursion will affect the packages that are
1647
processed.
1648
 
1649
This option cannot be used with the '-missing' option.
1650
 
359 dpurdie 1651
=item -missing
1652
 
1653
This option will modify the operation of the dependency recursion scanning such
1654
that dependent packages that exist in a package archive will not be extracted.
1655
 
1656
Use of this option allows a sandbox to be populated with packages that are
1657
required by packages in the sandbox, but are not available in a package archive.
1658
 
1328 dpurdie 1659
The global options that control recursion will affect the packages that are
1660
processed.
1661
 
1662
This option cannot be used with the '-all' option.
1663
 
1664
=item -show
1665
 
1666
This option will prevent the command from performing the extraction. It will
1667
simply display the names of the packages that would be extracted.
1668
 
359 dpurdie 1669
=item -test
1670
 
1671
This option will prevent the command from performing the extraction. It will
1672
simply display the JATS commands that can be used to perform the extraction.
1673
 
1674
=item -<Other>
1675
 
1676
Options not understood by the 'populate' sub command will be passed through
1677
the package extraction program. Useful options include:
1678
 
363 dpurdie 1679
=over 4
359 dpurdie 1680
 
361 dpurdie 1681
=item *
359 dpurdie 1682
 
361 dpurdie 1683
-extractfiles
359 dpurdie 1684
 
361 dpurdie 1685
=item *
1686
 
1687
-branch=<branch name>
1688
 
359 dpurdie 1689
=back
1690
 
1691
=back
1692
 
1693
=head2 DESCRIPTION
1694
 
1695
The 'populate' command can be used to assist in populating the sandbox. It has
1696
two modes of operation.
1697
 
363 dpurdie 1698
=over 4
359 dpurdie 1699
 
361 dpurdie 1700
=item 1
359 dpurdie 1701
 
361 dpurdie 1702
Named Package
1703
 
363 dpurdie 1704
If the user specifies both a package name and a package version then the command
359 dpurdie 1705
will populate the sandbox with that package and optionally its dependencies.
1706
 
361 dpurdie 1707
=item 2
359 dpurdie 1708
 
361 dpurdie 1709
Determine missing dependencies
1710
 
359 dpurdie 1711
If the user does not specify a package name and version, but does specify
1712
the '-missing' option,  then the command will examine the current sandbox and
1713
determine missing dependent packages. It will then populate the sandbox with
1714
these packages and optionally there dependencies.
1715
 
1716
=back
1717
 
1718
=head2 EXAMPLES
1719
 
1720
=over 4
1721
 
361 dpurdie 1722
=item *
359 dpurdie 1723
 
361 dpurdie 1724
jats sandbox populate package1 version1
1725
 
359 dpurdie 1726
This command will populate the sandbox with version1 of package1, if it does not
1727
already exist in the sandbox.
1728
 
361 dpurdie 1729
=item *
359 dpurdie 1730
 
361 dpurdie 1731
jats sandbox populate package1 version1 -recurse -missing
1732
 
359 dpurdie 1733
This command will populate the sandbox with version1 of package1, if it does not
1734
already exist in the sandbox, together will all the packages dependencies that
1735
are not available in a package archive.
1736
 
361 dpurdie 1737
=item *
359 dpurdie 1738
 
361 dpurdie 1739
jats sandbox populate -recurse -missing
1740
 
359 dpurdie 1741
This command will examine the current sandbox and populate the sandbox with
1742
packages that are required to build the packages in the sandbox and the
1743
dependencies of these packages, provide the dependent package is not in a
1744
package archive.
1745
 
361 dpurdie 1746
=item *
359 dpurdie 1747
 
361 dpurdie 1748
jats sandbox populate
1749
 
359 dpurdie 1750
This command will examine the current sandbox and populate the sandbox with
1751
packages that are required to build the packages in the sandbox. It will not
1752
examine the dependents of these packages.
1753
 
1754
=back
1755
 
1756
=head1 Delete Sandbox
1757
 
1758
=head2 NAME
1759
 
365 dpurdie 1760
Delete a a sandbox
359 dpurdie 1761
 
1762
=head2 SYNOPSIS
1763
 
1764
jats sandbox [options] delete
1765
 
1766
 Options:
1767
    -help[=n]               - Help message, [n=1,2,3]
1768
    -man                    - Full documentation [-help=3]
1769
    -verbose[=n]            - Verbose command operation
1770
 
1771
=head2 DESCRIPTION
1772
 
299 dpurdie 1773
The 'delete' command will delete the sandbox's marker directory. The command may
1774
be executed anywhere within the sandbox.
1775
 
359 dpurdie 1776
Once the sandbox has been deleted, the user must remove the components within the
299 dpurdie 1777
sandbox.
1778
 
359 dpurdie 1779
=head1 Sandbox Information
299 dpurdie 1780
 
359 dpurdie 1781
=head2 NAME
1782
 
1783
Display Sandbox Information
1784
 
1785
=head2 SYNOPSIS
1786
 
1328 dpurdie 1787
jats sandbox info [command options]
359 dpurdie 1788
 
1789
 Command Options
1328 dpurdie 1790
    -help[=n]                  - Command specific help, [n=1,2,3]
1791
    -verbose[=n]               - Display more information
1792
    -toPackage=name            - Stop building after package
1793
    -fromPackage=name          - Start building from package
1794
    -justPackage=name[,name]   - Build named packages
1795
    -ignorePackage=name[,name] - Do not build named packages
361 dpurdie 1796
 
359 dpurdie 1797
=head2 OPTIONS
1798
 
1799
=over
1800
 
1801
=item B<-verbose[=n]>
1802
 
1803
This options will increase the verbosity of the information being displayed.
1804
Values 1 and 2 are described in the detailed 'DESCRIPTION'. Other values are
1805
reserved for diagnostic use.
1806
 
1807
=back
1808
 
1809
=head2 DESCRIPTION
1810
 
299 dpurdie 1811
The 'info' command will display information about the build order and the
359 dpurdie 1812
dependencies of packages that it finds within the sandbox.
299 dpurdie 1813
 
359 dpurdie 1814
The command works within various levels of verbosity:
299 dpurdie 1815
 
1816
=over 8
1817
 
361 dpurdie 1818
=item *
299 dpurdie 1819
 
361 dpurdie 1820
No Verbosity
1821
 
299 dpurdie 1822
The basic command will display the build order and the external
335 dpurdie 1823
dependencies. External dependencies may be prefixed with one of the
1824
following indicators:
299 dpurdie 1825
 
335 dpurdie 1826
=over 8
1827
 
361 dpurdie 1828
=item   '+' Multiple versions of this package are being used by sandboxed components.
335 dpurdie 1829
 
361 dpurdie 1830
=item   '*' The package cannot be found in any of the package archives.
335 dpurdie 1831
 
1832
=back
1833
 
361 dpurdie 1834
=item *
299 dpurdie 1835
 
361 dpurdie 1836
Verbosity of 1
1837
 
359 dpurdie 1838
This level of verbosity will display the build order and detailed information
299 dpurdie 1839
on the dependencies. The dependencies will be prefixed with:
1840
 
1841
=over 8
1842
 
361 dpurdie 1843
=item   E Dependent Package is external to the sandbox
299 dpurdie 1844
 
361 dpurdie 1845
=item   I Dependent Package is internal to the sandbox
299 dpurdie 1846
 
1847
=back
1848
 
335 dpurdie 1849
External dependencies may be prefixed with one of the indicators described for
1850
no-verbosity. Additionally the internal consumer of the external package is also
1851
shown. These are prefixed with a 'U'.
299 dpurdie 1852
 
361 dpurdie 1853
=item *
299 dpurdie 1854
 
361 dpurdie 1855
Verbosity of 2
1856
 
359 dpurdie 1857
Reserved for future use
299 dpurdie 1858
 
361 dpurdie 1859
=item *
299 dpurdie 1860
 
361 dpurdie 1861
Verbosity over 2
1862
 
359 dpurdie 1863
This should be considered a debug option. Undocumented internal information will
299 dpurdie 1864
be displayed.
1865
 
1866
=back
1867
 
359 dpurdie 1868
=head1 Command all
331 dpurdie 1869
 
359 dpurdie 1870
=head2 NAME
1871
 
1872
Build packages in the sandbox
1873
 
1874
=head2 SYNOPSIS
1875
 
1328 dpurdie 1876
jats sandbox all [command options] [arguments]
359 dpurdie 1877
 
1878
 Command Options
1328 dpurdie 1879
    -help[=n]                  - Command specific help, [n=1,2,3]
1880
    -toPackage=name            - Stop building after package
1881
    -fromPackage=name          - Start building from package
1882
    -justPackage=name[,name]   - Build named packages
1883
    -ignorePackage=name[,name] - Do not build named packages
359 dpurdie 1884
 
1885
=head2 ARGUMENTS
1886
 
1887
Arguments are passed to the 'make' phase of the process.
1888
 
1889
=head2 OPTIONS
1890
 
1891
The are command specific options.
1892
 
1893
=head2 DESCRIPTION
1894
 
331 dpurdie 1895
The 'all' command will perform build, if the build files are out of date,
1896
followed by a make in each of the packages within the sandbox, in the correct
1897
build order.
1898
 
1899
Any arguments are passed to the 'make' phase of the process.
1900
 
1901
This command may be used to:
1902
 
1903
=over 8
1904
 
361 dpurdie 1905
=item *
331 dpurdie 1906
 
361 dpurdie 1907
Pickup any build file changes.
331 dpurdie 1908
 
361 dpurdie 1909
=item *
1910
 
1911
Resume a failed build.
1912
 
331 dpurdie 1913
=back
1914
 
359 dpurdie 1915
=head1 Command build
331 dpurdie 1916
 
359 dpurdie 1917
=head2 NAME
1918
 
1919
Build packages in the sandbox
1920
 
1921
=head2 SYNOPSIS
1922
 
1328 dpurdie 1923
jats sandbox build [command options] [arguments]
359 dpurdie 1924
 
1925
 Command Options
1328 dpurdie 1926
    -help[=n]                  - Command specific help, [n=1,2,3]
1927
    -toPackage=name            - Stop building after package
1928
    -fromPackage=name          - Start building from package
1929
    -justPackage=name[,name]   - Build named packages
1930
    -ignorePackage=name[,name] - Do not build named packages
359 dpurdie 1931
 
1932
=head2 ARGUMENTS
1933
 
1934
Arguments are passed to the 'make' phase of the process.
1935
 
1936
=head2 OPTIONS
1937
 
1938
The are no command specific options.
1939
 
1940
=head2 DESCRIPTION
1941
 
331 dpurdie 1942
The 'build' command will force a build followed by a make in each of the packages
1943
within the sandbox, in the correct build order.
1944
 
1945
Any arguments are passed to the 'make' phase of the process.
1946
 
1947
In practice, the 'sandbox all' command is quicker.
1948
 
359 dpurdie 1949
=head1 Clean
331 dpurdie 1950
 
359 dpurdie 1951
=head2 NAME
1952
 
1953
Clean all sandbox components
1954
 
1955
=head2 SYNOPSIS
1956
 
1328 dpurdie 1957
jats sandbox clean|clobber [command options]
359 dpurdie 1958
 
1959
 Command Options
1328 dpurdie 1960
    -help[=n]                  - Command specific help, [n=1,2,3]
1961
    -toPackage=name            - Stop building after package
1962
    -fromPackage=name          - Start building from package
1963
    -justPackage=name[,name]   - Build named packages
1964
    -ignorePackage=name[,name] - Do not build named packages
359 dpurdie 1965
 
1966
=head2 ARGUMENTS
1967
 
1968
None
1969
 
1970
=head2 OPTIONS
1971
 
1972
No command specific options
1973
 
1974
=head2 DESCRIPTION
1975
 
1976
The 'clean' command will perform a 'jats make clean' in all components in the
1977
sandbox.
1978
 
1979
The 'clobber' command will perform a 'jats clobber' in all components in the
1980
sandbox.
1981
 
1982
=head1 make
1983
 
1984
=head2 NAME
1985
 
1986
Make packages in the sandbox
1987
 
1988
=head2 SYNOPSIS
1989
 
1328 dpurdie 1990
jats sandbox make [command options] [arguments]
359 dpurdie 1991
 
1992
 Command Options
1328 dpurdie 1993
    -help[=n]                  - Command specific help, [n=1,2,3]
1994
    -toPackage=name            - Stop building after package
1995
    -fromPackage=name          - Start building from package
1996
    -justPackage=name[,name]   - Build named packages
1997
    -ignorePackage=name[,name] - Do not build named packages
359 dpurdie 1998
 
1999
=head2 ARGUMENTS
2000
 
2001
Arguments are passed to the 'make' phase of the process.
2002
 
2003
=head2 OPTIONS
2004
 
2005
The are no command specific options.
2006
 
2007
=head2 DESCRIPTION
2008
 
331 dpurdie 2009
The 'make' command will perform a 'make' operation in each of the packages
2010
within the sandbox, in the correct build order.
2011
 
2012
Any arguments are passed to the 'make'.
2013
 
359 dpurdie 2014
=head1 cmd
331 dpurdie 2015
 
359 dpurdie 2016
=head2 NAME
2017
 
2018
Process each package with a specified command.
2019
 
2020
=head2 SYNOPSIS
2021
 
1328 dpurdie 2022
jats sandbox cmd [command options] [arguments]
359 dpurdie 2023
 
2024
 Command Options
1328 dpurdie 2025
    -help[=n]                  - Command specific help, [n=1,2,3]
2026
    -toPackage=name            - Stop building after package
2027
    -fromPackage=name          - Start building from package
2028
    -justPackage=name[,name]   - Build named packages
2029
    -ignorePackage=name[,name] - Do not build named packages
359 dpurdie 2030
 
2031
=head2 ARGUMENTS
2032
 
2033
Arguments are passed to a JATS command.
2034
 
2035
=head2 OPTIONS
2036
 
2037
The are no command specific options.
2038
 
2039
=head2 DESCRIPTION
2040
 
331 dpurdie 2041
The 'cmd' command will pass all of its arguments to JATS in the build directory
2042
of each of the packages within the sandbox, in the package build order.
2043
 
359 dpurdie 2044
=head1 Cache
331 dpurdie 2045
 
359 dpurdie 2046
=head2 NAME
331 dpurdie 2047
 
359 dpurdie 2048
Cache dependent packages
331 dpurdie 2049
 
359 dpurdie 2050
jats sandbox [options] cache [command options]
331 dpurdie 2051
 
359 dpurdie 2052
 Options:
2053
    -help[=n]               - Help message, [n=1,2,3]
2054
    -man                    - Full documentation [-help=3]
2055
    -verbose[=n]            - Verbose command operation
337 dpurdie 2056
 
359 dpurdie 2057
 Command Options
2058
    -help[=n]               - Command specific help, [n=1,2,3]
337 dpurdie 2059
 
359 dpurdie 2060
=head2 ARGUMENTS
2061
 
2062
The are no command specific arguments.
2063
 
2064
=head2 OPTIONS
2065
 
2066
The are no command specific options.
2067
 
2068
=head2 DESCRIPTION
2069
 
2070
The 'cache' command will cache all external dependent packages into the users
2071
dpkg_archive_cache as defined through the EnvVar GBE_DPKG_CACHE. The result is
2072
similar to the command 'jats sandbox build -cache', without the overhead of
2073
building the sandbox components.
2074
 
2075
This command allows the simple creation of a small development environment that
2076
is not tied to the larger Development Environment. It may then be used in a
337 dpurdie 2077
disconnected mode to perform development.
2078
 
227 dpurdie 2079
=cut
2080