Subversion Repositories DevTools

Rev

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

Rev 297 Rev 299
Line 41... Line 41...
41
use JatsError;
41
use JatsError;
42
use JatsSystem;
42
use JatsSystem;
43
use FileUtils;
43
use FileUtils;
44
use JatsBuildFiles;
44
use JatsBuildFiles;
45
use JatsVersionUtils;
45
use JatsVersionUtils;
-
 
46
use File::Path qw(rmtree);
46
 
47
 
47
 
48
 
48
use Pod::Usage;                             # required for help support
49
use Pod::Usage;                             # required for help support
49
use Getopt::Long qw(:config require_order); # Stop on non-option
50
use Getopt::Long qw(:config require_order); # Stop on non-option
50
my $VERSION = "1.0.0";                      # Update this
51
my $VERSION = "1.0.0";                      # Update this
Line 53... Line 54...
53
#   Options
54
#   Options
54
#
55
#
55
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
56
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
56
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
57
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
57
my $opt_help = 0;
58
my $opt_help = 0;
58
my $opt_manual = 0;
-
 
59
 
59
 
60
#
60
#
61
#   Globals - Provided by the JATS environment
61
#   Globals - Provided by the JATS environment
62
#
62
#
63
my $USER         = $ENV{'USER'};
63
my $USER         = $ENV{'USER'};
Line 80... Line 80...
80
# Description     :
80
# Description     :
81
#
81
#
82
# Inputs          :
82
# Inputs          :
83
#
83
#
84
my $result = GetOptions (
84
my $result = GetOptions (
85
                "help+"         => \$opt_help,              # flag, multiple use allowed
85
                "help|h:+"      => \$opt_help,
86
                "manual"        => \$opt_manual,            # flag, multiple use allowed
86
                "manual:3"      => \$opt_help,
87
                "verbose+"      => \$opt_verbose,           # flag, multiple use allowed
87
                "verbose+"      => \$opt_verbose,           # flag, multiple use allowed
88
                );
88
                );
89
 
89
 
90
                #
90
                #
91
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
91
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
Line 94... Line 94...
94
#
94
#
95
#   Process help and manual options
95
#   Process help and manual options
96
#
96
#
97
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
97
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
98
pod2usage(-verbose => 1)  if ($opt_help == 2 );
98
pod2usage(-verbose => 1)  if ($opt_help == 2 );
99
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
99
pod2usage(-verbose => 2)  if ($opt_help > 2 );
100
 
100
 
101
#
101
#
102
#   Configure the error reporting process now that we have the user options
102
#   Configure the error reporting process now that we have the user options
103
#
103
#
104
ErrorConfig( 'name'    => 'SANDBOX',
104
ErrorConfig( 'name'    => 'SANDBOX',
Line 112... Line 112...
112
#   Parse the user command and decide what to do
112
#   Parse the user command and decide what to do
113
#
113
#
114
#
114
#
115
my $cmd = shift @ARGV || "";
115
my $cmd = shift @ARGV || "";
116
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
116
help(1)                                 if ( $cmd =~ m/^help$/ || $cmd eq "" );
-
 
117
delete_sandbox()                        if ( $cmd =~ m/^delete$/ );
117
create_sandbox()                        if ( $cmd =~ m/^create$/ );
118
create_sandbox()                        if ( $cmd =~ m/^create$/ );
118
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
119
info(@ARGV)                             if ( $cmd =~ m/^info$/ );
119
cmd(@ARGV)                              if ( $cmd =~ m/^cmd$/ );
120
cmd(@ARGV)                              if ( $cmd =~ m/^cmd$/ );
120
cmd($cmd, @ARGV )                       if ( $cmd =~ m/(^all$)|(^build$)|(^make$)/  );
121
cmd($cmd, @ARGV )                       if ( $cmd =~ m/(^all$)|(^build$)|(^make$)/  );
121
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
122
clean($cmd, @ARGV)                      if ( $cmd =~ m/(^clobber$)|(^clean$)/  );
Line 152... Line 153...
152
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
153
    mkdir ('sandbox_dpkg_archive') || Error ("Cannot create the directory: sandbox_dpkg_archive") ;
153
    exit  0;
154
    exit  0;
154
}
155
}
155
 
156
 
156
#-------------------------------------------------------------------------------
157
#-------------------------------------------------------------------------------
-
 
158
# Function        : delete_sandbox
-
 
159
#
-
 
160
# Description     : Delete a sandbox
-
 
161
#                   Its up to the user the delete the components in the sandbox
-
 
162
#
-
 
163
# Inputs          : None
-
 
164
#
-
 
165
# Returns         : 
-
 
166
#
-
 
167
sub delete_sandbox
-
 
