Subversion Repositories DevTools

Rev

Rev 349 | Go to most recent revision | 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_ccsave_build.pl
5
# Module type   : JATS Utility
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : Build Daemon Support Utility
10
#                 This utility will:
11
#                   +   Assume the CWD is where the build file is located
12
#                   +   Within a version controlled view
13
#                   +   Determine a suitable label for the package
14
#                   +   Save the build file in the view
15
#                   +   Label the resultant view
16
#
17
# Usage:        : See POD at end of this file
18
#
19
#               jats etool  jats_ccsave_build
20
#                   -infile     auto.xml/auto.pl
21
#                   -outfile    xxxdepends.xml/build.pl
22
#                   -pname      package_name
23
#                   -pversion   package_version
24
#                   -infofile   path_to_info_file
25
#                   -wiplabel   Existing WIP label (optional)
26
#                   -baselabel  View label
27
#
28
#......................................................................#
29
 
30
use strict;
31
use warnings;
32
use JatsError;
33
use JatsBuildFiles;
34
use JatsSystem;
35
use JatsProperties;
36
use Getopt::Long;
37
use Pod::Usage;                             # required for help support
38
use Cwd;
39
 
40
################################################################################
41
#   Option variables
42
#
43
 
44
my $VERSION = "2.0.0";                      # Update this
45
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
46
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
47
my $opt_infile  = "auto.pl";
48
my $opt_ofile = "build.pl";
49
my $opt_help = 0;
50
my $opt_branch_default = "AutoBuilder";
51
my $opt_branch;
52
my $opt_newbranch;
53
my $opt_infofile;
54
my $opt_pname;
55
my $opt_pversion;
56
my $opt_wiplabel;
57
my $opt_baselabel;
58
 
59
#
60
#   Globals
61
#
62
my $root_dir;
63
my $pkg_label;
64
my $tag_label;
65
my @error_list;
66
my $last_result;
67
my @last_results;
68
my $label_created;
69
 
70
#
71
#   Configuration options
72
#
73
my $result = GetOptions (
74
                "help:+"        => \$opt_help,              # flag, multiple use allowed
75
                "manual:3"      => \$opt_help,              # flag
76
                "verbose:+"     => \$opt_verbose,           # flag
77
 
78
                "outfile=s"     => \$opt_ofile,             # string
79
                "infile=s"      => \$opt_infile,            # string
80
                "branch=s"      => \$opt_branch,            # string
81
                "newbranch"     => \$opt_newbranch,         # string
82
 
83
                "infofile=s"    => \$opt_infofile,          # string
84
                "pname=s"       => \$opt_pname,             # string
85
                "pversion=s"    => \$opt_pversion,          # string
86
                "wiplabel=s"    => \$opt_wiplabel,          # string
87
                "baselabel=s"   => \$opt_baselabel,         # string
88
 
89
                #
90
                #   Update documentation at the end of the file
91
                #
92
                );
93
 
94
#
95
#   Process help and manual options
96
#
97
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
98
pod2usage(-verbose => 1)  if ( $opt_help == 2 );
99
pod2usage(-verbose => 2)  if ( $opt_help > 2 );
100
 
101
#
102
#   Configure the error reporting process now that we have the user options
103
#
104
ErrorConfig( 'name'    =>'CCABTSAVE',
105
             'verbose' => $opt_verbose,
106
             'on_exit' => \&display_error_list
107
           );
108
Error ("Input and output file are the same: $opt_infile" )
109
    if ( $opt_infile eq $opt_ofile );
110
 
111
Error ("Must provide a branch when usng newbranch option")
112
    if ( $opt_newbranch && ! $opt_branch );
113
 
114
$opt_branch = $opt_branch_default
115
    unless ( $opt_branch );
116
 
117
Error ("Base Label not provided")
118
    unless ( $opt_baselabel );
119
 
120
Error ("Package Name not provided")
121
    unless ( $opt_pname );
