Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
392 dpurdie 1
########################################################################
2
# Copyright (C) 1998-2012 Vix Technology, All rights reserved
3
#
4
# Module name   : cc2svn_cctest_path.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : A script to test the existence of a CC label and Path
10
#                 Designed to be used as a part of the SVN conversion
11
#
12
#......................................................................#
13
 
14
require 5.008_002;
15
use strict;
16
use warnings;
17
use JatsError;
18
use JatsSystem;
19
use FileUtils;
20
use JatsBuildFiles;
21
use ArrayHashUtils;
22
 
23
use Pod::Usage;                             # required for help support
24
use Getopt::Long;
25
use Cwd;
26
 
27
my $VERSION = "1.6.0";                      # Update this
28
 
29
#
30
#   Options
31
#
32
my $opt_debug   = $ENV{'GBE_DEBUG'};        # Allow global debug
33
my $opt_verbose = $ENV{'GBE_VERBOSE'};      # Allow global verbose
34
my $opt_help = 0;                           # User help level
35
my $opt_viewname;                           # View Name
36
my $opt_path;                               # Path for view spec
37
my $opt_prefix = 1;                         # Prefix the view tag with user-name
38
my $opt_tag;                                # View tag insert (build or export or user)
39
my $opt_spec;
40
my $opt_vob;
41
 
42
#
43
#   Globals - Provided by the JATS environment
44
#
45
my $USER            = $ENV{'USER'};
46
my $UNIX            = $ENV{'GBE_UNIX'};
47
my $GBE_ABT         = $ENV{'GBE_ABT'} || '0';
48
my $MACHINENAME     = $ENV{'GBE_HOSTNAME'};
49
my $GBE_VIEWBASE    = $ENV{'GBE_VIEWBASE'};   # Root of the view
50
 
51
#
52
#   Globals
53
#
54
my $VIEWDIR_ROOT;                           # Root of the static view
55
my $VIEWTAG;                                # The view tag
56
my $VIEWDIR;                                # Absolute path to the view
57
my $VIEWPATH;                               # Path relative to clearcase
58
my $user_cwd;
59
my $error = 0;
60
my $label_count = 0;                        # Number of labels to create the view
61
my @label_not_locked;                       # List of unlocked labels
62
my @label_locked;                           # List of labels I locked
63
my @error_list;                             # ClearCmd detected errors
64
 
65
my $UNIX_VOB_PREFIX = '/vobs';
66
my $VOB_PREFIX = $UNIX ? $UNIX_VOB_PREFIX : '';
67
 
68
my $UNIX_VIEW_PREFIX = '/view/';            # Don't know how to determine this value
69
my $WIN32_VIEW_PREFIX = 'o:/';              # Don't know how to determine this value
70
my $VIEW_PREFIX = $UNIX ? $UNIX_VIEW_PREFIX : $WIN32_VIEW_PREFIX ;
71
 
72
my $VOB_SEP         = $UNIX ? '/' : '\\';
73
my $view_prefix     = "${USER}_";
74
my $ROOT_VOB;
75
my $root_vob_spec;
76
 
77
#-------------------------------------------------------------------------------
78
# Function        : Mainline Entry Point
79
#
80
# Description     :
81
#
82
# Inputs          :
83
#
84
 
85
#
86
#   Parse the user options
87
#
88
my $result = GetOptions (
89
                "help+"         => \$opt_help,              # flag, multiple use allowed
90
                "manual:3"      => \$opt_help,              # flag
91
                "v|verbose:+"   => \$opt_verbose,           # flag, multiple use allowed
92
                "label=s"       => \$opt_spec,              # Array of build specs
93
                "view=s"        => \$opt_viewname,          # String
94
                "prefix!"       => \$opt_prefix,            # flag
95
                "tag=s"         => \$opt_tag,               # string
96
                );
97
 
98
                #
99
                #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
100
                #
101
 
