Subversion Repositories DevTools

Rev

Rev 361 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
349 dpurdie 1
########################################################################
2
# Copyright (C) 2008 ERG Limited, All rights reserved
3
#
4
# Module name   : jats_vcsrelease.pl
5
# Module type   : JATS Utility
6
# Compiler(s)   : Perl
7
# Environment(s): JATS
8
#
9
# Description   : BuildTool abstraction utility
10
#                 Determine the Version control system in use
11
#                 and invoke required utility
12
#
13
# Usage         : See POD below
14
#
15
#......................................................................#
16
 
17
require 5.008_002;
18
use strict;
19
use warnings;
20
 
21
use Pod::Usage;
22
use Getopt::Long qw(:config pass_through);
23
use JatsError qw(:name=RELEASE);
24
use JatsSystem;
25
 
26
#
27
#   Options
28
#
29
my $opt_help = 0;
30
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
31
my $opt_spec;
32
 
33
#
34
#   VCS to program conversion
35
#
36
my $VERSION = "1.0.0";                      # Update this
37
my %vcs = (
38
    'SVN' => 'jats_svnrelease.pl',
39
    'CC'  => 'jats_ccrelease.pl',
40
    );
41
 
42
################################################################################
43
#   Mainline
44
#
45
#
46
#   Parse the user options
47
#   Leave unknown options alone and don't complain
48
#
49
my @FULL_ARGV = @ARGV;
50
Verbose ("Parsing Options");
51
my $result = GetOptions (
52
                "help:+"        => \$opt_help,              # flag, multiple use allowed
53
                "manual:3"      => \$opt_help,              # flag
54
                "v|verbose:+"   => \$opt_verbose,           # flag, multiple use allowed
55
                "label=s"       => \$opt_spec,              # Array of build specs
56
                );
57
 
58
                #
59
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
60
                #
61
#
62
#   Process help and manual options
63
#   Only if we arn't parsing stuff to other routines
64
#
65
$opt_help = 0 if ( $opt_spec );
66
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
67
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
68
pod2usage(-verbose => 2)  if ( $opt_help > 2 );
69
 
70
ErrorConfig( 'verbose' => $opt_verbose );
71
 
72
#
73
#   Label must be provided - its how we determine the type of VCS
74
#
75
Error ("No label provided") unless ( defined $opt_spec );
76
 
77
#
78
#   Examine the label and determine the VCS encode method
79
#   Label MUST be of the form
80
#       XXX::text
81
#   Where XXX specifies the Version Control System
82
#
83
$opt_spec =~ m~^(.+?)::.+~;
84
my $protocol = $1;
85
Error ("Badly formatted label. Does not identify VCS", "Label: $opt_spec" )
86
    unless ( $protocol );
87
Verbose3("Protocol: $protocol");
88
 
89
Error ("Unknown VCS in label: $opt_spec")
90
    unless ( exists $vcs{$protocol});
91
 
92
#
93
#   Pass control to the required utility
94
#
95
exit JatsTool ( $vcs{$protocol}, @FULL_ARGV );
96
 
97
#-------------------------------------------------------------------------------
98
#   Documentation
99
#
100
 
101
=pod
102
 
103
=head1 NAME
104
 
361 dpurdie 105
jats_vcsrelease - Extract /Release a Package
349 dpurdie 106
 
107
=head1 SYNOPSIS
108
 
361 dpurdie 109
  jats etool vcsrelease [options]
349 dpurdie 110
 
111
 Options:
112
    -help[=n]           - brief help message
113
    -help -help         - Detailed help message
114
    -man[=n]            - Full documentation
115
    -verbose[=n]        - Verbose operation
116
    -label=label        - Label
117
    Others              - Passed on
118
 
119
=head1 OPTIONS
120
 
121
=over 8
122
 
123
=item B<-help[=n]>
124
 
125
Print a brief help message and exits.
126
 
127
The verbosity of the help text can be controlled by setting the help level to a
128
number in the range of 1 to 3, or by invoking the option multiple times.
129
 
130
=item B<-man[=n]>
131
 
132
Without a numeric argument this is the same as -help=3. Full help will be
133
displayed.
134
 
135
With a numeric argument, this option is the same as -help=n.
136
 
137
=item B<-verbose[=n]>
138
 
139
This option will increase the level of verbosity of the utility.
140
 
141
If an argument is provided, then it will be used to set the level, otherwise the
142
existing level will be incremented. This option may be specified multiple times.
143
 
144
=item B<-label=text>
145
 
146
This option is used to determine the VCS system to use to create the workspace
147
required for the build.
148
 
149
=back
150
 
151
=head1 DESCRIPTION
152
 
153
This utility is used by the automated build system to create a workspace
154
for the view. The main function of this utility is to invoke the correct
155
utility for the creation of a workspace.
156
 
157
The utility will examine the -label option and detect the required Version
158
Control System. It will then invoke a suitable tools to create the workspace.
159
 
160
The label must start with a Version Control Header. This is of the form of:
161
 
162
    XXX::Data
163
 
164
Where XXX identifies the Version Control System. Valid values are:
165
 
166
=over 8
167
 
168
=item   CC  - ClearCase
169
 
170
The remainder of the label contains a path and a label.
171
 
361 dpurdie 172
The L<ccrelease|TOOLS::jats_ccrelease> utility will be invoked with the command line
173
options passed through.
174
 
349 dpurdie 175
=item   SVN - SubVersion
176
 
177
The remainder of the label contains a URL without the site-specific protocol
178
or server.
179
 
361 dpurdie 180
The L<svnrelease|TOOLS::jats_svnrelease> utility will be invoked with the command line
181
options passed through.
182
 
349 dpurdie 183
=back
184
 
185
All other command line options are passed to the tool. Thus the tools must
186
have a common set of options.
187
 
188
=cut
189