122
 
123
Error ("Package Version not provided")
124
    unless ( $opt_pversion );
125
 
126
Warning("Path to info file not provided")
127
    unless ( $opt_infofile );
128
 
129
unlink ($opt_infofile) if $opt_infofile;
130
 
131
#
132
#   User must have changed to the directory with build files
133
#   Continue with user argument sanity check
134
#
135
Error ("Input file not found: $opt_infile" )
136
    unless ( -f $opt_infile );
137
 
138
Error ("Output file not found: $opt_ofile" )
139
    unless ( -f $opt_ofile );
140
 
141
#
142
#   Sanity check the form of the baselabel
143
#   It will be used to calulate a new Version Control String
144
#   Baselabel contains: PATH and a LABEL
145
#   Need to extract and save the path
146
#
147
 $opt_baselabel =~ m~^CC::/(.+)::~ || Error("Invalid baselabel format: $opt_baselabel");
148
 my $ccpath = $1;
149
 
150
#
151
#   Determine the name of the Branch to be used
152
#   This is based on the branch that the file is already on as ClearCase does
153
#   not allow multiple instances of a branch on different sub-branches
154
#
155
ClearCmd ('describe',  '-fmt', '%n', $opt_ofile);
156
Error ("Program Terminated") if ( @error_list );
157
Error ("File may not be a VOB object: $opt_ofile" ) unless ( $last_result );
158
my $full_name = $last_result;
159
 
160
$last_result =~ m~(.*)/([^/]+)$~;
161
my $full_path = $1;
162
 
163
$last_result =~ m~(.*)/([^/]+)/([^/]+)~;
164
my $current_branch = $2;
165
 
166
$last_result =~ m~@@(.*)/([^/]+)~;
167
my $full_branch = $1;
168
my $target_branch = $full_branch;
169
my $branch_point = "";
170
 
171
Error ("Cannot determine full pathname of the file: $full_name") unless ( $full_path );
172
 
173
Verbose2 ("FullName     : $full_name" );
174
Verbose2 ("FullPath     : $full_path" );
175
Verbose2 ("Branch       : $current_branch" );
176
Verbose2 ("Userb        : $opt_branch" );
177
Verbose2 ("FullBranch   : $full_branch" );
178
#
179
#
180
#   Determine the branch that the file is on
181
#   If it is not on the desired branch then we will need to create the branch
182
#
183
#   Ensure that the required branch exists in the current VOB
184
#   Need to handle some legacy branches that were created with the name AutoBuilder
185
#   by not creating AutoBuild/AutoBuilder.AutoBuilder branches but retaining the
186
#   existing AutoBuilder branch.
187
#
188
if ( $opt_newbranch )
189
{
190
    #
191
    #   User has asked for a new branch
192
    #   Place the file on /main/xxxxx
193
    #
194
    $branch_point = "-version /main/0";
195
    $target_branch = "/main/$opt_branch";
196
 
197
}
198
elsif ( $current_branch =~ m/^$opt_branch/ )
199
{
200
    #
201
    #   Current branch has the same name ( prefix) as the desired branch
202
    #   Use it
203
    #
204
    $opt_branch  = $current_branch;
205
}
206
else
207
{
208
    #
209
    #   Current branch has a different name
210
    #   Construct new branch name
211
    #
212
    $opt_branch = "$opt_branch.$current_branch";
213
    $target_branch .= "/$opt_branch";
214
}
215
 
216
Verbose2 ("TargetBranch : $target_branch" );
217
Verbose2 ("BranchPoint  : $branch_point" );
218
 
219
#
220
#   Determine the desired label for the package
221
#   May need to pick an unassigned label
222
#
223
determine_package_label();
224
 
