Subversion Repositories DevTools

Rev

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