Subversion Repositories DevTools

Rev

Rev 309 | Rev 353 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 309 Rev 341
Line 6... Line 6...
6
# Compiler(s)   : Perl
6
# Compiler(s)   : Perl
7
# Environment(s): jats
7
# Environment(s): jats
8
#
8
#
9
# Description   : Build Daemon Support Utility
9
# Description   : Build Daemon Support Utility
10
#                 This utility will:
10
#                 This utility will:
11
#                   +   Assume the CWD is the root-dir of a package
11
#                   +   Assume the CWD is where the build file is located
12
#                       within a versioned control view
12
#                   +   Within a version controlled view
13
#                   +   Determine a suitable label for the package
13
#                   +   Determine a suitable label for the package
14
#                   +   Save the build file in the view
14
#                   +   Save the build file in the view
15
#                   +   Label the resultant view
15
#                   +   Label the resultant view
16
#
16
#
17
# Usage:        : See POD at end of this file
17
# Usage:        : See POD at end of this file
Line 21... Line 21...
21
#                   -outfile    xxxdepends.xml/build.pl
21
#                   -outfile    xxxdepends.xml/build.pl
22
#                   -pname      package_name
22
#                   -pname      package_name
23
#                   -pversion   package_version
23
#                   -pversion   package_version
24
#                   -infofile   path_to_info_file
24
#                   -infofile   path_to_info_file
25
#                   -wiplabel   Existing WIP label (optional)
25
#                   -wiplabel   Existing WIP label (optional)
-
 
26
#                   -baselabel  View label
26
#
27
#
27
#......................................................................#
28
#......................................................................#
28
 
29
 
29
use strict;
30
use strict;
30
use warnings;
31
use warnings;
Line 50... Line 51...
50
my $opt_help = 0;
51
my $opt_help = 0;
51
my $opt_infofile;
52
my $opt_infofile;
52
my $opt_pname;
53
my $opt_pname;
53
my $opt_pversion;
54
my $opt_pversion;
54
my $opt_wiplabel;
55
my $opt_wiplabel;
55
my $opt_locate;
56
my $opt_baselabel;
56
 
57
 
57
#
58
#
58
#   Globals
59
#   Globals
59
#
60
#
60
my $root_dir;
61
my $root_dir;
Line 77... Line 78...
77
 
78
 
78
                "infofile=s"    => \$opt_infofile,          # string
79
                "infofile=s"    => \$opt_infofile,          # string
79
                "pname=s"       => \$opt_pname,             # string
80
                "pname=s"       => \$opt_pname,             # string
80
                "pversion=s"    => \$opt_pversion,          # string
81
                "pversion=s"    => \$opt_pversion,          # string
81
                "wiplabel=s"    => \$opt_wiplabel,          # string
82
                "wiplabel=s"    => \$opt_wiplabel,          # string
82
                "locatepkg=s"   => \$opt_locate,            # string
83
                "baselabel=s"   => \$opt_baselabel,         # string
83
 
84
 
84
                #
85
                #
85
                #   Update documentation at the end of the file
86
                #   Update documentation at the end of the file
86
                #
87
                #
87
                );
88
                );
Line 101... Line 102...
101
           );
102
           );
102
 
103
 
103
Error ("Input and output file are the same: $opt_infile" )
104
Error ("Input and output file are the same: $opt_infile" )
104
    if ( $opt_infile eq $opt_ofile );
105
    if ( $opt_infile eq $opt_ofile );
105
 
106
 
-
 
107
Error ("Base Label not provided")
-
 
108
    unless ( $opt_baselabel );
-
 
109
    
106
Error ("Package Name not provided")
110
Error ("Package Name not provided")
107
    unless ( $opt_pname );
111
    unless ( $opt_pname );
108
 
112
 
109
Error ("Package Version not provided")
113
Error ("Package Version not provided")
110
    unless ( $opt_pversion );
114
    unless ( $opt_pversion );
Line 113... Line 117...
113
    unless ( $opt_infofile );
