Subversion Repositories DevTools

Rev

Rev 7299 | Blame | Compare with Previous | Last modification | View Log | RSS feed

########################################################################
# COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.
#
# Module name   : jats_vcsrelease.pl
# Module type   : JATS Utility
# Compiler(s)   : Perl
# Environment(s): JATS
#
# Description   : BuildTool abstraction utility
#                 Determine the Version control system in use
#                 and invoke required utility
#
# Usage         : See POD below
#
#......................................................................#

require 5.008_002;
use strict;
use warnings;

use Pod::Usage;
use Getopt::Long qw(:config pass_through);
use JatsError qw(:name=RELEASE);
use JatsSystem;

#
#   Options
#
my $opt_help = 0;
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
my $opt_spec;

#
#   VCS to program conversion
#
my $VERSION = "1.0.0";                      # Update this
my %vcs = (
    'SVN' => 'jats_svnrelease.pl',
    'CC'  => 'jats_ccrelease.pl',
    );

################################################################################
#   Mainline
#
#
#   Parse the user options
#   Leave unknown options alone and don't complain
#
my @FULL_ARGV = @ARGV;
Verbose ("Parsing Options");
my $result = GetOptions (
                "help:+"        => \$opt_help,              # flag, multiple use allowed
                "manual:3"      => \$opt_help,              # flag
                "v|verbose:+"   => \$opt_verbose,           # flag, multiple use allowed
                "label=s"       => \$opt_spec,              # Array of build specs
                );

                #
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
                #
#
#   Process help and manual options
#   Only if we arn't parsing stuff to other routines
#
$opt_help = 0 if ( $opt_spec );
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
pod2usage(-verbose => 2)  if ( $opt_help > 2 );

ErrorConfig( 'verbose' => $opt_verbose );

#
#   Label must be provided - its how we determine the type of VCS
#
Error ("No label provided") unless ( defined $opt_spec );

#
#   Examine the label and determine the VCS encode method
#   Label MUST be of the form
#       XXX::text
#   Where XXX specifies the Version Control System
#
$opt_spec =~ m~^(.+?)::.+~;
my $protocol = $1;
Error ("Badly formatted label. Does not identify VCS", "Label: $opt_spec" )
    unless ( $protocol );
Verbose3("Protocol: $protocol");

Error ("Unknown VCS in label: $opt_spec")
    unless ( exists $vcs{$protocol});

#
#   Pass control to the required utility
#
exit JatsTool ( $vcs{$protocol}, @FULL_ARGV );

#-------------------------------------------------------------------------------
#   Documentation
#

=pod

=head1 NAME

jats_vcsrelease - Extract /Release a Package

=head1 SYNOPSIS

  jats etool vcsrelease [options]

 Options:
    -help[=n]           - brief help message
    -help -help         - Detailed help message
    -man[=n]            - Full documentation
    -verbose[=n]        - Verbose operation
    -label=label        - Label
    Others              - Passed on

=head1 OPTIONS

=over 8

=item B<-help[=n]>

Print a brief help message and exits.

The verbosity of the help text can be controlled by setting the help level to a
number in the range of 1 to 3, or by invoking the option multiple times.

=item B<-man[=n]>

Without a numeric argument this is the same as -help=3. Full help will be
displayed.

With a numeric argument, this option is the same as -help=n.

=item B<-verbose[=n]>

This option will increase the level of verbosity of the utility.

If an argument is provided, then it will be used to set the level, otherwise the
existing level will be incremented. This option may be specified multiple times.

=item B<-label=text>

This option is used to determine the VCS system to use to create the workspace
required for the build.

=back

=head1 DESCRIPTION

This utility is used by the automated build system to create a workspace
for the view. The main function of this utility is to invoke the correct
utility for the creation of a workspace.

The utility will examine the -label option and detect the required Version
Control System. It will then invoke a suitable tools to create the workspace.

The label must start with a Version Control Header. This is of the form of:

    XXX::Data

Where XXX identifies the Version Control System. Valid values are:

=over 8

=item   CC  - ClearCase

The remainder of the label contains a path and a label.

The L<ccrelease|TOOLS::jats_ccrelease> utility will be invoked with the command line
options passed through.

=item   SVN - SubVersion

The remainder of the label contains a URL without the site-specific protocol
or server.

The L<svnrelease|TOOLS::jats_svnrelease> utility will be invoked with the command line
options passed through.

=back

All other command line options are passed to the tool. Thus the tools must
have a common set of options.

=cut