| 349 |
dpurdie |
1 |
########################################################################
|
| 5709 |
dpurdie |
2 |
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
|
| 349 |
dpurdie |
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 |
|
| 361 |
dpurdie |
103 |
=for htmltoc SYSUTIL::
|
|
|
104 |
|
| 349 |
dpurdie |
105 |
=head1 NAME
|
|
|
106 |
|
|
|
107 |
jats_vcssave_build - Release a Package
|
|
|
108 |
|
|
|
109 |
=head1 SYNOPSIS
|
|
|
110 |
|
| 361 |
dpurdie |
111 |
jats etool jats_vcssave_build [options]
|
| 349 |
dpurdie |
112 |
|
|
|
113 |
Options:
|
|
|
114 |
-help[=n] - brief help message
|
|
|
115 |
-help -help - Detailed help message
|
|
|
116 |
-man[=n] - Full documentation
|
|
|
117 |
-verbose[=n] - Verbose operation
|
|
|
118 |
-baselabel=label - Label the build view is based on
|
|
|
119 |
Others - Passed on
|
|
|
120 |
|
|
|
121 |
=head1 OPTIONS
|
|
|
122 |
|
|
|
123 |
=over 8
|
|
|
124 |
|
|
|
125 |
=item B<-help[=n]>
|
|
|
126 |
|
|
|
127 |
Print a brief help message and exits.
|
|
|
128 |
|
|
|
129 |
The verbosity of the help text can be controlled by setting the help level to a
|
|
|
130 |
number in the range of 1 to 3, or by invoking the option multiple times.
|
|
|
131 |
|
|
|
132 |
=item B<-man[=n]>
|
|
|
133 |
|
|
|
134 |
Without a numeric argument this is the same as -help=3. Full help will be
|
|
|
135 |
displayed.
|
|
|
136 |
|
|
|
137 |
With a numeric argument, this option is the same as -help=n.
|
|
|
138 |
|
|
|
139 |
=item B<-verbose[=n]>
|
|
|
140 |
|
|
|
141 |
This option will increase the level of verbosity of the utility.
|
|
|
142 |
|
|
|
143 |
If an argument is provided, then it will be used to set the level, otherwise the
|
|
|
144 |
existing level will be incremented. This option may be specified multiple times.
|
|
|
145 |
|
|
|
146 |
=item B<-baselabel=text>
|
|
|
147 |
|
|
|
148 |
This option is used to determine the VCS system to use to create the workspace
|
|
|
149 |
required for the build.
|
|
|
150 |
|
|
|
151 |
=back
|
|
|
152 |
|
|
|
153 |
=head1 DESCRIPTION
|
|
|
154 |
|
|
|
155 |
This utility is used by the automated build system to place build view under
|
|
|
156 |
version control. Multiple version control systems are supported.
|
|
|
157 |
|
|
|
158 |
This utility is a wrapper that will determine VCS and then invoke
|
|
|
159 |
The required VCS-specific utility to do the real work.
|
|
|
160 |
|
|
|
161 |
The utility will examine the -baselabel option and detect the required Version
|
|
|
162 |
Control System.
|
|
|
163 |
|
|
|
164 |
The baselabel must start with a Version Control Header. This is of the form of:
|
|
|
165 |
|
|
|
166 |
XXX::Data
|
|
|
167 |
|
|
|
168 |
Where XXX identifies the Version Control System. Valid values are:
|
|
|
169 |
|
|
|
170 |
=over 8
|
|
|
171 |
|
| 361 |
dpurdie |
172 |
=item CC
|
| 349 |
dpurdie |
173 |
|
| 361 |
dpurdie |
174 |
ClearCase
|
|
|
175 |
|
| 349 |
dpurdie |
176 |
The remainder of the label contains a path and a label.
|
|
|
177 |
|
| 361 |
dpurdie |
178 |
=item SVN
|
| 349 |
dpurdie |
179 |
|
| 361 |
dpurdie |
180 |
SubVersion
|
|
|
181 |
|
| 349 |
dpurdie |
182 |
The remainder of the label contains a URL without the site-specific protocol
|
|
|
183 |
or server.
|
|
|
184 |
|
|
|
185 |
=back
|
|
|
186 |
|
|
|
187 |
All other command line options are passed to the tool. Thus the tools must
|
|
|
188 |
have a common set of options.
|
|
|
189 |
|
|
|
190 |
Full documentation is availabe in:
|
|
|
191 |
|
|
|
192 |
=over 8
|
|
|
193 |
|
| 361 |
dpurdie |
194 |
=item *
|
| 349 |
dpurdie |
195 |
|
| 361 |
dpurdie |
196 |
L<ccsave_build|TOOLS::jats_ccsave_build>
|
| 349 |
dpurdie |
197 |
|
| 361 |
dpurdie |
198 |
=item *
|
|
|
199 |
|
|
|
200 |
L<svnsave_build|TOOLS::jats_svnsave_build>
|
|
|
201 |
|
| 349 |
dpurdie |
202 |
=back
|
|
|
203 |
|
|
|
204 |
=cut
|
|
|
205 |
|
|
|
206 |
|