117
    unless ( $opt_infofile );
114
 
118
 
115
unlink ($opt_infofile) if $opt_infofile;
119
unlink ($opt_infofile) if $opt_infofile;
116
 
120
 
117
#
121
#
118
#   Locate the build directory and chdir to that directory
-
 
119
#
-
 
120
locate_build_directory();
-
 
121
 
-
 
122
#
-
 
123
#   Have changed to the directory with build files
122
#   User must have changed to the directory with build files
124
#   Continue with user argument sanity check
123
#   Continue with user argument sanity check
125
#
124
#
126
Error ("Input file not found: $opt_infile" )
125
Error ("Input file not found: $opt_infile" )
127
    unless ( -f $opt_infile );
126
    unless ( -f $opt_infile );
128
 
127
 
Line 175... Line 174...
175
label_build_view();
174
label_build_view();
176
 
175
 
177
exit 0;
176
exit 0;
178
 
177
 
179
#-------------------------------------------------------------------------------
178
#-------------------------------------------------------------------------------
180
# Function        : locate_build_directory
-
 
181
#
-
 
182
# Description     : Locate the build directory that contains the build files
-
 
183
#                   In an ANT build, this will e the root of the package
-
 
184
#                   Otherwise the build files may not be in the root directory
-
 
185
#
-
 
186
#
-
 
187
# Inputs          : Globals
-
 
188
#
-
 
189
# Returns         : Globals
-
 
190
#
-
 
191
sub locate_build_directory
-
 
192
{
-
 
193
    return unless ( $opt_locate );
-
 
194
 
-
 
195
    my $bscanner = BuildFileScanner ( '.', $opt_infile );
-
 
196
    my $count = $bscanner->locate();
-
 
197
 
-
 
198
    Error ("Autolocate. Build file not found: $opt_infile" )
-
 
199
        if ( $count <= 0 );
-
 
200
 
-
 
201
    #
-
 
202
    #   If multiple build files have been found
-
 
203
    #   Scan the buildfiles and determine the names of the packages that will
-
 
204
    #   be built. This can be used to generate nice error messages
-
 
205
    if ( $count > 1 )
-
 
206
    {
-
 
207
        $bscanner->scan();
-
 
208
        $count = $bscanner->match( $opt_locate );
-
 
209
 
-
 
210
        my $errmess;
-
 
211
        if ( $count <= 0 ) {
-
 
212
            $errmess = "None found that build package: $opt_locate";
-
 
213
 
-
 
214
        } elsif ( $count > 1 ) {
-
 
215
            $errmess = "Multiple build files build the required package: $opt_locate";
-
 
216
        }
-
 
217
 
-
 
218
        #
-
 
219
        #   Pretty error display
-
 
220
        #   Display build directory and the package name (mangled)
-
 
221
        #
-
 
222
        if ( $errmess )
-
 
223
        {
-
 
224
            Error ("Autolocate. Multiple build files found.",
-
 
225
                   $errmess,
-
 
226
                   "Build files found in:", $bscanner->formatData() );
-
 
227
        }
-
 
228
    }
-
 
229
 
-
 
230
    #
-
 
231
    #   Extract the required build file directory
-
 
232
    #
-
 
233
    my $dir = $bscanner->getMatchDir() || '';
-
 
234
    Verbose ("Autolocate. Found $count build files: $dir");
-
 
235
 
-
 
236
    #
-
 
237
    #   Select the one true build directory
-
 
238
    #
-
 
239
    if ( $dir ne '.' )
-
 
240
    {
-
 
241
        #
-
 
242
        #   Save the current directory for later
-
 
243
        #
-
 
244
        $root_dir = getcwd();
-
 
245
        chdir $dir || Error ("Cannot change directory: $dir");
-
 
246
    }
-
 
247
}
-
 
248
 
-
 
249
#-------------------------------------------------------------------------------
-
 
