Subversion Repositories DevTools

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
341 dpurdie 1
########################################################################
2
# Copyright (C) 2008 ERG Limited, All rights reserved
3
#
4
# Module name   : jats_release.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
                "extract=s"     => \$opt_spec,              # Array of build specs
57
                );
58
 
59
                #
60
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
61
                #
62
#
63
#   Process help and manual options
64
#   Only if we arn't parsing stuff to other routines
65
#
66
$opt_help = 0 if ( $opt_spec );
67
pod2usage(-verbose => 0, -message => "Version: $VERSION") if ($opt_help == 1 || ! $result);
68
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
69
pod2usage(-verbose => 2)  if ( $opt_help > 2 );
70
 
71
ErrorConfig( 'verbose' => $opt_verbose );
72
 
73
#
74
#   Label must be provided - its how we determine the type of VCS
75
#
76
Error ("No label provided") unless ( defined $opt_spec );
77
 
78
#
79
#   Examine the label and determine the VCS encode method
80
#   Label MUST be of the form
81
#       XXX::text
82
#   Where XXX specifies the Version Control System
83
#
84
$opt_spec =~ m~^(.+?)::.+~;
85
my $protocol = $1;
86
Error ("Badly formatted label. Does not identify VCS", "Label: $opt_spec" )
87
    unless ( $protocol );
88
Verbose3("Protocol: $protocol");
89
 
90
Error ("Unknown VCS in label: $opt_spec")
91
    unless ( exists $vcs{$protocol});
92
 
93
#
94
#   Pass control to the required utility
95
#
96
exit JatsTool ( $vcs{$protocol}, @FULL_ARGV );
97
 
98
#-------------------------------------------------------------------------------
99
#   Documentation
100
#
101
 
102
=pod
103
 
104
=head1 NAME
105
 
106
jats_release - Release a Package
107
 
108
=head1 SYNOPSIS
109
 
110
  jats etool release [options]
111
 
112
 Options:
113
    -help[=n]           - brief help message
114
    -help -help         - Detailed help message
115
    -man[=n]            - Full documentation
116
    -verbose[=n]        - Verbose operation
117
    -label=label        - Label
118
    Others              - Passed on
119
 
120
=head1 OPTIONS
121
 
122
=over 8
123
 
124
=item B<-help[=n]>
125
 
126
Print a brief help message and exits.
127
 
128
The verbosity of the help text can be controlled by setting the help level to a
129
number in the range of 1 to 3, or by invoking the option multiple times.
130
 
131
=item B<-man[=n]>
132
 
133
Without a numeric argument this is the same as -help=3. Full help will be
134
displayed.
135
 
136
With a numeric argument, this option is the same as -help=n.
137
 
138
=item B<-verbose[=n]>
139
 
140
This option will increase the level of verbosity of the utility.
141
 
142
If an argument is provided, then it will be used to set the level, otherwise the
143
existing level will be incremented. This option may be specified multiple times.
144
 
145
=item B<-label=text>
146
 
147
This option is used to determine the VCS system to use to create the workspace
148
required for the build.
149
 
150
=back
151
 
152
=head1 DESCRIPTION
153
 
154
This utility is used by the automated build system to create a workspace
155
for the view. The main function of this utility is to invoke the correct
156
utility for the creation of a workspace.
157
 
158
The utility will examine the -label option and detect the required Version
159
Control System. It will then invoke a suitable tools to create the workspace.
160
 
161
The label must start with a Version Control Header. This is of the form of:
162
 
163
    XXX::Data
164
 
165
Where XXX identifies the Version Control System. Valid values are:
166
 
167
=over 8
168
 
169
=item   CC  - ClearCase
170
 
171
The remainder of the label contains a path and a label.
172
 
173
=item   SVN - SubVersion
174
 
175
The remainder of the label contains a URL without the site-specific protocol
176
or server.
177
 
178
=back
179
 
180
All other command line options are passed to the tool. Thus the tools must
181
have a common set of options.
182
 
183
 
184
=cut
185
 
186