Subversion Repositories DevTools

Rev

Rev 361 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
349 dpurdie 1
########################################################################
2
# Copyright (C) 2010 Vix-ERG Limited, All rights reserved
3
#
4
# Module name   : jats_vcssave_build.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=ABTSAVE);
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_svnsave_build.pl',
39
    'CC'  => 'jats_ccsave_build.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
                "baselabel=s"   => \$opt_spec,              # String
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 baselabel 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
 
105
jats_vcssave_build - Release a Package
106
 
107
=head1 SYNOPSIS
108
 
109
  jats etool release [options]
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
    -baselabel=label    - Label the build view is based on
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<-baselabel=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 place build view under
154
version control. Multiple version control systems are supported.
155
 
156
This utility is a wrapper that will determine VCS and then invoke
157
The required VCS-specific utility to do the real work.
158
 
159
The utility will examine the -baselabel option and detect the required Version
160
Control System.
161
 
162
The baselabel must start with a Version Control Header. This is of the form of:
163
 
164
    XXX::Data
165
 
166
Where XXX identifies the Version Control System. Valid values are:
167
 
168
=over 8
169
 
170
=item   CC  - ClearCase
171
 
172
The remainder of the label contains a path and a label.
173
 
174
=item   SVN - SubVersion
175
 
176
The remainder of the label contains a URL without the site-specific protocol
177
or server.
178
 
179
=back
180
 
181
All other command line options are passed to the tool. Thus the tools must
182
have a common set of options.
183
 
184
Full documentation is availabe in:
185
 
186
=over 8
187
 
188
=item * ccsave_build
189
 
190
=item * svnsave_build
191
 
192
=back
193
 
194
=cut
195
 
196