225
#
226
#   Ensure that the specified package label exists
227
#   Determine if it is locked too
228
#   
229
Verbose ("Checking package label: $pkg_label");
230
ClearCmd ('describe', '-fmt', '%[locked]p', "lbtype:$pkg_label" );
231
Error ("Program Terminated") if ( @error_list );
232
my $was_locked = 1 unless ( $last_result =~ m~unlocked~ );
233
 
234
#
235
#   Create the desired branch if it does not already exist
236
#   Detected locked element and unlock it
237
#
238
Verbose ("Checking branch existence: $opt_branch");
239
ClearCmd ('lstype', '-short', "brtype:$opt_branch" );
240
if ( $last_result =~ m~\(locked\)~ )
241
{
242
    Verbose ("Unlocking branch: $opt_branch");
243
    ClearCmd( 'unlock', '-c', 'Unlocked by JATS ABTSAVE', "brtype:$opt_branch" );
244
}
245
elsif ( $last_result ne $opt_branch )
246
{
247
    Verbose ("Create new branch: $opt_branch");
248
    ClearCmd ('mkbrtype', '-c', "Contains saved versions of $opt_ofile files created by the AutoBuild system", $opt_branch );
249
    Error ("Program Terminated") if ( @error_list );
250
}
251
 
252
#
253
#   Ensure that the file is not locked
254
#   Unlock the file - can't do anything to a 'locked' file
255
#
256
Verbose ("Checking for locked file: $opt_ofile");
257
ClearCmd ('lslock', '-short', $opt_ofile );
258
if ( $last_result )
259
{
260
    Verbose ("Unlocking file: $opt_ofile");
261
    ClearCmd( 'unlock', '-c', 'Unlocked by JATS ABTSAVE', $opt_ofile );
262
}
263
 
264
if ( $current_branch ne $opt_branch )
265
{
266
    #
267
    #   Need to create the initial branch point, but only if one does not already
268
    #   exists
269
    #
270
    Verbose ("Check for existing branch: $opt_branch" );
271
    if ( ClearCmd( 'find', $opt_ofile, '-branch', "brtype($opt_branch)", '-print' ) )
272
    {
273
        Error ("Internal error. Cleartool find should not fail");
274
    }
275
    if ( $last_result )
276
    {
277
        #
278
        #   A branch already exists - and there can only be one
279
        #
280
        $last_result =~ m~@@(.*)~;
281
        $target_branch = $1;
282
        Error ("Cannot determine full branch path: $last_result") unless ( $target_branch );
283
        Verbose2 ("Target Branch: $target_branch" );
284
    }
285
    else
286
    {
287
        Verbose ("Create the initial branch point" );
288
        ClearCmd( 'mkbranch', '-nco', '-nc', '-nwarn', $branch_point, $opt_branch, $opt_ofile );
289
    }
290
}
291
 
292
#
293
#   Ensure that the branch with the target auto builder file on is not locked
294
#
295
ClearCmd ( 'lslock', '-short', "$opt_ofile\@\@$target_branch" );
296
if ( $last_result )
297
{
298
    Verbose ("Unlocking branch: $target_branch");
299
    ClearCmd( 'unlock', '-c', 'Unlocked by JATS ABTSAVE', "$opt_ofile\@\@$target_branch" );
300
}
301
 
302
 
303
#
304
#   Look for a checked out file on the target branch
305
#   It may be reserved - this will kill the process, so unreserve it
306
#
307
if ( ClearCmd( 'lsco', '-long', '-brtype', $opt_branch, $opt_ofile ) )
308
{
309
    Error ("Internal error. Cleartool lsco should not fail");
310
}
311
 