102
#
103
#   Process help and manual options
104
#
105
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
106
pod2usage(-verbose => 1)  if ($opt_help == 2 );
107
pod2usage(-verbose => 2)  if ($opt_help > 2 );
108
 
109
InitFileUtils();
110
 
111
#
112
#   Configure the error reporting process now that we have the user options
113
#
114
ErrorConfig( 'name'    => 'CC_TESTPATH',
115
             'verbose' => $opt_verbose );
116
 
117
#
118
#   Validate user options
119
#   Use either -label or one command line argument
120
#
121
Error ("Unexpected command line arguments present.","Cannot mix -label and command line label" )
122
    if ( $opt_spec && $#ARGV >= 0);
123
 
124
$opt_spec = pop @ARGV unless ( $opt_spec );
125
 
126
unless(  $opt_spec  )
127
{
128
    Error ("Need a label. -help for options");
129
}
130
 
131
#
132
#   Convert label with embedded VCS information into a 'normal' form.
133
#   Form:
134
#       CC::label
135
#       CC::path::label
136
#       CC::::label
137
#
138
if ( $opt_spec =~ m~^(.+?)::(.*?)(::(.+))?$~ )
139
{
140
    Error ("Label contains invalid Version Control Identifier($1): $_")
141
        if ( $1 ne 'CC' );
142
 
143
    my $ll = $2;
144
    my $path;
145
    if ( $3 )
146
    {
147
        $path = $2;
148
        $ll = $4;
149
        if ( $path  )
150
        {
151
            Error ("Multiple conflicting Embedded source paths",
152
                   "Path: $opt_path",
153
                 "VCS Spec: $_" ) if ( $opt_path && $path ne $opt_path );
154
            $opt_path = $path;
155
        }
156
    }
157
    $opt_spec = $ll;
158
}
159
Verbose ("Clean URL: $opt_spec");
160
 
161
#
162
#   Determine the machine type
163
#
164
Verbose ("Machine Type: UNIX=$UNIX");
165
 
166
Error ("Machine Name not determined")
167
    unless ( $MACHINENAME );
168
$user_cwd = getcwd;
169
 
170
Error ("USER name not determined" )
171
    unless ( $USER );
172
 
173
#
174
#   Ensure that the 'cleartool' program can be located
175
#
176
Verbose ("Locate clearcase utility in users path");
177
Error ("Cannot locate the 'cleartool' utility in the users PATH")
178
    unless ( LocateProgInPath('cleartool', '--All') );
179
 
180
#
181
#   Clean up the view root directory
182
#
183
$VIEWDIR_ROOT = Realpath($GBE_VIEWBASE) || $GBE_VIEWBASE;
184
 
185
Verbose ("Viewpath: $VIEWDIR_ROOT");
186
Error ("Cannot locate view root directory: $VIEWDIR_ROOT" ) unless (-d $VIEWDIR_ROOT);
187
 
188
#
189
#   Remove any user name from the front of the view name
190
#   Simplifies the deletion process as the user can provide
191
#   the directory name
192
#
193
$view_prefix = "" unless ( $opt_prefix );
194
 
195
#
196
#   Setup user specified viewname
197
#   Include the user name to ensure that the view name is unique-ish
198
#   Keep the name as short as possible as some compilers display a fixed
199
#   length filename in error messages and this name is part of the path
200
#
201
#   Base the viewname on the view label. This will simplify the creation
202
#   of multiple views and reduce the risk of unexpected deletion
203
#
204
$opt_viewname = $opt_spec unless ( defined $opt_viewname );
205
$opt_viewname =~ s~^$view_prefix~~ if (defined($opt_viewname) && $view_prefix );
206
 
207
#
208
#   Create the view tag
209
#   Attempt to make this globally unique
210
#   Include USER name, MACHINE name, the view name
211
#   Optionally include a user 'tag'. Provided to allow the ABT to maintain
212
#   multiple instances of a view.
213
#
214
unless ( $opt_tag )
215
{
216
    $opt_tag = 'dynamic';
217
}
218
$VIEWTAG = "${USER}_${MACHINENAME}_${opt_tag}_${opt_viewname}";
219
 
220
#
221
#   Create a clearcase view to be used for the view
222
#
223
$VIEWPATH = "$view_prefix$opt_viewname";
224
$VIEWDIR = "$VIEWDIR_ROOT/$VIEWPATH";
225
$VIEWDIR =~ tr~\\/~/~s;
226
Verbose( "Hostname: $MACHINENAME" );
227
Verbose( "Viewtag: $VIEWTAG" );
228
Verbose( "Viewpath: $VIEWPATH" );
229
Verbose( "Viewdir : $VIEWDIR" );
230
 
231
#
232
#   If the user has specified a "source path", then we can extract the VOB
233
#   from that path. It will be the first directory
234
#
235
Verbose("Locate Source VOB");
236
Error ("Need a source path" ) unless ( $opt_path );
237
 
238
#$opt_path = '/' . $opt_path;
239
$opt_path =~ tr~\\/~/~s;
240
$opt_path =~ s~/+$~~;
241
 
242
Error( "Source Path needs leading '/': $opt_path, $opt_spec") unless ( $opt_path =~ m~^/~ );
243
Error( "Source Path is a UNC" ) if ( $opt_path =~ m~^//~ );
244
Error( "Source Path has drive specifier" ) if ( $opt_path =~ m~^[A-Za-z]\:~ );
245
 
246
#
247
#   Extract the VOB from the path
248
#
249
unless ( $opt_vob )
250
{
251
    my $vob = $opt_path;
252
    $vob =~ s~^/~~g;
253
    $vob =~ s~/.*~~g;
254
 
255
    $opt_vob = $vob;
256
    Verbose ("Extract VOB from path: $vob" );
257
}
258
 
259
#
260
#   Setup user specified VOB
261
#
262
    $ROOT_VOB = "/$opt_vob";
263
    $ROOT_VOB =~ s~//~/~g;
264
 
265
#
266
#   Ensure that the label is present within the specified VOB
267
#   Hunt for the user specified label in a number of well known VOBs
268
#
269
if ( $opt_spec )
270
{
271
    Verbose("Ensure Label is found in a VOB");
272
    my $found = 0;
273
    my $spec = $opt_spec;
274
    my $vob = $ROOT_VOB;
275
    $vob = $UNIX_VOB_PREFIX . $vob if ( $UNIX );
276
    (my $vob_name = $vob) =~ s~/~$VOB_SEP~g;
277
 
278
    Verbose2 ("Examine label $spec in vob: $vob" );
279
 
280
    my $cmd = ClearToolCmd ('lstype', "lbtype:$spec\@$vob_name");
281
    my $cmd_done = 0;
282
    open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
283
    while (<CMD>)
284
    {
285
        #
286
        #   Filter output from the user
287
        #   Stay in loop to avoid Broken Pipe message
288
        #
289
        chomp;
290
        Verbose2("lstype: $_");
291
        next if ( $cmd_done );
292
        next if ( m~Error~ );
293
        next unless ( m~label type~ );
294
        push @label_not_locked, $spec unless( m~\(locked\)~ );
295
        $label_count++;
296
        $found = $vob;
297
        $cmd_done = 1;
298
    }
299
    close(CMD);
300
 
301
    Error ("Label $spec not found in $ROOT_VOB")
302
        unless ( $found );
303
    Verbose ("Label $spec found in vob: $found" );
304
 
305
    $ROOT_VOB = $found;
306
 
307
    #
308
    #   Create a VOB spec extension
309
    #
310
    $root_vob_spec = '@' . $ROOT_VOB;
311
    $root_vob_spec =~ s~/~$VOB_SEP~g;
312
}
313
 
314
#
315
#   Extracting files then ...
316
#
317
extract_files_from_view();
318
exit 0;
319
 
320
#-------------------------------------------------------------------------------
321
# Function        : ClearCmd
322
#
323
# Description     : Execute a cleartool command
324
#                   Capture error messages only
325
#
326
# Inputs          : Command to execute
327
#                   Takes an array of command argumeents and will quote them
328
#
329
# Returns         : Exit code
330
#                   Also the global @error_list
331
#
332
sub ClearCmd
333
{
334
    @error_list = ();
335
 
336
    my $cmd = ClearToolCmd(@_);
337
    open(CMD, "$cmd  2>&1 |")    || Error "can't run command: $!";
338
    while (<CMD>)
339
    {
340
        chomp;
341
        Verbose ($_);
342
        push @error_list, $_ if ( m~Error:~ );
343
    }
344
    close(CMD);
345
 
346
    Verbose2 "Exit Status: $?";
347
    return $? / 256;
348
}
349
 
350
#-------------------------------------------------------------------------------
351
# Function        : ClearToolCmd
352
#
353
# Description     : Create a nice escaped cleartool command
354
#
355
# Inputs          : An array of cleartool command line arguments
356
#
357
# Returns         : A string that has been quoted
358
#
359
sub ClearToolCmd
360
{
361
    my $cmd = 'cleartool ' . QuoteCommand( @_);
362
    Verbose2 $cmd;
363
    return $cmd;
364
}
365
 
366
#-------------------------------------------------------------------------------
367
# Function        : extract_files_from_view
368
#
369
# Description     : This function will
370
#                       Create a dynamic view
371
#                       Copy all the files out of the view
372
#                       Delete the view
373
#
374
#                   Its used in the creation of escrow directories
375
#
376
# Inputs          : None
377
#                   All done via globals
378
#
379
# Returns         : 
380
#
381
sub extract_files_from_view
382
{
383
    my $vob_mounted = 1;
384
    my $vob_name;
385
 
386
    #
387
    #   Which config spec
388
    #   Create config spec in local dir
389
    #
390
    my $configFile = "config_spec.$$.txt";
391
    my $config = create_config_spec( $configFile );
392
 
393
    #
394
    #   Create the view and insert the config spec
395
    #
396
    ClearCmd ( 'rmview', '-tag', $VIEWTAG );
397
    ClearCmd ( 'mkview', '-tag', $VIEWTAG, '-stgloc', '-auto' );
398
    ClearCmd ( 'setcs',  '-tag', $VIEWTAG, $config );
399
 
400
    #
401
    #   Ensure that the base VOB has been 'mounted'
402
    #   Dynamic views require vobs to be mounted
403
    #
404
    ($vob_name = $ROOT_VOB) =~ s~/~$VOB_SEP~g;
405
    $vob_mounted = ClearCmd ('mount', $vob_name);
406
 
407
    #
408
    #   Calculate where the dynmaic view will be
409
    #   This differ between UNIX/WINDOWS
410
    #
411
    my $vpath = $VIEW_PREFIX . $VIEWTAG . $VOB_PREFIX;
412
    my $cpath = $vpath;
413
       $cpath .= $opt_path if ( $opt_path );
414
    #
415
    #   Is the view where we expect it to be
416
    #
417
    Error ("Cannot locate dynamic view",
418
            "Looking in: $vpath" ) unless -d $vpath;
419
    Verbose("Dynamic view path: $vpath" );
420
    Verbose ("Dynamic view tag : $VIEWTAG" );
421
 
422
    Message ("Dynamic view path: $cpath" );
423
    my $valid = -d ($cpath);
424
 
425
    ClearCmd ( 'rmview', '-tag', $VIEWTAG );
426
    unlink $configFile;
427
    Error ("View Path not found") unless ($valid);
428
}
429
 
430
#-------------------------------------------------------------------------------
431
# Function        : create_config_spec
432
#
433
# Description     : Creates a config spec
434
#
435
# Inputs          : $config     - Path to the config file
436
#
437
# Returns         : Path to the config spec
438
#
439
sub create_config_spec
440
{
441
    my ($config_file) = @_;
442
 
443
    #
444
    #   Calc the path to a directory in the view which we really want to
445
    #   consider as the base. Only want to see folders above this base.
446
    #   Don't want to add elements above the base
447
    #
448
    my $basepath = ($opt_path) ? "\"${VOB_PREFIX}${opt_path}\""     : $ROOT_VOB;
449
    my $elroot   = ($opt_path) ? "\"${VOB_PREFIX}${opt_path}/...\"" : '*';
450
    my $elpath   = ($opt_path) ? $opt_path : '';
451
 
452
    #
453
    #   Create a config spec to be used to populate the view
454
    #       Do not branch directories
455
    #       Do not extract files from lost+found
456
    #
457
    Verbose( "Create config spec");
458
    my @config;
459
    push @config, "element * CHECKEDOUT";
460
    push @config, "element .../lost+found -none";
461
 
462
    #
463
    #   Insert rules to prevent branching above the load path
464
    #   This will be the root of the package
465
    #
466
    if ( $opt_path )
467
    {
468
        my $fulldir = $VOB_PREFIX;
469
        my @parts = split ('/', $opt_path);
470
        shift @parts;                                   # Skip first as its empty
471
        pop @parts;                                     # Skip last as its the package
472
        foreach my $dir ( @parts )
473
        {
474
            $fulldir .= "/$dir";
475
            push @config, "element -dir \"$fulldir\" $opt_spec -nocheckout";
476
        }
477
    }
478
    else
479
    {
480
        push @config, "element -dir \"$ROOT_VOB\" $opt_spec -nocheckout";
481
    }
482
 
483
    #
484
    #   Rules to extract elements within the load path
485
    #
486
    push @config, "element $elroot $opt_spec";
487
 
488
    #
489
    #   Load rule
490
    #   Quote the path so that spaces will be correcly handled
491
    #
492
    push @config, "load $basepath";
493
 
494
    Message ("Config Spec", @config )
495
        if ( IsVerbose(1) );
496
 
497
    FileCreate ($config_file, \@config);
498
    return $config_file;
499
}
500
 
501
#-------------------------------------------------------------------------------
502
#   Documentation
503
#
504
 
505
=pod
506
 
507
=for htmltoc    SYSUTIL::cc2svn::
508
 
509
=head1 NAME
510
 
511
cc2svn_cctest_path - Test the existence of a ClearCase Path
512
 
513
=head1 SYNOPSIS
514
 
515
  jats cc2svn_cctest_path [options] [-label=]label
516
 
517
 Options:
518
    -help              - brief help message
519
    -help -help        - Detailed help message
520
    -man               - Full documentation
521
    -label=xxx         - Clearcase label
522
    -spec=xxx          - Same as -label=xxx
523
    -path=xxx          - Source Path
524
    -view=xxx          - Modify the name of the created view
525
    -vob=vobname       - VOB name
526
    -build=xxx         - Package Name to build
527
    -root=xxx          - Root directory for generated view
528
    -latestroot=xxx    - Use the LATEST rootlevel directory 'xxx'
529
    -[mk]branch=xxx    - Will create a view with a branch rule
530
    -config=xxx        - Create a view with the provided config spec
531
    -tag=xxx           - Alternate tag used with in the ViewTag
532
    -extract           - Extract the view and exit
533
    -extractfiles      - Extract files, without a view
534
    -cache             - Refresh local dpkg_archive cache
535
    -delete            - Remove any existing view and exit
536
    -debugOnly         - Make only the debug version
537
    -prodOnly          - Make only the production version
538
    -[no]dpkg          - Transfer package into dpkg_archive
539
    -[no]copy          - Transfer pkg directory to the current user directory
540
    -[no]reuse         - Reuse the view
541
    -[no]test          - Test package build. Implies nocopy and nodpkg
542
    -[no]keep          - Keep the view after the build
543
    -[no]lock          - Lock labels
544
    -[no]beta          - Release a beta package
545
    -[no]merge         - Merge packages into dpkg_archive
546
    -[no]runtests      - Run units tests. Default is runtests
547
    -[no]prefix        - Supress user prefix in view name. Default prefix is USER
548
 
549
=head1 OPTIONS
550
 
551
=over 8
552
 
553
=item B<-help>
554
 
555
Print a brief help message and exits.
556
 
557
=item B<-help -help>
558
 
559
Print a detailed help message with an explanation for each option.
560
 
561
=item B<-man>
562
 
563
Prints the manual page and exits.
564
 
565
=item B<-label> or B<-spec>
566
 
567
The ClearCase label to use as the base for the view.
568
 
569
Eg: daf_utils_math_3.2.1
570
 
571
=item B<-view name>
572
 
573
Specified an alternate view name and tag to be used. This option does not provide the
574
full name of the view.
575
 
576
The view tag will be : "${USER}_${MACHINENAME}_${TAG}_${NAME}"
577
 
578
The view path will be: "${USER}_${NAME}"
579
 
580
The default "NAME" is the first label specified.
581
The default "TAG" is build. See B<-tag=tagname>.
582
 
583
If the user provides a view "name" that is prefixed with their user name
584
('${USER}_'), then the username will be stripped of for internal processing.
585
This allows a user to provide a view path when deleting a view.
586
 
587
=item B<-path=xxx>
588
 
589
Specifies the source path to the root of the extracted file tree. This option has several uses:
590
 
591
=over 8
592
 
593
=item   *
594
 
595
Provide a sanity test of the "Source Path" item within Release Manager
596
 
597
=item   *
598
 
599
Specify the VOB that contains the source. The VOB name will be extracted and
600
used as the B<-vob> parameter.
601
 
602
=item   *
603
 
604
Limit the work to do in extracting the file tree.
605
 
606
=back
607
 
608
=item B<-vob=xxx>
609
 
610
Specifies the Clearcase VOB in which the clearcase label will be located.
611
This is used as the basis for locating and loading the files within the view.
612
 
613
By default this utility will examine all the VOBs for the label.
614
 
615
=item B<-build=xxx>
616
 
617
This option allows the user to specify the packages to be built and the
618
order in which the packages are to be built.
619
This is useful if the extracted view contains multiple build files
620
 
621
This option may be used multiple times.
622
 
623
There are two forms in which the build target can be specified. It can be
624
specified as a full package name and vesrion, or as a package name and the
625
project suffix.
626
 
627
By default the program will assume that there is only one build file in the
628
view and will not build if multiple files are present, unless the package to be
629
built can be resolved.
630
 
631
The location mechanism operates for both JATS and ANT build files.
632
 
633
Example: -build=jats-api.1.0.0000.cr
634
 
635
This will locate the build file that builds version 1.0.0000.cr of the jats-api
636
package. The version numbers must match exactly.
637
 
638
Example: -build=jats-api.cr -build=jats-lib.cr
639
 
640
This will located the build files that build the jats_api (cr) package and the
641
jats-lib (cr) package. The version of the packages will not be considered.
642
 
643
=item B<-root=xxx>
644
 
645
This option allows the location of the generated view to be specified on the
646
command line. It overides the value of GBE_VIEWBASE.
647
 
648
If the comamnd is invoked within a development sandbox, then the default
649
location will be the root directory of the development sandbox.
650
 
651
=item B<-latestroot=xxx>
652
 
653
This option enables a work around for a bad-labelling practice that has existed
654
in the past. This LATEST version of the named (xxx) branch will be added to
655
the config spec used to create the view.
656
 
657
This is a work around for a problem where the top-level directory in the VOB has
658
not been labelled. This can result in unreproducible builds.
659
 
660
This option allows the utility to construct a view, but the user SHOULD label
661
the root level directory to correct the problem.
662
 
663
The use of this switch will add the following lines to the config spec:
664
 
665
    element -directory /DPG_SWBase /main/xxxx/LATEST
666
 
667
=item B<-branch=xxx or -mkbranch=xxx>
668
 
669
This option will create a view such that files that are checked out will be
670
checked out on the named branch. This is intended to facilitate the maintenance
671
of existing packages - the creation of a patch.
672
 
673
The named branch must exist within the VOB containing the label. The script will
674
check for its existence.
675
 
676
The use of this switch will add the following lines to the config spec:
677
 
678
    element * .../xxx/LATEST
679
    element * label -mkbranch xxx
680
    element * /main/0 -mkbranch xxx
681
 
682
=item B<-config=config_spec>
683
 
684
This option is an alternate mechanism to create a static view. The view will be
685
based on the provided configuration spec. This view cannot be used to release a package.
686
The option is intended to simplify development.
687
 
688
This option is incompatibale with:
689
 
690
    -release
691
    -label
692
    -branch
693
    -path
694
    -vob
695
 
696
=item B<-tag=text>
697
 
698
This option alters the ClearCase view tag created for the view. It allows
699
the creation of multiple views based on the same label. Intended to be used in
700
the automated build system to create unique views tags.
701
 
702
The default tag is 'build'.
703
 
704
=item B<-extract>
705
 
706
With this option the view is created and the left in place. The user may then
707
access the files within the view. The view should not be used for a
708
production release.
709
 
710
=item B<-extractfiles>
711
 
712
With this option the utility will create a dynamic view and transfer files from
713
the view to the user's tararget. The dynamic view is then removed.
714
 
715
This command is intended to simplify the process of creating an escrow.
716
 
717
=item B<-cache>
718
 
719
Forces external packages to be placed in the local dpkg_archive cache.
720
 
721
The normal operation is to copy the packages, only if they do not already exist
722
in the local cache. This option may be used to ensure that the local copy is
723
correct and up to date.
724
 
725
=item B<-delete>
726
 
727
Delete the view used by the program, if it exists. This option may be used to
728
cleanup after an error.
729
 
730
Note: Ensure that no files are open in the view and that the users current
731
working directory is not in the view as these will prevent the view from being
732
deleted.
733
 
734
=item B<-debugOnly>
735
 
736
Make only the debug version of the package. The default it to create both the
737
debug and production version of the package. The type of build may be  further
738
limited by options within the package.
739
 
740
=item B<-prodOnly>
741
 
742
Make only the production version of the package. The default it to create both the
743
debug and production version of the package. The type of build may be  further
744
limited by options within the package.
745
 
746
=item B<-[no]dpkg>
747
 
748
Copy the generated package into dpkg_archive. This is the default mode of
749
operation.
750
 
751
=item B<-[no]copy>
752
 
753
Copy the built "pkg" directory to the users current directory. The entire
754
"pkg" subdirectory includes the full package named directory for the package
755
that has been built.
756
 
757
=item B<-[no]reuse>
758
 
759
This flag allows the view created by the program to be re-used.
760
 
761
=over 8
762
 
763
=item *
764
 
765
The view is not deleted before being populated.
766
 
767
=item *
768
 
769
The view will not be populated if it does exist.
770
 
771
=item *
772
 
773
The view will not be deleted at the end the process.
774
 
775
=back
776
 
777
This option is useful for debugging a build process.
778
 
779
=item B<-[no]test>
780
 
781
Test the building of the package. This option implies "nocopy" and "nodpkg".
782
 
783
=item B<-[no]keep>
784
 
785
Keep the clearcase view after the build. The default option is "nokeep"
786
 
787
This option is different to the "reuse" in that the view will be deleted, if
788
it exists, before the build, but will be retained at the completion of the
789
process. The user may then manually extract the created package.
790
 
791
The view may be deleted with the the "delete" option; taking care to ensure that
792
no files are open in the view and that the users current working directory is
793
not in the view.
794
 
795
=item B<-[no]lock>
796
 
797
Lock any unlocked labels before attempting the build. This operation may be used
798
to ensure that a release build does not fail due to the labels not being locked.
799
The label is locked before the view is constructed and populated.
800
 
801
This operation may fail if the user does not "own" the label.
802
 
803
=item B<-[no]beta>
804
 
805
This option overrides many of the package release tests to allow a beta package
806
to be released.
807
 
808
=item B<-[no]merge>
809
 
810
This option will merge packages being built on multiple machines into
811
dpkg_archive. By default, if a package already exists in the archive it will be
812
deleted and replaced. With this option the package will be merged. The merge
813
process does not over write files found in the archive.
814
 
815
=item B<-[no]runtests>
816
 
817
This option will allow the suppression of the running of the unit tests included
818
with the component. By default the tests are run. This can be suppressed
819
without affecting the release process.
820
 
821
=back
822
 
823
=head1 DESCRIPTION
824
 
825
This program is the primary tool for the creation, recreation and release of
826
packages within the B<ERG> build environment, although the program can perform a
827
number of very useful operations required during normal development and
828
maintenance.
829
 
830
This program will build a system containing one or more inter-related build
831
files using the JATS build tools.
832
 
833
In normal operation the program will:
834
 
835
=over 8
836
 
837
=item Remove View
838
 
839
Remove any existing view of the same name. The view will not be removed if it
840
contains checked-out files.
841
 
842
The view removal may fail if there are any files B<open> within the view or if
843
any shell has a subdirectory of the view set as a B<current working directory>.
844
 
845
=item Locate VOB
846
 
847
Locate the VOB that contains the specified label or labels. If multiple labels
848
are specified they must all exist in the same VOB.
849
 
850
=item Lock Labels
851
 
852
Lock any unlocked labels, if required.
853
 
854
=item Create the view
855
 
856
Create a static view to containing the files describes by the Clearcase
857
label being processed.
858
 
859
The program uses a fixed view name. If this view exists then item
860
will be deleted before item is created again. Each build starts in a clean view.
861
 
862
=item Populate the View
863
 
864
Loads files into the static view. The user label and the VOB name are used to
865
created a clearcase configuration specification. This configuration
866
specification is then activated and all files within the specified VOB will be
867
loaded into the view if they match the user supplied label.
868
 
869
This processed normally results in a lot of error messages that can be ignored.
870
 
871
I<Note:> The label placed on the component to be built must extend to the
872
root of the VOB, otherwise the directory path will not be extracted nor will
873
the files within the component.
874
 
875
I<Note:> If the view is simply being extracted, then this is the end of the
876
program. The extracted view is left in place.
877
 
878
=item Sanity Test
879
 
880
If the build is being used as a release into dpkg_archive then
881
various tests are performed to ensure the repeatability of the view and the
882
build. These tests include:
883
 
884
=over 8
885
 
886
=item   *
887
 
888
The view must be constructed from one label
889
 
890
=item   *
891
 
892
That label must be locked
893
 
894
=item   *
895
 
896
The labelled view must contain exactly one build file
897
 
898
=item   *
899
 
900
The view cannot have been re-used.
901
 
902
=back
903
 
904
=item Locate build files
905
 
906
Locate the build file within the view.
907
 
908
It is an error to have multiple build files within the view, unless the
909
B<-build> option is used. By default, only one package will be built.
910
 
911
=item Package the results
912
 
913
Use JATS to build and make the package.
914
 
915
The resultant package may be copied to a numbers of locations. These include
916
 
917
=over 8
918
 
919
=item 1
920
 
921
The master dpkg_archive as an official release. This is the default operation.
922
 
923
=item 2
924
 
925
The users current directory. The package directory from the built package is
926
copied locally. The "pkg" directory is copied. This is only performed with the
927
B<-copy> option.
928
 
929
=back
930
 
931
=item Delete the view
932
 
933
Delete the view and all related files.
934
 
935
The view will not be deleted if an error was detected in the build process, or
936
the "reuse" or "keep" options are present.
937
 
938
=back
939
 
940
=cut
941