250
# Function        : determine_package_label
179
# Function        : determine_package_label
251
#
180
#
252
# Description     : Determine the label that is to be applied to the package
181
# Description     : Determine the label that is to be applied to the package
253
#                   There are several cases to consider
182
#                   There are several cases to consider
254
#                       1) Compatability mode: User provides label
183
#                       1) Compatability mode: User provides label
Line 383... Line 312...
383
        $data->setProperty('Label', $tag_label);
312
        $data->setProperty('Label', $tag_label);
384
        $data->setProperty('WipLabel', $opt_wiplabel ) if $opt_wiplabel;
313
        $data->setProperty('WipLabel', $opt_wiplabel ) if $opt_wiplabel;
385
        $data->setProperty('PackageName', $opt_pname);
314
        $data->setProperty('PackageName', $opt_pname);
386
        $data->setProperty('PackageVersion', $opt_pversion);
315
        $data->setProperty('PackageVersion', $opt_pversion);
387
        $data->setProperty('subversion.tag', $session->RmRef);
316
        $data->setProperty('subversion.tag', $session->RmRef);
-
 
317
        $data->setProperty('VCS.tag', 'SVN::' . $session->RmRef);
388
 
318
 
389
        $data->Dump('InfoFile') if ($opt_verbose);
319
        $data->Dump('InfoFile') if ($opt_verbose);
390
        $data->store( $opt_infofile );
320
        $data->store( $opt_infofile );
391
    }
321
    }
392
}
322
}
Line 413... Line 343...
413
    -infile=xxx         - Input file (auto.pl)
343
    -infile=xxx         - Input file (auto.pl)
414
    -outfile=xxx        - Output file (build.pl)
344
    -outfile=xxx        - Output file (build.pl)
415
    -infofile=path      - Save label information in 'path'
345
    -infofile=path      - Save label information in 'path'
416
    -pname=name         - Name of the package
346
    -pname=name         - Name of the package
417
    -pversion=text      - Package version
347
    -pversion=text      - Package version
418
    -locatepkg=text     - Package locator string
-
 
419
    -wiplabel=text      - Current package WIP label
348
    -wiplabel=text      - Current package WIP label
-
 
349
    -baselabel=text     - Base label for sandbox
420
 
350
 
421
=head1 OPTIONS
351
=head1 OPTIONS
422
 
352
 
423
=over 8
353
=over 8
424
 
354
 
Line 475... Line 405...
475
=item B<-pversion=xxx>
405
=item B<-pversion=xxx>
476
 
406
 
477
This option specifies the package version. It will be used to construct a new
407
This option specifies the package version. It will be used to construct a new
478
label for the package.
408
label for the package.
479
 
409
 
480
=item B<-locatepkg=text>
-
 
481
 
-
 
482
This option specifies a name, by which the package's build files may be located.
-
 
483
This is only needed for JATS builds and will only be used to resolve the
-
 
484
location of build files when a package contains multiple build files.
-
 
485
 
-
 
486
=item B<-wiplabel=text>
410
=item B<-wiplabel=text>
487
 
411
 
488
This option controls the manner in which this utility will label the build view.
412
This option controls the manner in which this utility will label the build view.
489
 
413
 
490
If present, the label specifies a 'Work In Progress' label. The label will be
414
If present, the label specifies a 'Work In Progress' label. The label will be
491
renamed. At the end of the process the wip label will be deleted from the
415
renamed. At the end of the process the wip label will be deleted from the
492
the repository.
416
the repository.
493
 
417
 
494
If not present, then the view will be labeled with a new label.
418
If not present, then the view will be labeled with a new label.
495
 
419
 
-
 
420
=item B<-baselabel=text>
-
 
421
 
-
 
422
This option specifies the Version Control Label that the current workspace
-
 
423
is based on. This may be used to determine the new label for the package.
-
 
424
 
-
 
425
This parameter is mandatory.
-
 
426
 
496
=back
427
=back
497
 
428
 
498
=head1 DESCRIPTION
429
=head1 DESCRIPTION
499
 
430
 
500
This utility is used by the automated build system to place build view under
431
This utility is used by the automated build system to place build view under