Subversion Repositories DevTools

Rev

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

Rev 341 Rev 359
Line 51... Line 51...
51
#
51
#
52
#   Options
52
#   Options
53
#
53
#
54
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
54
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
55
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
55
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
56
my $opt_help = 0;
56
my $opt_help = 0;                           # Help level
-
 
57
my $opt_exact = 0;                          # Exact (escrow) build
57
 
58
 
58
#
59
#
59
#   Globals - Provided by the JATS environment
60
#   Globals - Provided by the JATS environment
60
#
61
#
61
my $USER         = $ENV{'USER'};
62
my $USER         = $ENV{'USER'};
Line 108... Line 109...
108
#
109
#
109
ErrorConfig( 'name'    => 'SANDBOX',
110
ErrorConfig( 'name'    => 'SANDBOX',
110
             'verbose' => $opt_verbose );
111
             'verbose' => $opt_verbose );
111
 
112
 
112
#
113
#
113
#   Validate user options
114
#   Reconfigure the options parser to allow subcommands to parse options
114
#
115
#
-
 
116
Getopt::Long::Configure('permute');
-
 
117
 
-
 
118
#
-
 
119
#   Determine Sandbox type. Exact or local
-
 
120
#
-
 
121
$opt_exact = (-f  $GBE_SANDBOX . '/sandbox_dpkg_archive/.exact' )
-
 
122
    if ( $GBE_SANDBOX );
115
 
123
 
116
#
124
#
117
#   Parse the user command and decide what to do
125
#   Parse the user command and decide what to do
118
#
126
#
-
 
127
#   Remove user command from the command line. This will leave command options
-
 
128
#   in @ARGV so that they can be parsed by the subcommand.
119
#
129
#
120
my $cmd = shift @ARGV || "";
130
my $cmd = shift @ARGV || "";
121
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
131
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
122
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
-
 
123
create_sandbox()                        if ( $cmd =~ m/^create$/ );
-
 
124
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
-
 
125
cmd(@ARGV)                              if ( $cmd =~ m/^cmd$/ );
-
 
126
buildcmd($cmd, @ARGV )                  if ( $cmd =~ m/(^all$)|(^build$)/  );
132
buildcmd($cmd, @ARGV )                  if ( $cmd =~ m/(^all$)|(^build$)/  );
127
cmd($cmd, @ARGV )                       if ( $cmd =~ m/(^make$)/  );
-
 
128
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
-
 
129
cache(@ARGV)                            if ( $cmd =~ m/^cache$/  );
133
cache(@ARGV)                            if ( $cmd =~ m/^cache$/  );
-
 
134
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
-
 
135
cmd('make', $cmd, @ARGV )               if ( $cmd =~ m/(^make$)/  );
-
 
136
cmd('cmd', @ARGV)                       if ( $cmd =~ m/^cmd$/ );
-
 
137
create_sandbox()                        if ( $cmd =~ m/^create$/ );
-
 
138
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
-
 
139
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
-
 
140
populate(@ARGV)                         if ( $cmd =~ m/^populate$/  );
130
 
141
 
131
Error ("Unknown sandbox command: $cmd");
142
Error ("Unknown sandbox command: $cmd");
132
exit 1;
143
exit 1;
133
 
144
 
134
 
145
 