168
{
-
 
169
    unless ( $GBE_SANDBOX )
-
 
170
    {
-
 
171
        Warning("No sandbox found to delete");
-
 
172
    }
-
 
173
    else
-
 
174
    {
-
 
175
        my $sdir = "$GBE_SANDBOX/sandbox_dpkg_archive";
-
 
176
        rmtree($sdir,0,0);
-
 
177
        Error ("Sandbox directory not completly removed")
-
 
178
            if ( -e $sdir );
-
 
179
 
-
 
180
        Message("Sandbox information deleted",
-
 
181
                "Sandbox components must be manually deleted");
-
 
182
    }
-
 
183
    exit 0;
-
 
184
}
-
 
185
 
-
 
186
#-------------------------------------------------------------------------------
157
# Function        : info
187
# Function        : info
158
#
188
#
159
# Description     : Display Sandbox information
189
# Description     : Display Sandbox information
160
#
190
#
161
# Inputs          : Command line args
191
# Inputs          : Command line args
Line 299... Line 329...
299
    #       Dependency list
329
    #       Dependency list
300
    #   Build up a hash of dependence information
330
    #   Build up a hash of dependence information
301
    #
331
    #
302
 
332
 
303
    my %depends;
333
    my %depends;
-
 
334
    my %multi;
304
    foreach my $be ( @build_list )
335
    foreach my $be ( @build_list )
305
    {
336
    {
306
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
337
        Verbose( DisplayPath ("Build file: " . $be->{dir} . " Name: " . $be->{file} ));
307
#        DebugDumpData ("be", $be );
338
#        DebugDumpData ("be", $be );
308
 
339
 
309
        #
340
        #
-
 
341
        #   Catch multiple builds for the same package
-
 
342
        #   Report later - when we have all
-
 
343
        #
-
 
344
        push @{$multi{$be->{mname}}},$be->{dir};
-
 
345
 
-
 
346
        #
310
        #   Add into dependency struct
347
        #   Add into dependency struct
311
        #
348
        #
312
        $depends{$be->{package}}{depends} = $be->{depends};
349
        $depends{$be->{package}}{depends} = $be->{depends};
313
        $depends{$be->{package}}{entry} = $be;
350
        $depends{$be->{package}}{entry} = $be;
314
    }
351
    }
315
 
352
 
-
 
353
    foreach my $mname ( sort keys %multi )
-
 
354
    {
-
 
355
        ReportError ("Mutiple builders for : $mname", @{$multi{$mname}} )
-
 
356
            if ( scalar @{$multi{$mname}} > 1 );
-
 
357
    }
-
 
358
    ErrorDoExit();
-
 
359
 
316
#DebugDumpData ("depends", \%depends );
360
#DebugDumpData ("depends", \%depends );
317
 
361
 
318
    #
362
    #
319
    #   Determine the build order
363
    #   Determine the build order
320
    #
364
    #
Line 481... Line 525...
481
=head1 SYNOPSIS
525
=head1 SYNOPSIS
482
 
526
 
483
  jats sandbox [options] [commands]
527
  jats sandbox [options] [commands]
484
 
528
 
485
 Options:
529
 Options:
486
    -help              - brief help message
530
    -help[=n]          - Display help with specified detail
487
    -help -help        - Detailed help message
531
    -help -help        - Detailed help message
488
    -man               - Full documentation
532
    -man               - Full documentation
489
 
533
 
490
 Commands:
534
 Commands:
491
    help                - Same as -help
535
    help                - Same as -help
492
    create              - Create a sandbox in the current directory
536
    create              - Create a sandbox in the current directory
-
 
537
    delete              - Delete the sandbox
493
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
538
    info [[-v]-v]       - Sandbox information. -v: Be more verbose
494
    cmd                 - Do commands in all sandbox components
539
    cmd                 - Do commands in all sandbox components
495
    all                 - Do 'build and make' in all sandbox components
540
    all                 - Do 'build and make' in all sandbox components
496
    build               - Do 'build' in all sandbox components
541
    build               - Do 'build' in all sandbox components
497
    make                - Do 'make' in all sandbox components
542
    make                - Do 'make' in all sandbox components
Line 500... Line 545...
500
 
545
 
501
=head1 OPTIONS
546
=head1 OPTIONS
502
 
547
 
503
=over 8
548
=over 8
504
 
549
 
505
=item B<-help>
550
=item B<-help[=n]>
506
 
551
 
507
Print a brief help message and exits.
552
Print a brief help message and exits.
-
 
553
There are three levels of help
-
 
554
 
-
 
555
=over 8
-
 
556
 
-
 
557
=item   1 Brief synopsis
-
 
558
 