312
#
313
#   Can only have one 'reserved' checkout on the branch, but it may not
314
#   be the first one listed.
315
#       Lines are in sets of 3
316
#           1) Not used
317
#           2) Has keyword reserved
318
#           3) Has full path to view server
319
#   Need veiew server path, iff its a reserved checkout
320
#
321
my $reserved = undef;
322
foreach ( @last_results )
323
{
324
    #
325
    #   Once reserved has been seen, the next line will contain the view path
326
    #   Note: ClearCmd has changed \ to /, so change them back
327
    #         May be problematical. It looks like this has been
328
    #         changed several times.
329
    #
330
    if ( $reserved )
331
    {
332
        m~\(\"(.+)\"\)~;
333
        my $view = $1;
334
        $view =~ s~/~\\~g unless ( $ENV{GBE_UNIX} );
335
        Verbose ("Reserved checkout: Target View: $view" );
336
        ClearCmd( 'unreserve', '-comment', 'Unreserved by JATS ABTSAVE', '-view', $view, $opt_ofile );
337
        #
338
        #   Only one reserved file can exist, so there is no more to do
339
        #
340
        last;
341
    }
342
 
343
    #
344
    #   Check to see if this line flags a reserved version
345
    #
346
    $reserved = m~\(reserved\)~;
347
}
348
 
349
#
350
#   Use clearcase to checkout the output file
351
#
352
Verbose ("Checkout file: $opt_ofile" );
353
ClearCmd ('co', '-nc', '-nq', '-ndata', '-nwarn', '-branch', $target_branch, $opt_ofile);
354
Error ("Program Terminated") if ( @error_list );
355
 
356
#
357
#   Place the label on this file
358
#       If the label is locked then unlock it first
359
#       This is OK, because we are the builder ( or have permission )
360
#
361
if ( $was_locked )
362
{
363
    Verbose ("Relocking label: $pkg_label");
364
    ClearCmd ('unlock', "lbtype:$pkg_label" );
365
}
366
 
367
ClearCmd ('mklabel', '-replace', $pkg_label, $opt_ofile );
368
my @delayed_error = @error_list;
369
 
370
ClearCmd ('lock', "lbtype:$pkg_label" ) if $was_locked;
371
 
372
#
373
#   Place a Hyperlink Merge arrow between the two files if it looks as though we
374
#   have stolen the file or its label. If the original build file is on a different branch
375
#   the we have stolen it.
376
#
377
Verbose ("Check need to create a Hyperlink" );
378
 
379
my $target_name = $opt_ofile;
380
Verbose2 ("FullName: $full_name :Branch: $full_branch" );
381
Verbose2 ("TargetName: $target_name :Branch: $target_branch" );
382
 
383
if ( ( $full_branch ne $target_branch ) && ( !$opt_newbranch ) )
384
{
385
    Verbose ("Creating Hyperlink" );
386
    ClearCmd ('mkhlink', 'Merge', $full_name, $target_name);
387
}
388
 
389
#
390
#   Check in the file auto.pl file as the new build.pl file
391
#   This may get ugly if the current config-spec does not have a rule to
392
#   select the "new" build.pl file. This is often the case
393
#
394
#   Examine the error output and discard these errors
395
#
396
Verbose ("Check in build file: $opt_ofile" );
397
ClearCmd ('ci', '-c', "AutoBuilder checkin: $pkg_label", '-identical', '-from', $opt_infile, $opt_ofile);
398
Error ("Program Terminated") unless ( $last_result =~ m/Checked in "$opt_ofile" version/ );
399
 
400
@error_list = @delayed_error;
401
Error ("Program Terminated") if ( @error_list );
402
 
403
#
404
#   Label the view
405
#
406
label_build_view();
407
 
408
exit 0;
409
 
410
#-------------------------------------------------------------------------------
411
# Function        : determine_package_label
412
#
413
# Description     : Determine the label that is to be applied to the package
414
#                   There are several cases to consider
415
#                       1) Compatability mode: User provides label
416
#                       2) WIP Mode. Determine name of label to use in rename
417
#                       3) Create a new label
418
#
419
# Inputs          : Globals
420
#
421
# Returns         : Globals
422
#                       $pkg_label
423
#
424
sub determine_package_label
425
{
426
    #
427
    #   Determine the desired label for the package
428
    #   This is a function of the package name and the package version
429
    #   The two are joined with a '.'
430
    #
431
    $tag_label = $opt_pname . '_' . $opt_pversion;
432
 
433
    #
434
    #   Ensure that desired label is "free", if not then hunt for a new one
435
    #   Determine the name of a 'new' label
436
    #
437
    my $base_label = $tag_label;
438
    my $index = 0;
439
 
440
    while ( ++$index )
441
    {
442
        if ( $index > 20 )
443
        {
444
            Error ("Cannot determine new label. Retry limit exceeded");
445
        }
446
        Verbose2 ("Trying $tag_label");
447
 
448
        unless (ClearCmd ('describe', '-short', "lbtype:$tag_label" ) )
449
        {
450
            #
451
            #   Label found - so try another
452
            #
453
            Verbose2("Label found. Try another");
454
            $tag_label = $base_label . '.' . $index;
455
            next;
456
        }
457
 
458
        #
459
        #   Warn about non standard label
460
        #
461
        Verbose ("Package will be labeled: $tag_label");
462
        Warning ("Labeling with a non-standard label: $tag_label" )
463
            if ( $index > 1 );
464
        last;
465
    }
466
 
467
    #
468
    #   Free label has been found
469
    #   Create it now, unless we are processing a WIP
470
    #
471
    unless ( $opt_wiplabel )
472
    {
473
        Verbose ("Creating new label: $tag_label");
474
        ClearCmd ('mklbtype', '-c', 'Autobuild Created', $tag_label );
475
        Error ("Cannot create new label: $tag_label" ) if ( @error_list );
476
 
477
        #
478
        #   Mark as created by this utility
479
        #   Label should be deleted on error
480
        #
481
        $label_created = $tag_label;
482
        $pkg_label = $tag_label;
483
    }
484
    else
485
    {
486
        $pkg_label = $opt_wiplabel;
487
    }
488
}
489
 
490
#-------------------------------------------------------------------------------
491
# Function        : label_build_view
492
#
493
# Description     : Label the view
494
#
495
#                   Either:
496
#                       Rename the WIP label to required name
497
#                       Label all files in the view
498
#
499
#                   Always make the lable 'mine'
500
#                   This will prevent the old owner from unlocking the label.
501
#
502
#                   Use JATS to do the hard work
503
#
504
#
505
# Inputs          : Globals
506
#
507
# Returns         : 
508
#
509
sub label_build_view
510
{
511
    if ( $opt_wiplabel )
512
    {
513
        Verbose ("Rename label: From $opt_wiplabel to $tag_label");
514
        SystemConfig ( ExitOnError => 2);
515
        JatsCmd( 'label', '-unlock', $opt_wiplabel, '-rename', $tag_label, '-lock', '-mine' );
516
    }
517
    else
518
    {
519
        Verbose ("Apply new label to package: $tag_label");
520
 
521
        #
522
        #   Label the entire (static) view
523
        #   Use special form of the labeling process that is geared
524
        #   to label the entire view.
525
        #
526
        #       This will work because this should only be done within a
527
        #       static view based on a single label. Thus the view should
528
        #       contain ony the files that form the current package.
529
        #
530
        #   Handle errors as error exit will clean up
531
        #
532
        my $rv = JatsCmd( 'label', '-entireview', $tag_label, '-replace', '-lock', , '-mine' );
533
        Error ("Failed to label all files in view")
534
            if ( $rv );
535
    }
536
 
537
    #
538
    #   Write the label out to the specified file so that the user
539
    #   can do something with it
540
    #
541
    if ( $opt_infofile )
542
    {
543
 
544
        my $data = JatsProperties::New();
545
 
546
        $data->setProperty('Label', $tag_label);
547
        $data->setProperty('WipLabel', $opt_wiplabel ) if $opt_wiplabel;
548
        $data->setProperty('PackageName', $opt_pname);
549
        $data->setProperty('PackageVersion', $opt_pversion);
550
        $data->setProperty('clearcase.branch', $opt_branch);
551
        $data->setProperty('VCS.tag', 'CC::' . $ccpath . '::' . $tag_label);
552
 
553
        $data->Dump('InfoFile') if ($opt_verbose);
554
        $data->store( $opt_infofile );
555
    }
556
}
557
 
558
#-------------------------------------------------------------------------------
559
# Function        : ClearCmd
560
#
561
# Description     : Execute a ClearCase command and capture the results
562
#                   Errors are held in one array
563
#                   Result are held in another
564
#
565
# Inputs          :
566
#
567
# Returns         :
568
#
569
sub ClearCmd
570
{
571
    my $cmd = QuoteCommand (@_);
572
    Verbose2( "cleartool $cmd" );
573
 
574
        @error_list = ();
575
        @last_results = ();
576
        $last_result = undef;
577
 
578
        open(CMD, "cleartool $cmd  2>&1 |")    || Error( "can't run command: $!" );
579
        while (<CMD>)
580
        {
581
            chomp;
582
            $last_result = $_;
583
            $last_result =~ tr~\\/~/~s;
584
            push @last_results, $last_result;
585
 
586
            Verbose2 ( "cleartool resp:" . $_);
587
            push @error_list, $_ if ( m~Error:~ );
588
        }
589
        close(CMD);
590
 
591
    Verbose2( "Exit Status: $?" );
592
    return $? / 256;
593
}
594
 
595
#-------------------------------------------------------------------------------
596
# Function        : display_error_list
597
#
598
# Description     : Display the error list and clean up
599
#                   This function is registered as an Error callback function
600
#                   it will be called on error exit
601
#
602
# Inputs          :
603
#
604
# Returns         :
605
#
606
sub display_error_list
607
{
608
    foreach ( @error_list )
609
    {
610
        print "$_\n";
611
    }
612
 
613
    #
614
    #   Perform cleanup
615
    #       Delete the label if created it anyway (which we did)
616
    #       This leaves checked in build file on branch (live with it)
617
    #
618
    JatsCmd( 'label', '-unlock', '-delete', $tag_label )
619
        if ($label_created);
620
 
621
}
622
 
623
#-------------------------------------------------------------------------------
624
#   Documentation
625
#
626
 
627
=pod
628
 
629
=head1 NAME
630
 
631
jats_ccsave_build - Save a build view to version control system
632
 
633
=head1 SYNOPSIS
634
 
635
  jats etool jats_save_build [options]
636
 
637
 Options:
638
    -help[=n]           - brief help message
639
    -help -help         - Detailed help message
640
    -man[=n]            - Full documentation
641
    -verbose[=n]        - Verbose operation
642
    -infile=xxx         - Input file (auto.pl)
643
    -outfile=xxx        - Output file (build.pl)
644
    -branch=xxx         - Branch to create (AutoBuilder)
645
    -newbranch          - Force file to be on a new (project) branch
646
    -infofile=path      - Save label information in 'path'
647
    -pname=name         - Name of the package
648
    -pversion=text      - Package version
649
    -wiplabel=text      - Current package WIP label
650
    -baselabel=text     - Base label for sandbox
651
 
652
=head1 OPTIONS
653
 
654
=over 8
655
 
656
=item B<-help[=n]>
657
 
658
Print a brief help message and exits.
659
 
660
The verbosity of the help text can be controlled by setting the help level to a
661
number in the range of 1 to 3, or by invoking the option multiple times.
662
 
663
=item B<-man[=n]>
664
 
665
Without a numeric argument this is the same as -help=3. Full help will be
666
displayed.
667
 
668
With a numeric argument, this option is the same as -help=n.
669
 
670
=item B<-verbose[=n]>
671
 
672
This option will increase the level of verbosity of the utility.
673
 
674
If an argument is provided, then it will be used to set the level, otherwise the
675
existing level will be incremented. This option may be specified multiple times.
676
 
677
=item B<-infile=xxxx>
678
 
679
This option specifies the name of the generated build configuration file that
680
will be used as a data-source for the check-in build file.
681
 
682
The default file name is 'auto.pl'.
683
 
684
=item B<-outfile=xxxx>
685
 
686
This option specifies the name of the target build configuration file that
687
will be checked in to version-control. Data from from file specifies with '-
688
infile' will be used to update the file.
689
 
690
The default file name is 'build.pl'.
691
 
692
=item B<-branch=xxxx>
693
 
694
This options specifies the root name of the target branch that will be sued to
695
contain the checked-in build file. If the branch does not exist it will be
696
created.
697
 
698
The default branch will be based on "AutoBuilder".
699
 
700
=item B<-newbranch>
701
 
702
This option will force the file to be checked into a new branch
703
The branch will be created on /main/0 unless it is already found elsewhere
704
 
705
This option allows a build.pl file to be placed on a new project branch.
706
 
707
=item B<-infofile=path>
708
 
709
This option specifies a file that this utility will use to communicate with a
710
user script. It will write the new label text into the file.
711
 
712
The file path is relative to the current working directory.
713
 
714
The file will be deleted, and only created if the utility is successful.
715
 
716
=item B<-pname=name>
717
 
718
This option specifies the package name. It will be used to construct a new
719
label for the package.
720
 
721
=item B<-pversion=xxx>
722
 
723
This option specifies the package version. It will be used to construct a new
724
label for the package.
725
 
726
=item B<-wiplabel=text>
727
 
728
This option controls the manner in which this utility will label the build view.
729
 
730
If present, the label specifies a 'Work In Progress' label. The label will be
731
renamed.
732
 
733
If not present, then the view will be labeled with a new label.
734
 
735
=item B<-baselabel=text>
736
 
737
This option specifies the Version Control Label that the current workspace
738
is based on. This may be used to determine the new label for the package.
739
 
740
This parameter is mandatory.
741
 
742
=back
743
 
744
=head1 DESCRIPTION
745
 
746
This utility is used by the automated build system to place build view under
747
version control. The utility will:
748
 
749
=over 8
750
 
751
=item * Determine a suitable label for the package
752
 
753
The label is constructed from the package name and the package version. The
754
utility will ensure that the label does not already exist. If it does it will
755
use an alternate form of the label.
756
 
757
=item * Determine a suitable branch name for the build files
758
 
759
The modified build file is placed on a file-branch.
760
 
761
=item * Locate the build files within the package
762
 
763
JATS build files do not need to be at the root of the package. The utility
764
will locate the JATS build files.
765
 
766
=item * Update the build files and save them into the version control system
767
 
768
The build file will be updated with new version information as provided by a
769
secondary configuration file.
770
 
771
The updated file will be checked into version control. It will be placed on a
772
branch so as not to affect dynamic views.
773
 
774
The operation will fail if that file is checked out "reserved". The program
775
can work around this - but its not done yet.
776
 
777
If the build file is sourced from a different branch then a Merge arrow
778
will be created to indicate where the file and its label was taken from.   
779
 
780
=item * Ensure that the package is labeled
781
 
782
The build view will be labeled.
783
 
784
If a WIP label is provided then the label will be applied to the modified
785
build file and then the label will be renamed.
786
 
787
If a WIP label is not provided, then the entire package will be labeled with a
788
suitable label.
789
 
790
=item * Return the label to the user
791
 
792
The label used to label the package will be returned to the user in an 'info'
793
file. This is a 'properties' file. The following properties are defined:
794
 
795
=over 8
796
 
797
=item   1) Label - The label used to tag the file
798
 
799
=item   3) WipLabel - The WIP label provided (optional)
800
 
801
=item   4) PackageName - The package name
802
 
803
=item   5) PackageVersion - The package version
804
 
805
=back
806
 
807
=back
808
 
809
=cut
810