Subversion Repositories DevTools

Rev

Rev 5710 | Details | Compare with Previous | Last modification | View Log | RSS feed

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