-
 
559
=item   2 Synopsis and option summary
-
 
560
 
-
 
561
=item   3 Detailed help in man format
-
 
562
 
-
 
563
=back 8
508
 
564
 
509
=item B<-help -help>
565
=item B<-help -help>
510
 
566
 
511
Print a detailed help message with an explanation for each option.
567
Print a detailed help message with an explanation for each option.
512
 
568
 
513
=item B<-man>
569
=item B<-man>
514
 
570
 
515
Prints the manual page and exits.
571
Prints the manual page and exits. This is the same a -help=3
516
 
572
 
517
=back
573
=back
518
 
574
 
519
=head1 DESCRIPTION
575
=head1 DESCRIPTION
520
 
576
 
521
This program is the primary tool for the maintenance of Development Sandboxes
577
This program is the primary tool for the maintenance of Development Sandboxes.
-
 
578
 
522
More documentation will follow.
579
More documentation will follow.
523
 
580
 
524
=head2 SANDBOX DIRECTORY
581
=head2 SANDBOX DIRECTORY
525
 
582
 
526
The sandbox directory is marked as being a sandbox through the use of the '
583
The sandbox directory is marked as being a sandbox through the use of the
527
sandbox create' command. This will create a suitable structure within the
584
'sandbox create' command. This will create a suitable structure within the
528
current directory.
585
current directory.
529
 
586
 
530
Several JATS commands operate differently within a sandbox. The 'extract' and
587
Several JATS commands operate differently within a sandbox. The 'extract' and
531
'release' commands will create static viwes within the sandbox and not the
588
'release' commands will create static viwes within the sandbox and not the
532
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
589
normal directory. The 'sandbox' sub commands can only be used within a sandbox.
Line 540... Line 597...
540
tree.
597
tree.
541
 
598
 
542
If a package subdirectory contains a file called 'stop', then that package
599
If a package subdirectory contains a file called 'stop', then that package
543
will not be considered as a part of the build-set.
600
will not be considered as a part of the build-set.
544
 
601
 
-
 
602
=head2 COMMAND SUMMARY
-
 
603
 
-
 
604
=head3 create
-
 
605
 
-
 
606
The 'create' command will create a sandbox in the users current directory. It is
-
 
607
not possible to create a sandbox within a sandbox.
-
 
608
 
-
 
609
A sandbox can be created in a directory that contains files and subdirectories.
-
 
610
 
-
 
611
The create command simply places a known directory in the current directory.
-
 
612
This dorectory is used by the sandboxing process. It may be manually deleted, or
-
 
613
deleted with the 'delete' command.
-
 
614
 
-
 
615
=head3 delete
-
 
616
 
-
 
617
The 'delete' command will delete the sandbox's marker directory. The command may
-
 
618
be executed anywhere within the sandbox.
-
 
619
 
-
 
620
Once the sanbox has been deleted, the user must remove the components within the
-
 
621
sandbox.
-
 
622
 
-
 
623
=head3 info
-
 
624
 
-
 
625
The 'info' command will display information about the build order and the
-
 
626
depenedencies of packages that it finds within the sandbox.
-
 
627
 
-
 
628
The command will accept one option '-v' to increase the verbosity of the
-
 
629
information being displayed.
-
 
630
 
-
 
631
=over 8
-
 
632
 
-
 
633
=item * No Verbosity
-
 
634
 
-
 
635
The basic command will display the build order and the external
-
 
636
dependencies
-
 
637
 
-
 
638
=item Verbosity of 1
-
 
639
 
-
 
640
This level of verbosoity will display the build order and detailed information
-
 
641
on the dependencies. The dependencies will be prefixed with:
-
 
642
 
-
 
643
=over 8
-
 
644
 
-
 
645
=item   E   Dependent Package is external to the sandbox
-
 
646
 
-
 
647
=item   I   Dependent Package is internal to the sandbox
-
 
648
 
-
 
649
=back
-
 
650
 
-
 
651
This level of verbosity display information on packages that are external to the
-
 
652
sandbox. External dependencies may be prefixed with a '*'. This indicates that
-
 
653
multiple versions of this package are being used by sandboxed components.
-
 
654
 
-
 
655
The internal consumer of the external package is also shown. These are
-
 
656
prefixed with a 'U'.
-
 
657
 
-
 
658
=item Verbosity of 2
-
 
659
 
-
 
660
Reserved forfuture use
-
 
661
 
-
 
662
=item Verbosity over 2
-
 
663
 
-
 
664
This should be considered a debug option. Undocument internal information will
-
 
665
be displayed.
-
 
666
 
-
 
667
=back
-
 
668
 
545
=cut
669
=cut
546
 
670
 
547
 
671