Line 153... Line 164...
153
# Inputs          : None
164
# Inputs          : None
154
#
165
#
155
#
166
#
156
sub create_sandbox
167
sub create_sandbox
157
{
168
{
-
 
169
    GetOptions (
-
 
170
                "help:+"        => \$opt_help,
-
 
171
                "manual:3"      => \$opt_help,
-
 
172
                "exact"         => \$opt_exact,
-
 
173
                ) || Error ("Invalid command line" );
-
 
174
 
158
    Error ("Unexpected arguments: @ARGV") if ( @ARGV );
175
    SubCommandHelp( $opt_help, "Create Sandbox") if ($opt_help || $#ARGV >= 0 );
-
 
176
 
159
    Error ("Cannot create a sandbox within a sandbox",
177
    Error ("Cannot create a sandbox within a sandbox",
160
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
178
           "Sandbox base is: $GBE_SANDBOX" ) if ( $GBE_SANDBOX );
-
 
179
 
161
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
180
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
-
 
181
 
-
 
182
    TouchFile( 'sandbox_dpkg_archive/.exact', 'Sandbox marker file')
162
    Message ('Sandbox created');
183
        if ($opt_exact);
-
 
184
 
-
 
185
    Message ('Sandbox created' . ($opt_exact ? ' - With exact version number processing' : ''));
163
    exit  0;
186
    exit  0;
164
}
187
}
165
 
188
 
166
#-------------------------------------------------------------------------------
189
#-------------------------------------------------------------------------------
167
# Function        : delete_sandbox
190
# Function        : delete_sandbox
Line 173... Line 196...
173
#
196
#
174
# Returns         : 
197
# Returns         : 
175
#
198
#
176
sub delete_sandbox
199
sub delete_sandbox
177
{
200
{
-
 
201
    GetOptions (
-
 
202
                "help:+"        => \$opt_help,
-
 
203
                "manual:3"      => \$opt_help,
178
    Error ("Unexpected arguments: @ARGV") if ( @ARGV );
204
                ) || Error ("Invalid command line" );
-
 
205
 
-
 
206
    SubCommandHelp( $opt_help, "Delete Sandbox") if ($opt_help || $#ARGV >= 0 );
-
 
207
 
179
    unless ( $GBE_SANDBOX )
208
    unless ( $GBE_SANDBOX )
180
    {
209
    {
181
        Warning("No sandbox found to delete");
210
        Warning("No sandbox found to delete");
182
    }
211
    }
183
    else
212
    else
Line 203... Line 232...
203
#
232
#
204
# Returns         : Will exit
233
# Returns         : Will exit
205
#
234
#
206
sub info
235
sub info
207
{
236
{
208
    #
-
 
209
    #   Allow user to specify verboseness as an argument
-
 
210
    #
-
 
211
    my @unknown;
237
    GetOptions (
212
    foreach  ( @_ )
238
                "help:+"        => \$opt_help,
213
    {
-
 
214
        $opt_verbose++, next if ( m/^-v/ );
239
                "manual:3"      => \$opt_help,
215
        push @unknown, $_;
240
                "verbose:+"     => \$opt_verbose,
216
    }
-
 
217
    Error ("sandbox info: Unknown options: @unknown") if @unknown;
241
                ) || Error ("Invalid command line" );
218
 
242
 
-
 
243
    SubCommandHelp( $opt_help, "Sandbox Information") if ($opt_help || $#ARGV >=0 );
-
 
244
    
219
    #
245
    #
220
    #   Determine Sandbox information
246
    #   Determine Sandbox information
221
    #   Populate global variables
247
    #   Populate global variables
222
    #
248
    #
223
    calc_sandbox_info();
249
    calc_sandbox_info();
224
 
250
 
225
    #
251
    #
226
    #   Display information
252
    #   Display information
227
    #
253
    #
-
 
254
    Message ("Type   : " . ($opt_exact ? 'Exact' : 'Development') );
228
    Message ("Base: $GBE_SANDBOX");
255
    Message ("Base   : $GBE_SANDBOX");
229
    Message ("Archive: $GBE_DPKG_SBOX");
256
    Message ("Archive: $GBE_DPKG_SBOX");
230
 
257
 
231
    Message ("Build Order");
258
    Message ("Build Order");
232
    foreach my $fe ( @build_order )
259
    foreach my $fe ( @build_order )
233
    {
260
    {
234
        Message( "    Level:" . $fe->{level} . " Name: " . $fe->{mname} );
261
        Message( "    Level:" . $fe->{level} . " Name: " . $fe->{dname} );
235
        Message( DisplayPath ("        Path: $fe->{dir}" )) if $opt_verbose;
262
        Message( DisplayPath ("        Path: $fe->{dir}" )) if $opt_verbose;
236
 
263
 
237
        if ( $opt_verbose )
264
        if ( $opt_verbose )
238
        {
265
        {
239
            foreach my $idep ( sort keys %{$fe->{ideps}} )
266
            foreach my $idep ( sort values %{$fe->{'ideps'}} )
240
            {
267
            {
241
                my ($ppn,$pps) = split( $; , $idep);
-
 
242
                Message ("        I:$ppn.$pps");
268
                Message ("        I:$idep");
243
            }
269
            }
244
 
270
 
245
            foreach my $edep ( sort keys %{$fe->{edeps}} )
271
            foreach my $edep ( sort keys %{$fe->{'edeps'}} )
246
            {
272
            {
247
                my ($ppn,$pps) = split( $; , $edep);
273
                my ($ppn,$ppv) = split( $; , $edep);
248
                my $pv = $fe->{edeps}{$edep};
-
 
249
                Message ("        E:$ppn $pv.$pps");
274
                Message ("        E:$ppn $ppv");
250
            }
275
            }
251
            
276
            
252
        }
277
        }
253
    }
278
    }
254
 
279
 
-
 
280
    #
-
 
281
    #   External dependencies flags
-
 
282
    #       * - Package does not exist in dpkg_archive
-
 
283
    #       + - Multiple versions of this package are used
-
 
284
 
255
    Message("External Dependencies");
285
    Message("External Dependencies");
256
    foreach my $de ( sort keys %extern_deps )
286
    foreach my $de ( sort keys %extern_deps )
257
    {
287
    {
258
        my ($pn,$ps) = split( $; , $de);
-
 
259
        my @vlist = keys %{$extern_deps{$de}};
288
        my @vlist = keys %{$extern_deps{$de}};
260
        my $flag = $#vlist ? '+' : '';
289
        my $flag = $#vlist ? '+' : '';
261
        foreach my $pv ( @vlist )
290
        foreach my $pve ( @vlist )
262
        {
291
        {
-
 
292
            my ($pn,$pv) = split( $; , $pve );
263
            my $exists = check_package_existance( $pn, "$pv.$ps") ? '' : '*';
293
            my $exists = check_package_existance($pn,$pv  ) ? '' : '*';
264
            my $flags = sprintf ("%4.4s", $flag . $exists);
294
            my $flags = sprintf ("%4.4s", $flag . $exists);
265
            Message ("${flags}${pn} ${pv}.${ps}");
295
            Message ("${flags}${pn} ${pv}");
266
            if ( $opt_verbose )
296
            if ( $opt_verbose )
267
            {
297
            {
268
                foreach my $pkg ( @{$extern_deps{$de}{$pv}} )
298
                foreach my $pkg ( @{$extern_deps{$de}{$pve}} )
269
                {
299
                {
270
                    my ($ppn,$pps) = split( $; , $pkg);
300
                    my $ppn = join ('.', split( $; , $pkg));
271
                    Message ("        U:$ppn.$pps");
301
                    Message ("        U:$ppn");
272
 
-
 
273
                }
302
                }
274
            }
303
            }
-
 
304
 
275
        }
305
        }
276
    }
306
    }
277
 
307
 
278
    if ( $opt_verbose > 2 )
308
    if ( $opt_verbose > 2 )
279
    {
309
    {
Line 361... Line 391...
361
 
391
 
362
        #
392
        #
363
        #   Locate the build files in each package
393
        #   Locate the build files in each package
364
        #   Scan the build files and extract dependancy information
394
        #   Scan the build files and extract dependancy information
365
        #
395
        #
366
        my $bscanner = BuildFileScanner( $pname, 'build.pl', '--LocateAll', '--ScanDependencies' );
396
        my $bscanner = BuildFileScanner( $pname, 'build.pl',
-
 
397
                                                 '--LocateAll',
-
 
398
                                                 $opt_exact ? '--ScanExactDependencies' : '--ScanDependencies' );
367
        $bscanner->scan();
399
        $bscanner->scan();
368
        my @blist = $bscanner->getInfo();
400
        my @blist = $bscanner->getInfo();
369
        Warning ("Package does not have build files: $pname") unless ( @blist );
401
        Warning ("Package does not have build files: $pname") unless ( @blist );
370
        Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
402
        Warning ("Package has multiple build files: $pname") if ( $#blist > 0 );
371
        push @build_list, @blist;
403
        push @build_list, @blist;
Line 381... Line 413...
381
    my %depends;
413
    my %depends;
382
    my %multi;
414
    my %multi;
383
    foreach my $be ( @build_list )
415
    foreach my $be ( @build_list )
384
    {
416
    {
385
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
417
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
-
 
418
 
-
 
419
        #
-
 
420
        #   Sandbox vs Exact processing
-
 
421
        #       Set a suitable display name
-
 
422
        #       Set a suitable tag
-
 
423
        #
-
 
424
        $be->{dname} = $opt_exact ? $be->{full}    : $be->{mname};
-
 
425
        $be->{tag}   = $opt_exact ? $be->{fullTag} : $be->{package};
-
 
426
 
386
#        DebugDumpData ("be", $be );
427
#        DebugDumpData ("be", $be );
387
 
428
 
388
        #
429
        #
389
        #   Catch multiple builds for the same package
430
        #   Catch multiple builds for the same package
390
        #   Report later - when we have all
431
        #   Report later - when we have all
391
        #
432
        #
392
        next unless ( $be->{mname} );
433
        next unless ( $be->{dname} );
393
        push @{$multi{$be->{mname}}},$be->{dir};
434
        push @{$multi{$be->{dname}}},$be->{dir};
394
 
435
 
395
        #
436
        #
396
        #   Add into dependency struct
437
        #   Add into dependency struct
397
        #
438
        #
398
        $depends{$be->{package}}{depends} = $be->{depends};
439
        $depends{$be->{tag}}{entry} = $be;
399
        $depends{$be->{package}}{entry} = $be;
440
        $depends{$be->{tag}}{depends} = $be->{depends};
400
    }
441
    }
401
 
442
 
402
    foreach my $mname ( sort keys %multi )
443
    foreach my $dname ( sort keys %multi )
403
    {
444
    {
404
        ReportError ("Mutiple builders for : $mname", @{$multi{$mname}} )
445
        ReportError ("Mutiple builders for : $dname", @{$multi{$dname}} )
405
            if ( scalar @{$multi{$mname}} > 1 );
446
            if ( scalar @{$multi{$dname}} > 1 );
406
    }
447
    }
407
    ErrorDoExit();
448
    ErrorDoExit();
408
 
449
 
409
#DebugDumpData ("depends", \%depends );
450
#DebugDumpData ("depends", \%depends );
410
 
451
 
Line 423... Line 464...
423
    {
464
    {
424
        foreach my $build ( keys( %{$depends{$key}{depends}} ))
465
        foreach my $build ( keys( %{$depends{$key}{depends}} ))
425
        {
466
        {
426
            unless (exists $depends{$build})
467
            unless (exists $depends{$build})
427
            {
468
            {
428
                push @{$extern_deps{$build}{$depends{$key}{depends}{$build}}}, $key;
469
                push @{$extern_deps{$build} {$depends{$key}{depends}{$build}} }, $key;
-
 
470
 
429
                $depends{$key}{entry}{edeps}{$build} = $depends{$key}{depends}{$build};
471
                $depends{$key}{entry}{'edeps'}{$depends{$key}{depends}{$build}} = 1;
430
                delete ($depends{$key}{depends}{$build}) ;
472
                delete ($depends{$key}{depends}{$build}) ;
431
                Verbose2( "Not in set: $build");
473
                Verbose2( "Not in set: $build");
432
            }
474
            }
433
            else
475
            else
434
            {
476
            {
435
                $depends{$key}{entry}{ideps}{$build} = 1;
477
                $depends{$key}{entry}{'ideps'}{$build} = $depends{$build}{entry}{dname};
436
            }
478
            }
437
        }
479
        }
438
    }
480
    }
-
 
481
 
-
 
482
#DebugDumpData ("depends", \%depends );
-
 
483
#DebugDumpData ("External Depends", \%extern_deps );
-
 
484
    
-
 
485
 
-
 
486
    #
-
 
487
    #   Determine package build order
-
 
488
    #       Scan the list of packages in the build set and determine
-
 
489
    #       those with no dependencies. These can be built.
-
 
490
    #       Remove those packages as dependents from all packages
-
 
491
    #       Repeat.
-
 
492
    #
439
    while ( $more )
493
    while ( $more )
440
    {
494
    {
441
        $more = 0;
495
        $more = 0;
442
        $level++;
496
        $level++;
443
        my @build;
497
        my @build;
Line 479... Line 533...
479
        #DebugDumpData ("depends", \%depends );
533
        #DebugDumpData ("depends", \%depends );
480
        Error( "Internal algorithm error: Bad dependancy walk",
534
        Error( "Internal algorithm error: Bad dependancy walk",
481
               "Possible circular dependency");
535
               "Possible circular dependency");
482
    }
536
    }
483
 
537
 
484
#    DebugDumpData ("Order", \@build_order);
538
#   DebugDumpData ("Order", \@build_order);
-
 
539
#   DebugDumpData("External Depends", \%extern_deps );
485
}
540
}
486
 
541
 
487
#-------------------------------------------------------------------------------
542
#-------------------------------------------------------------------------------
488
# Function        : cmd
543
# Function        : cmd
489
#
544
#
Line 498... Line 553...
498
#
553
#
499
# Returns         : Will exit
554
# Returns         : Will exit
500
#
555
#
501
sub cmd
556
sub cmd
502
{
557
{
503
    my @cmds = @_;
558
    my ($hcmd, @cmds ) = @_;
-
 
559
 
-
 
560
    Getopt::Long::Configure('pass_through');
-
 
561
    GetOptions (
-
 
562
                "help:+"        => \$opt_help,
-
 
563
                "manual:3"      => \$opt_help,
-
 
564
                ) || Error ("Invalid command line" );
-
 
565
 
-
 
566
    SubCommandHelp( $opt_help, $hcmd) if ($opt_help  );
-
 
567
 
504
    #
568
    #
505
    #   Determine Sandbox information
569
    #   Determine Sandbox information
506
    #   Populate global variables
570
    #   Populate global variables
507
    #
571
    #
508
    calc_sandbox_info();
572
    calc_sandbox_info();
509
    foreach my $fe ( @build_order )
573
    foreach my $fe ( @build_order )
510
    {
574
    {
511
        my $dir = $fe->{dir};
575
        my $dir = $fe->{dir};
512
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
576
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
513
                  DisplayPath ("        Path: $fe->{dir}" ));
577
                  DisplayPath ("        Path: $fe->{dir}" ));
514
 
578
 
515
        my $result = JatsCmd( "-cd=$dir", @cmds);
579
        my $result = JatsCmd( "-cd=$dir", @cmds);
516
        Error ("Cmd failure") if ( $result );
580
        Error ("Cmd failure") if ( $result );
517
    }
581
    }
Line 538... Line 602...
538
    my ($cmd, @cmd_opts) = @_;
602
    my ($cmd, @cmd_opts) = @_;
539
    my @build_opts;
603
    my @build_opts;
540
    my @make_opts;
604
    my @make_opts;
541
 
605
 
542
    #
606
    #
-
 
607
    #   Extract and options
-
 
608
    #
-
 
609
    Getopt::Long::Configure('pass_through');
-
 
610
    GetOptions (
-
 
611
                "help:+"        => \$opt_help,
-
 
612
                "manual:3"      => \$opt_help,
-
 
613
                ) || Error ("Invalid command line" );
-
 
614
 
-
 
615
    SubCommandHelp( $opt_help, "Command $cmd") if ($opt_help );
-
 
616
    
-
 
617
    #
543
    #   Insert default options
618
    #   Insert default options
544
    #
619
    #
545
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
620
    push @build_opts, '-noforce' if ( $cmd eq 'all' );
546
    push @build_opts, '-force' if ( $cmd ne 'all' );
621
    push @build_opts, '-force' if ( $cmd ne 'all' );
547
 
622
 
Line 566... Line 641...
566
    #
641
    #
567
    calc_sandbox_info();
642
    calc_sandbox_info();
568
    foreach my $fe ( @build_order )
643
    foreach my $fe ( @build_order )
569
    {
644
    {
570
        my $dir = $fe->{dir};
645
        my $dir = $fe->{dir};
571
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
646
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
572
                  DisplayPath ("        Path: $fe->{dir}" ));
647
                  DisplayPath ("        Path: $fe->{dir}" ));
573
 
648
 
574
        JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
649
        JatsCmd( "-cd=$dir", 'build', @build_opts) && Error ("Build Cmd failure") if ( $result );
575
        JatsCmd( "-cd=$dir", 'make',  @make_opts)  && Error ("Make Cmd failure")  if ( $result );
650
        JatsCmd( "-cd=$dir", 'make',  @make_opts)  && Error ("Make Cmd failure")  if ( $result );
576
    }
651
    }
Line 594... Line 669...
594
# Returns         : Will exit
669
# Returns         : Will exit
595
#
670
#
596
sub clean
671
sub clean
597
{
672
{
598
    my ($mode, @cmds ) = @_;
673
    my ($mode, @cmds ) = @_;
-
 
674
 
-
 
675
    #
-
 
676
    #   Extract and options
-
 
677
    #
-
 
678
    Getopt::Long::Configure('pass_through');
-
 
679
    GetOptions (
-
 
680
                "help:+"        => \$opt_help,
-
 
681
                "manual:3"      => \$opt_help,
-
 
682
                ) || Error ("Invalid command line" );
-
 
683
 
-
 
684
    SubCommandHelp( $opt_help, "Clean") if ($opt_help );
-
 
685
 
599
    #
686
    #
600
    #   Determine Sandbox information
687
    #   Determine Sandbox information
601
    #   Populate global variables
688
    #   Populate global variables
602
    #
689
    #
603
    calc_sandbox_info();
690
    calc_sandbox_info();
Line 608... Line 695...
608
    #   Clobber and clean need to be done in the reverse order
695
    #   Clobber and clean need to be done in the reverse order
609
    #
696
    #
610
    foreach my $fe ( reverse @build_order )
697
    foreach my $fe ( reverse @build_order )
611
    {
698
    {
612
        my $dir = $fe->{dir};
699
        my $dir = $fe->{dir};
613
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{mname} ,
700
        Message( "Level:" . $fe->{level} . " Name: " . $fe->{dname} ,
614
                  DisplayPath ("        Path: $fe->{dir}" ));
701
                  DisplayPath ("        Path: $fe->{dir}" ));
615
 
702
 
616
        my $result = JatsCmd( "-cd=$dir", @cmd, @cmds);
703
        my $result = JatsCmd( "-cd=$dir", @cmd, @cmds);
617
        Error ("Cmd failure") if ( $result );
704
        Error ("Cmd failure") if ( $result );
618
    }
705
    }
Line 631... Line 718...
631
# Returns         : Nothing
718
# Returns         : Nothing
632
#
719
#
633
sub cache
720
sub cache
634
{
721
{
635
    my (@opts) = @_;
722
    my (@opts) = @_;
-
 
723
 
-
 
724
    GetOptions (
-
 
725
                "help:+"        => \$opt_help,
-
 
726
                "manual:3"      => \$opt_help,
636
    Warning("Unknown options: @opts") if ( @opts );
727
                ) || Error ("Invalid command line" );
-
 
728
 
-
 
729
    SubCommandHelp( $opt_help, "Cache") if ($opt_help || $#ARGV >= 0 );
637
 
730
 
638
    #
731
    #
639
    #   Determine Sandbox information
732
    #   Determine Sandbox information
640
    #   Populate global variables
733
    #   Populate global variables
641
    #
734
    #
Line 645... Line 738...
645
    #
738
    #
646
    #   Walk the list of external depenedencies and cache each one
739
    #   Walk the list of external depenedencies and cache each one
647
    #
740
    #
648
    foreach my $de ( sort keys %extern_deps )
741
    foreach my $de ( sort keys %extern_deps )
649
    {
742
    {
650
        my ($pn,$ps) = split( $; , $de);
-
 
651
        my @vlist = keys %{$extern_deps{$de}};
743
        my @vlist = keys %{$extern_deps{$de}};
652
        foreach my $pv ( @vlist )
744
        foreach my $pve ( @vlist )
653
        {
745
        {
-
 
746
            my ($pn,$pv) = split( $; , $pve );
654
            Message ("Cache ${pn} ${pv}.${ps}");
747
            Message ("Cache ${pn} ${pv}");
655
            JatsTool ('cache_dpkg', "${pn}/${pv}.${ps}" );
748
            JatsTool ('cache_dpkg', "${pn}/${pv}" );
656
        }
749
        }
657
    }
750
    }
658
    
751
    
659
    exit 0;
752
    exit 0;
660
    
753
    
661
}
754
}
662
 
755
 
-
 
756
#-------------------------------------------------------------------------------
-
 
757
# Function        : populate
-
 
758
#
-
 
759
# Description     : Populate the sandbox with package versions
-
 
760
#
-
 
761
#
-
 
762
# Inputs          : commands            - Array of command line arguments
-
 
763
#                   Mode-0:
-
 
764
#
-
 
765
#                       pkg_name pkg_version        - Import files for named package
-
 
766
#                       options:
-
 
767
#                           -recurse                - Import dependent packages too
-
 
768
#                           -missing                - Import dependencies not in dpkg_archive
-
 
769
#                           -test                   - Show what would be done
-
 
770
#                           -extractfiles           - Extract file, no view
-
 
771
#
-
 
772
#
-
 
773
#
-
 
774
#
-
 
775
# Returns         : Does not return
-
 
776
#
-
 
777
use JatsRmApi;
-
 
778
use DBI;
-
 
779
 
-
 
780
#
-
 
781
#   Data Base Interface
-
 
782
#
-
 
783
my $RM_DB;
-
 
784
my $PopLevel = 0;
-
 
785
my %PopPackage;
-
 
786
my @StrayPackages;
-
 
787
my @PopBase;
-
 
788
 
-
 
789
sub populate
-
 
790
{
-
 
791
    my $opt_missing = 0;
-
 
792
    my $opt_recurse = 0;
-
 
793
    my $opt_test = 0;
-
 
794
    my $opt_extractfiles;
-
 
795
    my @opt_extract = qw(-extract);
-
 
796
    my @opt_fnames;
-
 
797
 
-
 
798
    Getopt::Long::Configure('pass_through');
-
 
799
    GetOptions (
-
 
800
                "help:+"        => \$opt_help,
-
 
801
                "manual:3"      => \$opt_help,
-
 
802
                "missing"       => \$opt_missing,
-
 
803
                "test"          => \$opt_test,
-
 
804
                "recurse:100"   => \$opt_recurse,
-
 
805
                ) || Error ("Invalid command line" );
-
 
806
 
-
 
807
    SubCommandHelp( $opt_help, "Populate Sandbox") if ($opt_help );
-
 
808
 
-
 
809
    #
-
 
810
    #   Extract options for the jats extract utility
-
 
811
    #
-
 
812
    foreach ( @ARGV )
-
 
813
    {
-
 
814
        if ( m~^-~ ) {
-
 
815
            push ( @opt_extract, $_);
-
 
816
        } else {
-
 
817
            push ( @opt_fnames, $_);
-
 
818
        }
-
 
819
    }
-
 
820
 
-
 
821
    #
-
 
822
    #   Allow exactly zero or two 'bare' arguments
-
 
823
    #   Create an array of package-versions to be processed.
-
 
824
    #
-
 
825
    if ( $#opt_fnames >= 0 )
-
 
826
    {
-
 
827
        Error ("Populate: Must speicfy both a package name and version")
-
 
828
            if ( $#opt_fnames != 1 );
-
 
829
        push @PopBase, join( $;, @opt_fnames );
-
 
830
    }
-
 
831
    elsif ( $opt_missing )
-
 
832
    {
-
 
833
        #
-
 
834
        #   User has not provided a package name to extract
-
 
835
        #   Assume that the user will want missing dependencies
-
 
836
        #
-
 
837
        #   Determine packages that are not present
-
 
838
        #
-
 
839
        calc_sandbox_info();
-
 
840
 
-
 
841
        #
-
 
842
        # Scan for missing dependencies
-
 
843
        #
-
 
844
        foreach my $de ( sort keys %extern_deps )
-
 
845
        {
-
 
846
            my @vlist = keys %{$extern_deps{$de}};
-
 
847
            foreach my $pve ( @vlist )
-
 
848
            {
-
 
849
                my ($pn,$pv) = split( $; , $pve );
-
 
850
                unless (check_package_existance( $pn, $pv ))
-
 
851
                {
-
 
852
                    push @PopBase, join( $;, $pn , $pv );
-
 
853
                }
-
 
854
            }
-
 
855
        }
-
 
856
    }
-
 
857
    else
-
 
858
    {
-
 
859
        Error ("No command or option specified. See help for command usage");
-
 
860
    }
-
 
861
 
-
 
862
    #
-
 
863
    #   Process the list of package-versions
-
 
864
    #   These are top level packages. Get details from Release Manager
-
 
865
    #
-
 
866
    #DebugDumpData("Data", \@PopBase );
-
 
867
    $PopLevel = 0;
-
 
868
    foreach my $entry ( @PopBase )
-
 
869
    {
-
 
870
        my ($pname, $pver ) = split( $; , $entry);
-
 
871
 
-
 
872
        my $pv_id = getPkgDetailsByName($pname, $pver);
-
 
873
        Error ("populate: $pname, $pver not found in Release Manager" )
-
 
874
            unless ( $pv_id );
-
 
875
        getPkgDetailsByPV_ID($pv_id);
-
 
876
    }
-
 
877
    #
-
 
878
    #   If recursing then process packages that have yet to
-
 
879
    #   be processed. At the start there will be the initial user specified
-
 
880
    #   packages on the list. Place a marker at the end so that we can
-
 
881
    #   determine how far we are recursing down the dependency tree.
-
 
882
    #
-
 
883
    if ( $opt_recurse )
-
 
884
    {
-
 
885
        my $marker = join($; , '_NEXT_LEVEL_', 0, 0 );
-
 
886
        push @StrayPackages, $marker;
-
 
887
        $PopLevel++;
-
 
888
 
-
 
889
        while ( $#StrayPackages >= 0 )
-
 
890
        {
-
 
891
            my ($name, $ver, $pv_id) = split($;, shift @StrayPackages);
-
 
892
 
-
 
893
            #
-
 
894
            #   Marker.
-
 
895
            #   Increment the level of recursion
-
 
896
            #   Detect end conditions
-
 
897
            #
-
 
898
            if ( $name eq '_NEXT_LEVEL_' )
-
 
899
            {
-
 
900
                last unless ($#StrayPackages >= 0 );
-
 
901
                $PopLevel++;
-
 
902
                last if ( $PopLevel > $opt_recurse );
-
 
903
                push @StrayPackages, $marker;
-
 
904
                next;
-
 
905
            }
-
 
906
 
-
 
907
            next if ( exists $PopPackage{$name}{$ver}{done} );
-
 
908
            getPkgDetailsByPV_ID ( $pv_id );
-
 
909
            #print "Stray: $pv_id, $name, $ver\n";
-
 
910
        }
-
 
911
    }
-
 
912
    #DebugDumpData("Data", \%PopPackage );
-
 
913
 
-
 
914
    #
-
 
915
    #   Determine packages that need to be extracted
-
 
916
    #   Not ordered in any way. Could order by level if we wanted
-
 
917
    #
-
 
918
    foreach my $pname ( sort keys %PopPackage )
-
 
919
    {
-
 
920
        foreach my $pver ( sort keys %{$PopPackage{$pname}} )
-
 
921
        {
-
 
922
            #
-
 
923
            #   Create a nice view name for the extraction
-
 
924
            #   Will also be used to test for package existance
-
 
925
            #
-
 
926
            my $vname = "$pname $pver";
-
 
927
            $vname =~ s~ ~_~g;
-
 
928
            $vname =~ s~__~~g;
-
 
929
 
-
 
930
            if ( -d "$GBE_SANDBOX/$vname" )
-
 
931
            {
-
 
932
                Warning("Package already in sandbox: $pname, $pver");
-
 
933
                next;
-
 
934
            }
-
 
935
 
-
 
936
            #
-
 
937
            #   If scanning for missing packages, then examine archives
-
 
938
            #   for the packages existence. Don't do this on level-0 packages
-
 
939
            #   These have been user specified.
-
 
940
            #
-
 
941
            if ( $opt_missing && $PopPackage{$pname}{$pver}{level}  )
-
 
942
            {
-
 
943
                my $found = check_package_existance( $pname, $pver );
-
 
944
                if ( $found )
-
 
945
                {
-
 
946
                    Verbose ("Package found in archive - skipped: $pname, $pver");
-
 
947
                    next;
-
 
948
                }
-
 
949
            }
-
 
950
 
-
 
951
            #
-
 
952
            #   Generate commands to extract the package
-
 
953
            #
-
 
954
            my $vcstag = $PopPackage{$pname}{$pver}{vcstag};
-
 
955
            my @cmd = qw(jats_vcsrelease);
-
 
956
            push @cmd, "-view=$vname", "-label=$vcstag", @opt_extract;
-
 
957
            if ( $opt_test )
-
 
958
            {
-
 
959
                Message "jats " . QuoteCommand (@cmd );
-
 
960
            }
-
 
961
            else
-
 
962
            {
-
 
963
                Message "Extracting: $pname $pver";
-
 
964
                my $rv = JatsCmd (@cmd);
-
 
965
                Error ("Package version not extracted")
-
 
966
                    if ( $rv );
-
 
967
            }
-
 
968
        }
-
 
969
    }
-
 
970
 
-
 
971
    #
-
 
972
    # This command does not return
-
 
973
    #
-
 
974
    exit (0);
-
 
975
}
-
 
976
 
-
 
977
#-------------------------------------------------------------------------------
-
 
978
# Function        : getPkgDetailsByName
-
 
979
#
-
 
980
# Description     : Determine the PVID for a given package name and version
-
 
981
#
-
 
982
# Inputs          : $pname          - Package name
-
 
983
#                   $pver           - Package Version
-
 
984
#
-
 
985
# Returns         : 
-
 
986
#
-
 
987
 
-
 
988
sub getPkgDetailsByName
-
 
989
{
-
 
990
    my ($pname, $pver) = @_;
-
 
991
    my $pv_id;
-
 
992
    my (@row);
-
 
993
 
-
 
994
    connectRM(\$RM_DB) unless ($RM_DB);
-
 
995
 
-
 
996
    # First get details for a given package version
-
 
997
 
-
 
998
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION" .
-
 
999
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
-
 
1000
                    " WHERE pkg.PKG_NAME = \'$pname\' AND pv.PKG_VERSION = \'$pver\' AND pv.PKG_ID = pkg.PKG_ID";
-
 
1001
    my $sth = $RM_DB->prepare($m_sqlstr);
-
 
1002
    if ( defined($sth) )
-
 
1003
    {
-
 
1004
        if ( $sth->execute( ) )
-
 
1005
        {
-
 
1006
            if ( $sth->rows )
-
 
1007
            {
-
 
1008
                while ( @row = $sth->fetchrow_array )
-
 
1009
                {
-
 
1010
                    $pv_id = $row[0];
-
 
1011
                    my $name = $row[1];
-
 
1012
                    my $ver = $row[2];
-
 
1013
                    Verbose( "getPkgDetailsByName :PV_ID= $pv_id");
-
 
1014
                }
-
 
1015
            }
-
 
1016
            $sth->finish();
-
 
1017
        }
-
 
1018
    }
-
 
1019
    else
-
 
1020
    {
-
 
1021
        Error("Prepare failure" );
-
 
1022
    }
-
 
1023
    return $pv_id;
-
 
1024
}
-
 
1025
 
-
 
1026
#-------------------------------------------------------------------------------
-
 
1027
# Function        : getPkgDetailsByPV_ID
-
 
1028
#
-
 
1029
# Description     : Populate the Packages structure given a PV_ID
-
 
1030
#                   Called for each package in the SBOM
-
 
1031
#
-
 
1032
# Inputs          : PV_ID           - Package Unique Identifier
-
 
1033
#
-
 
1034
# Returns         : Populates Package
-
 
1035
#
-
 
1036
sub getPkgDetailsByPV_ID
-
 
1037
{
-
 
1038
    my ($PV_ID) = @_;
-
 
1039
    my $foundDetails = 0;
-
 
1040
    my (@row);
-
 
1041
 
-
 
1042
    connectRM(\$RM_DB) unless ($RM_DB);
-
 
1043
 
-
 
1044
    # First get details from pv_id
-
 
1045
 
-
 
1046
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, release_manager.PK_RMAPI.return_vcs_tag($PV_ID)" .
-
 
1047
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg " .
-
 
1048
                    " WHERE pv.PV_ID = \'$PV_ID\' AND pv.PKG_ID = pkg.PKG_ID";
-
 
1049
 
-
 
1050
    my $sth = $RM_DB->prepare($m_sqlstr);
-
 
1051
    if ( defined($sth) )
-
 
1052
    {
-
 
1053
        if ( $sth->execute( ) )
-
 
1054
        {
-
 
1055
            if ( $sth->rows )
-
 
1056
            {
-
 
1057
                while ( @row = $sth->fetchrow_array )
-
 
1058
                {
-
 
1059
                    my $pv_id       = $row[0];
-
 
1060
                    my $name        = $row[1];
-
 
1061
                    my $ver         = $row[2];
-
 
1062
                    my $vcstag      = $row[3] || '';
-
 
1063
 
-
 
1064
                    $vcstag =~ tr~\\/~/~;
-
 
1065
                    Verbose ("getPkgDetailsByPV_ID: $PV_ID, $name, $ver, $vcstag");
-
 
1066
 
-
 
1067
                    $PopPackage{$name}{$ver}{pvid} = $PV_ID;
-
 
1068
                    $PopPackage{$name}{$ver}{done} = 1;
-
 
1069
                    $PopPackage{$name}{$ver}{vcstag} = $vcstag;
-
 
1070
                    $PopPackage{$name}{$ver}{level} = $PopLevel;
-
 
1071
                    getDependsByPV_ID( $pv_id, $name, $ver );
-
 
1072
                }
-
 
1073
            }
-
 
1074
            else
-
 
1075
            {
-
 
1076
                Warning ("No Package details for: PVID: $PV_ID");
-
 
1077
            }
-
 
1078
            $sth->finish();
-
 
1079
        }
-
 
1080
        else
-
 
1081
        {
-
 
1082
            Error("getPkgDetailsByPV_ID: Execute failure", $m_sqlstr );
-
 
1083
        }
-
 
1084
    }
-
 
1085
    else
-
 
1086
    {
-
 
1087
        Error("Prepare failure" );
-
 
1088
    }
-
 
1089
}
-
 
1090
 
-
 
1091
#-------------------------------------------------------------------------------
-
 
1092
# Function        : getDependsByPV_ID
-
 
1093
#
-
 
1094
# Description     : Extract the dependancies for a given package version
-
 
1095
#
-
 
1096
# Inputs          : $pvid
-
 
1097
#
-
 
1098
# Returns         :
-
 
1099
#
-
 
1100
sub getDependsByPV_ID
-
 
1101
{
-
 
1102
    my ($pv_id, $pname, $pver) = @_;
-
 
1103
 
-
 
1104
    connectRM(\$RM_DB) unless ($RM_DB);
-
 
1105
 
-
 
1106
    #
-
 
1107
    #   Now extract the package dependacies
-
 
1108
    #
-
 
1109
    my $m_sqlstr = "SELECT pkg.PKG_NAME, pv.PKG_VERSION, pd.DPV_ID" .
-
 
1110
                   " FROM RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
-
 
1111
                   " WHERE pd.PV_ID = \'$pv_id\' AND pd.DPV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
-
 
1112
    my $sth = $RM_DB->prepare($m_sqlstr);
-
 
1113
    if ( defined($sth) )
-
 
1114
    {
-
 
1115
        if ( $sth->execute( ) )
-
 
1116
        {
-
 
1117
            if ( $sth->rows )
-
 
1118
            {
-
 
1119
                while ( my @row = $sth->fetchrow_array )
-
 
1120
                {
-
 
1121
                    my $name = $row[0];
-
 
1122
                    my $ver = $row[1];
-
 
1123
 
-
 
1124
                    Verbose2( "       Depends: $name, $ver");
-
 
1125
                    unless ( exists $PopPackage{$name} && exists $PopPackage{$name}{$ver} && exists $PopPackage{$name}{$ver}{done} )
-
 
1126
                    {
-
 
1127
                        push @StrayPackages, join($;, $name, $ver, $row[2] );
-
 
1128
                    }
-
 
1129
                }
-
 
1130
            }
-
 
1131
            $sth->finish();
-
 
1132
        }
-
 
1133
    }
-
 
1134
    else
-
 
1135
    {
-
 
1136
        Error("GetDepends:Prepare failure" );
-
 
1137
    }
-
 
1138
}
-
 
1139
 
-
 
1140
#-------------------------------------------------------------------------------
-
 
1141
# Function        : SubCommandHelp
-
 
1142
#
-
 
1143
# Description     : Provide help on a subcommand
-
 
1144
#
-
 
1145
# Inputs          : $help_level             - Help Level 1,2,3
-
 
1146
#                   $topic                  - Topic Name
-
 
1147
#
-
 
1148
# Returns         : This function does not return
-
 
1149
#
-
 
1150
sub SubCommandHelp
-
 
1151
{
-
 
1152
    my ($help_level, $topic) = @_;
-
 
1153
    my @sections;
-
 
1154
    #
-
 
1155
    #   Spell out the section we want to display
-
 
1156
    #
-
 
1157
    #   Note:
-
 
1158
    #   Due to bug in pod2usage can't use 'head1' by itself
-
 
1159
    #   Each one needs a subsection.
-
 
1160
    #
-
 
1161
    push @sections, qw( NAME SYNOPSIS ) ;
-
 
1162
    push @sections, qw( ARGUMENTS OPTIONS )     if ( $help_level > 1 );
-
 
1163
    push @sections, qw( DESCRIPTION EXAMPLES )  if ( $help_level > 2 );
-
 
1164
 
-
 
1165
    #
-
 
1166
    #   Extract section from the POD
-
 
1167
    #
-
 
1168
    pod2usage({-verbose => 99,
-
 
1169
               -noperldoc => 1,
-
 
1170
               -sections => $topic . '/' . join('|', @sections) } );
-
 
1171
}
663
 
1172
 
664
#-------------------------------------------------------------------------------
1173
#-------------------------------------------------------------------------------
665
#   Documentation
1174
#   Documentation
-
 
1175
#   NOTE
-
 
1176
#
-
 
1177
#   Each subcommand MUST have
-
 
1178
#   head1 section as used by the subcommand
-
 
1179
#       This should be empty, as the contents will NOT be displayed
-
 
1180
#   head2 sections called
-
 
1181
#       NAME SYNOPSIS ARGUMENTS OPTIONS DESCRIPTION EXAMPLES
-
 
1182
#
-
 
1183
#=head1 xxxxxx
-
 
1184
#=head2 NAME
-
 
1185
#=head2 SYNOPSIS
-
 
1186
#=head2 ARGUMENTS
-
 
1187
#=head2 OPTIONS
-
 
1188
#=head2 DESCRIPTION
-
 
1189
#=head2 EXAMPLES
666
#
1190
#
667
 
1191
 
668
=pod
1192
=pod
669
 
1193
 
670
=head1 NAME
1194
=head1 NAME
671
 
1195
 
672
jats_sandbox - Build in a Development Sandbox
1196
jats_sandbox - Build in a Development Sandbox
673
 
1197
 
674
=head1 SYNOPSIS
1198
=head1 SYNOPSIS
675
 
1199
 
676
  jats sandbox [options] [commands]
1200
  jats sandbox [options] {command} [command options]
677
 
1201
 
678
 Options:
1202
 Options:
679
    -help[=n]          - Display help with specified detail
1203
    -help[=n]          - Display help with specified detail
680
    -help -help        - Detailed help message
1204
    -help -help        - Detailed help message
681
    -man               - Full documentation
1205
    -man               - Full documentation
682
 
1206
 
683
 Commands:
1207
 Commands:
684
    help                - Same as -help
1208
    help                - Same as -help
685
    create              - Create a sandbox in the current directory
1209
    create              - Create a sandbox in the current directory
-
 
1210
    populate            - Populate the sandbox with packages
686
    delete              - Delete the sandbox
1211
    delete              - Delete the sandbox
687
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
1212
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
688
    cmd                 - Do commands in all sandbox components
1213
    cmd                 - Do commands in all sandbox components
689
    all                 - Do 'build', if required, then a make in all sandbox components
1214
    all                 - Do 'build', if required, then a make in all sandbox components
690
    build               - Force 'build and make' in all sandbox components
1215
    build               - Force 'build and make' in all sandbox components
691
    make                - Do 'make' in all sandbox components
1216
    make                - Do 'make' in all sandbox components
692
    clean               - Do 'make clean' in all sandbox components
1217
    clean               - Do 'make clean' in all sandbox components
693
    clobber             - Do 'build clobber' is all sandbox components
1218
    clobber             - Do 'build clobber' is all sandbox components
694
    cache               - Cache external dependent packages
1219
    cache               - Cache external dependent packages
695
 
1220
 
-
 
1221
 Use the command
-
 
1222
    jats sandbox 'command' -h
-
 
1223
 for command specific help
-
 
1224
    
696
=head1 OPTIONS
1225
=head1 OPTIONS
697
 
1226
 
698
=over 8
1227
=over 8
699
 
1228
 
700
=item B<-help[=n]>
1229
=item B<-help[=n]>
Line 737... Line 1266...
737
Several JATS commands operate differently within a sandbox. The 'extract' and
1266
Several JATS commands operate differently within a sandbox. The 'extract' and
738
'release' commands will create static viwes within the sandbox and not the
1267
'release' commands will create static viwes within the sandbox and not the
739
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
1268
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
740
 
1269
 
741
The sandbox directory contains sub directories, each should contain a single
1270
The sandbox directory contains sub directories, each should contain a single
742
package. Sub directories may be created with the 'jats extract' command.
1271
package. Sub directories may be created with the 'jats extract' command or with the
-
 
1272
'jats sandbox populate' command.
743
 
1273
 
744
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
1274
Note: Symbolic links are not supported. They cannot work as he sandbox mechanism
745
requires that all the packages be conatined within a sub directory tree so
1275
requires that all the packages be conatined within a sub directory tree so
746
that the root of the sandbox can be located by a simple scan of the directory
1276
that the root of the sandbox can be located by a simple scan of the directory
747
tree.
1277
tree.
Line 750... Line 1280...
750
<GBE_MACHTYPE>', then that package will not be considered as a part of the
1280
<GBE_MACHTYPE>', then that package will not be considered as a part of the
751
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
1281
build-set. A 'stop' file will prevent consideration all build platforms. The 'stop.
752
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
1282
<GBE_MACHTYPE>' will only prevent consideration if being built on a GBE_MACHTYPE
753
type of computer.
1283
type of computer.
754
 
1284
 
755
=head2 COMMAND SUMMARY
1285
=head1 Create Sandbox
-
 
1286
 
-
 
1287
=head2 NAME
-
 
1288
 
-
 
1289
Create Sandbox
-
 
1290
 
-
 
1291
=head2 SYNOPSIS
-
 
1292
 
-
 
1293
jats sandbox [options] create [command options]
-
 
1294
 
-
 
1295
 Options:
-
 
1296
    -help[=n]               - Help message, [n=1,2,3]
-
 
1297
    -man                    - Full documentation [-help=3]
-
 
1298
    -verbose[=n]            - Verbose command operation
-
 
1299
 
-
 
1300
 Command Options
-
 
1301
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1302
    -verbose[=n]            - Verbose operation
-
 
1303
    -exact                  - Create sandbox to reproduce exact versions
-
 
1304
 
-
 
1305
=head2 OPTIONS
756
 
1306
 
-
 
1307
The 'create' command takes the following options:
-
 
1308
 
-
 
1309
=over 8
-
 
1310
 
-
 
1311
=item -exact
-
 
1312
 
-
 
1313
When this option is specified the sandbox is marked for exact processing of
-
 
1314
package versions. In this mode the version numbers of the packages in the
-
 
1315
sandbox are significant. This is ideal for recreating a package-version.
-
 
1316
 
-
 
1317
The default is for in-exact processing, in which the version numbers of packages
-
 
1318
within the sandbox are not significant. The is ideal for development.
-
 
1319
 
-
 
1320
=back
-
 
1321
 
757
=head3 create
1322
=head2 DESCRIPTION
758
 
1323
 
759
The 'create' command will create a sandbox in the users current directory. It is
1324
The 'create' command will create a sandbox in the users current directory. It is
760
not possible to create a sandbox within a sandbox.
1325
not possible to create a sandbox within a sandbox.
761
 
1326
 
762
A sandbox can be created in a directory that contains files and subdirectories.
1327
A sandbox can be created in a directory that contains files and subdirectories.
763
 
1328
 
764
The create command simply places a known directory in the current directory.
1329
The create command simply places a known directory in the current directory.
765
This dorectory is used by the sandboxing process. It may be manually deleted, or
1330
This directory is used by the sandboxing process. It may be manually deleted, or
766
deleted with the 'delete' command.
1331
deleted with the 'delete' command.
767
 
1332
 
-
 
1333
 
-
 
1334
=head1 Populate Sandbox
-
 
1335
 
-
 
1336
=head2 NAME
-
 
1337
 
-
 
1338
Populate a Sandbox
-
 
1339
 
-
 
1340
=head2 SYNOPSIS
-
 
1341
 
-
 
1342
jats sandbox [options] populate [command options] [packageName packageVersion]
-
 
1343
 
-
 
1344
 Options:
-
 
1345
    -help[=n]               - Help message, [n=1,2,3]
-
 
1346
    -man                    - Full documentation [-help=3]
-
 
1347
    -verbose[=n]            - Verbose command operation
-
 
1348
 
-
 
1349
 Command Options
-
 
1350
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1351
    -recurse[=n]            - Locate dependencies within packages
-
 
1352
    -missing                - Locate missing packages
-
 
1353
    -test                   - Do not extract packages
-
 
1354
    -<Other>                - Pass options to jats extract
-
 
1355
 
-
 
1356
=head2 ARGUMENTS
-
 
1357
 
-
 
1358
The 'populate' command can take a package name and version as arguments. It will
-
 
1359
then populate the sandbox with this package. See 'DESCRIPTION' for details.
-
 
1360
 
-
 
1361
=head2 OPTIONS
-
 
1362
 
-
 
1363
The 'populate' command takes the following options:
-
 
1364
 
-
 
1365
=over 4
-
 
1366
 
-
 
1367
=over 4
-
 
1368
 
-
 
1369
=item -recurse[=N]
-
 
1370
 
-
 
1371
This option will modify the operation of the command such that dependencies
-
 
1372
of named packages can also be extracted into the sandbox.
-
 
1373
 
-
 
1374
The default operation is to only extract named packages. If the option is
-
 
1375
specified then all dependent packages are processed. An optional numeric argument
-
 
1376
can be specified to limit the depth of the recursion.
-
 
1377
 
-
 
1378
=item -missing
-
 
1379
 
-
 
1380
This option will modify the operation of the dependency recursion scanning such
-
 
1381
that dependent packages that exist in a package archive will not be extracted.
-
 
1382
 
-
 
1383
Use of this option allows a sandbox to be populated with packages that are
-
 
1384
required by packages in the sandbox, but are not available in a package archive.
-
 
1385
 
-
 
1386
=item -test
-
 
1387
 
-
 
1388
This option will prevent the command from performing the extraction. It will
-
 
1389
simply display the JATS commands that can be used to perform the extraction.
-
 
1390
 
-
 
1391
=item -<Other>
-
 
1392
 
-
 
1393
Options not understood by the 'populate' sub command will be passed through
-
 
1394
the package extraction program. Useful options include:
-
 
1395
 
-
 
1396
=over 8
-
 
1397
 
-
 
1398
=item   -extractfiles
-
 
1399
 
-
 
1400
=item   -branch=<branch name>
-
 
1401
 
-
 
1402
=back
-
 
1403
 
-
 
1404
=back
-
 
1405
 
-
 
1406
=back
-
 
1407
 
-
 
1408
=head2 DESCRIPTION
-
 
1409
 
-
 
1410
The 'populate' command can be used to assist in populating the sandbox. It has
-
 
1411
two modes of operation.
-
 
1412
 
-
 
1413
=over 8
-
 
1414
 
-
 
1415
=item Named Package
-
 
1416
 
-
 
1417
If the user specifies both a package name and a package version then he command
-
 
1418
will populate the sandbox with that package and optionally its dependencies.
-
 
1419
 
-
 
1420
=item Determine missing dependencies
-
 
1421
 
-
 
1422
If the user does not specify a package name and version, but does specify
-
 
1423
the '-missing' option,  then the command will examine the current sandbox and
-
 
1424
determine missing dependent packages. It will then populate the sandbox with
-
 
1425
these packages and optionally there dependencies.
-
 
1426
 
-
 
1427
=back
-
 
1428
 
-
 
1429
=head2 EXAMPLES
-
 
1430
 
-
 
1431
=over 4
-
 
1432
 
-
 
1433
=item jats sandbox populate package1 version1
-
 
1434
 
-
 
1435
This command will populate the sandbox with version1 of package1, if it does not
-
 
1436
already exist in the sandbox.
-
 
1437
 
-
 
1438
=item jats sandbox populate package1 version1 -recurse -missing
-
 
1439
 
-
 
1440
This command will populate the sandbox with version1 of package1, if it does not
-
 
1441
already exist in the sandbox, together will all the packages dependencies that
-
 
1442
are not available in a package archive.
-
 
1443
 
-
 
1444
=item jats sandbox populate -recurse -missing
-
 
1445
 
-
 
1446
This command will examine the current sandbox and populate the sandbox with
-
 
1447
packages that are required to build the packages in the sandbox and the
-
 
1448
dependencies of these packages, provide the dependent package is not in a
-
 
1449
package archive.
-
 
1450
 
-
 
1451
=item jats sandbox populate
-
 
1452
 
-
 
1453
This command will examine the current sandbox and populate the sandbox with
-
 
1454
packages that are required to build the packages in the sandbox. It will not
-
 
1455
examine the dependents of these packages.
-
 
1456
 
-
 
1457
=back
-
 
1458
 
-
 
1459
=head1 Delete Sandbox
-
 
1460
 
768
=head3 delete
1461
=head2 NAME
-
 
1462
 
-
 
1463
Deleta a sandbox
-
 
1464
 
-
 
1465
=head2 SYNOPSIS
-
 
1466
 
-
 
1467
jats sandbox [options] delete
-
 
1468
 
-
 
1469
 Options:
-
 
1470
    -help[=n]               - Help message, [n=1,2,3]
-
 
1471
    -man                    - Full documentation [-help=3]
-
 
1472
    -verbose[=n]            - Verbose command operation
-
 
1473
 
-
 
1474
=head2 DESCRIPTION
769
 
1475
 
770
The 'delete' command will delete the sandbox's marker directory. The command may
1476
The 'delete' command will delete the sandbox's marker directory. The command may
771
be executed anywhere within the sandbox.
1477
be executed anywhere within the sandbox.
772
 
1478
 
773
Once the sanbox has been deleted, the user must remove the components within the
1479
Once the sandbox has been deleted, the user must remove the components within the
774
sandbox.
1480
sandbox.
775
 
1481
 
-
 
1482
=head1 Sandbox Information
-
 
1483
 
776
=head3 info
1484
=head2 NAME
-
 
1485
 
-
 
1486
Display Sandbox Information
-
 
1487
 
-
 
1488
=head2 SYNOPSIS
-
 
1489
 
-
 
1490
jats sandbox [options] info [command options]
-
 
1491
 
-
 
1492
 Options:
-
 
1493
    -help[=n]               - Help message, [n=1,2,3]
-
 
1494
    -man                    - Full documentation [-help=3]
-
 
1495
    -verbose[=n]            - Verbose command operation
-
 
1496
 
-
 
1497
 Command Options
-
 
1498
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1499
    -verbose[=n]            - Display more information
-
 
1500
    
-
 
1501
=head2 OPTIONS
-
 
1502
 
-
 
1503
=over
-
 
1504
 
-
 
1505
=item B<-verbose[=n]>
-
 
1506
 
-
 
1507
This options will increase the verbosity of the information being displayed.
-
 
1508
Values 1 and 2 are described in the detailed 'DESCRIPTION'. Other values are
-
 
1509
reserved for diagnostic use.
-
 
1510
 
-
 
1511
=back
-
 
1512
 
-
 
1513
=head2 DESCRIPTION
777
 
1514
 
778
The 'info' command will display information about the build order and the
1515
The 'info' command will display information about the build order and the
779
depenedencies of packages that it finds within the sandbox.
1516
dependencies of packages that it finds within the sandbox.
780
 
1517
 
781
The command will accept one option '-v' to increase the verbosity of the
1518
The command works within various levels of verbosity:
782
information being displayed.
-
 
783
 
1519
 
784
=over 8
1520
=over 8
785
 
1521
 
786
=item * No Verbosity
1522
=item * No Verbosity
787
 
1523
 
Line 797... Line 1533...
797
 
1533
 
798
=back
1534
=back
799
 
1535
 
800
=item Verbosity of 1
1536
=item Verbosity of 1
801
 
1537
 
802
This level of verbosoity will display the build order and detailed information
1538
This level of verbosity will display the build order and detailed information
803
on the dependencies. The dependencies will be prefixed with:
1539
on the dependencies. The dependencies will be prefixed with:
804
 
1540
 
805
=over 8
1541
=over 8
806
 
1542
 
807
=item   E   Dependent Package is external to the sandbox
1543
=item   E   Dependent Package is external to the sandbox
Line 814... Line 1550...
814
no-verbosity. Additionally the internal consumer of the external package is also
1550
no-verbosity. Additionally the internal consumer of the external package is also
815
shown. These are prefixed with a 'U'.
1551
shown. These are prefixed with a 'U'.
816
 
1552
 
817
=item Verbosity of 2
1553
=item Verbosity of 2
818
 
1554
 
819
Reserved forfuture use
1555
Reserved for future use
820
 
1556
 
821
=item Verbosity over 2
1557
=item Verbosity over 2
822
 
1558
 
823
This should be considered a debug option. Undocument internal information will
1559
This should be considered a debug option. Undocumented internal information will
824
be displayed.
1560
be displayed.
825
 
1561
 
826
=back
1562
=back
827
 
1563
 
-
 
1564
=head1 Command all
-
 
1565
 
828
=head3 all
1566
=head2 NAME
-
 
1567
 
-
 
1568
Build packages in the sandbox
-
 
1569
 
-
 
1570
=head2 SYNOPSIS
-
 
1571
 
-
 
1572
jats sandbox [options] all [command options] [arguments]
-
 
1573
 
-
 
1574
 Options:
-
 
1575
    -help[=n]               - Help message, [n=1,2,3]
-
 
1576
    -man                    - Full documentation [-help=3]
-
 
1577
    -verbose[=n]            - Verbose command operation
-
 
1578
 
-
 
1579
 Command Options
-
 
1580
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1581
 
-
 
1582
=head2 ARGUMENTS
-
 
1583
 
-
 
1584
Arguments are passed to the 'make' phase of the process.
-
 
1585
 
-
 
1586
=head2 OPTIONS
-
 
1587
 
-
 
1588
The are command specific options.
-
 
1589
 
-
 
1590
=head2 DESCRIPTION
829
 
1591
 
830
The 'all' command will perform build, if the build files are out of date,
1592
The 'all' command will perform build, if the build files are out of date,
831
followed by a make in each of the packages within the sandbox, in the correct
1593
followed by a make in each of the packages within the sandbox, in the correct
832
build order.
1594
build order.
833
 
1595
 
Line 841... Line 1603...
841
 
1603
 
842
=item * Resume a failed build.
1604
=item * Resume a failed build.
843
 
1605
 
844
=back
1606
=back
845
 
1607
 
-
 
1608
=head1 Command build
-
 
1609
 
846
=head3 build
1610
=head2 NAME
-
 
1611
 
-
 
1612
Build packages in the sandbox
-
 
1613
 
-
 
1614
=head2 SYNOPSIS
-
 
1615
 
-
 
1616
jats sandbox [options] build [command options] [arguments]
-
 
1617
 
-
 
1618
 Options:
-
 
1619
    -help[=n]               - Help message, [n=1,2,3]
-
 
1620
    -man                    - Full documentation [-help=3]
-
 
1621
    -verbose[=n]            - Verbose command operation
-
 
1622
 
-
 
1623
 Command Options
-
 
1624
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1625
 
-
 
1626
=head2 ARGUMENTS
-
 
1627
 
-
 
1628
Arguments are passed to the 'make' phase of the process.
-
 
1629
 
-
 
1630
=head2 OPTIONS
-
 
1631
 
-
 
1632
The are no command specific options.
-
 
1633
 
-
 
1634
=head2 DESCRIPTION
847
 
1635
 
848
The 'build' command will force a build followed by a make in each of the packages
1636
The 'build' command will force a build followed by a make in each of the packages
849
within the sandbox, in the correct build order.
1637
within the sandbox, in the correct build order.
850
 
1638
 
851
Any arguments are passed to the 'make' phase of the process.
1639
Any arguments are passed to the 'make' phase of the process.
852
 
1640
 
853
In practice, the 'sandbox all' command is quicker.
1641
In practice, the 'sandbox all' command is quicker.
854
 
1642
 
-
 
1643
=head1 Clean
-
 
1644
 
-
 
1645
=head2 NAME
-
 
1646
 
-
 
1647
Clean all sandbox components
-
 
1648
 
-
 
1649
=head2 SYNOPSIS
-
 
1650
 
-
 
1651
jats sandbox [options] clean|clobber [command options]
-
 
1652
 
-
 
1653
 Options:
-
 
1654
    -help[=n]               - Help message, [n=1,2,3]
-
 
1655
    -man                    - Full documentation [-help=3]
-
 
1656
    -verbose[=n]            - Verbose command operation
-
 
1657
 
-
 
1658
 Command Options
-
 
1659
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1660
 
-
 
1661
=head2 ARGUMENTS
-
 
1662
 
-
 
1663
None
-
 
1664
 
-
 
1665
=head2 OPTIONS
-
 
1666
 
-
 
1667
No command specific options
-
 
1668
 
-
 
1669
=head2 DESCRIPTION
-
 
1670
 
-
 
1671
The 'clean' command will perform a 'jats make clean' in all components in the
-
 
1672
sandbox.
-
 
1673
 
-
 
1674
The 'clobber' command will perform a 'jats clobber' in all components in the
-
 
1675
sandbox.
-
 
1676
 
855
=head3 make
1677
=head1 make
-
 
1678
 
-
 
1679
=head2 NAME
-
 
1680
 
-
 
1681
Make packages in the sandbox
-
 
1682
 
-
 
1683
=head2 SYNOPSIS
-
 
1684
 
-
 
1685
jats sandbox [options] make [command options] [arguments]
-
 
1686
 
-
 
1687
 Options:
-
 
1688
    -help[=n]               - Help message, [n=1,2,3]
-
 
1689
    -man                    - Full documentation [-help=3]
-
 
1690
    -verbose[=n]            - Verbose command operation
-
 
1691
 
-
 
1692
 Command Options
-
 
1693
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1694
 
-
 
1695
=head2 ARGUMENTS
-
 
1696
 
-
 
1697
Arguments are passed to the 'make' phase of the process.
-
 
1698
 
-
 
1699
=head2 OPTIONS
-
 
1700
 
-
 
1701
The are no command specific options.
-
 
1702
 
-
 
1703
=head2 DESCRIPTION
856
 
1704
 
857
The 'make' command will perform a 'make' operation in each of the packages
1705
The 'make' command will perform a 'make' operation in each of the packages
858
within the sandbox, in the correct build order.
1706
within the sandbox, in the correct build order.
859
 
1707
 
860
Any arguments are passed to the 'make'.
1708
Any arguments are passed to the 'make'.
861
 
1709
 
862
=head3 cmd
1710
=head1 cmd
-
 
1711
 
-
 
1712
=head2 NAME
-
 
1713
 
-
 
1714
Process each package with a specified command.
-
 
1715
 
-
 
1716
=head2 SYNOPSIS
-
 
1717
 
-
 
1718
jats sandbox [options] cmd [command options] [arguments]
-
 
1719
 
-
 
1720
 Options:
-
 
1721
    -help[=n]               - Help message, [n=1,2,3]
-
 
1722
    -man                    - Full documentation [-help=3]
-
 
1723
    -verbose[=n]            - Verbose command operation
-
 
1724
 
-
 
1725
 Command Options
-
 
1726
    -help[=n]               - Command specific help, [n=1,2,3]
-
 
1727
 
-
 
1728
=head2 ARGUMENTS
-
 
1729
 
-
 
1730
Arguments are passed to a JATS command.
-
 
1731
 
-
 
1732
=head2 OPTIONS
-
 
1733
 
-
 
1734
The are no command specific options.
-
 
1735
 
-
 
1736
=head2 DESCRIPTION
863
 
1737
 
864
The 'cmd' command will pass all of its arguments to JATS in the build directory
1738
The 'cmd' command will pass all of its arguments to JATS in the build directory
865
of each of the packages within the sandbox, in the package build order.
1739
of each of the packages within the sandbox, in the package build order.
866
 
1740
 
867
=head3 clean
1741
=head1 Cache
868
 
1742
 
869
The 'clean' command will perform a 'jats make clean' in all components in the
-
 
870
sandbox.
1743
=head2 NAME
871
 
1744
 
872
=head3 clobber
1745
Cache dependent packages
873
 
1746
 
874
The 'clobber' command will perform a 'jats clobber' in all components in the
1747
jats sandbox [options] cache [command options]
875
sandbox.
-
 
876
 
1748
 
877
=head3 cache
1749
 Options:
-
 
1750
    -help[=n]               - Help message, [n=1,2,3]
-
 
1751
    -man                    - Full documentation [-help=3]
-
 
1752
    -verbose[=n]            - Verbose command operation
878
 
1753
 
-
 
1754
 Command Options
879
The 'cache' command will cache all external dependent packages into the sandbox.
1755
    -help[=n]               - Command specific help, [n=1,2,3]
880
 
1756
 
881
This allows the simple creation of a small development environment that is
-
 
882
not tied to the larger Development Environment. It may then be used in a
-
 
883
disconnected mode to perform development.
1757
=head2 ARGUMENTS
884
 
1758
 
-
 
1759
The are no command specific arguments.
885
 
1760
 
886
=cut
1761
=head2 OPTIONS
887
 
1762
 
-
 
1763
The are no command specific options.
-
 
1764
 
-
 
1765
=head2 DESCRIPTION
-
 
1766
 
-
 
1767
The 'cache' command will cache all external dependent packages into the users
-
 
1768
dpkg_archive_cache as defined through the EnvVar GBE_DPKG_CACHE. The result is
-
 
1769
similar to the command 'jats sandbox build -cache', without the overhead of
-
 
1770
building the sandbox components.
-
 
1771
 
-
 
1772
This command allows the simple creation of a small development environment that
-
 
1773
is not tied to the larger Development Environment. It may then be used in a
-
 
1774
disconnected mode to perform development.
-
 
1775
 
-
 
1776
=cut
888
 
1777