Subversion Repositories DevTools

Rev

Rev 6177 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6177 Rev 6619
Line 43... Line 43...
43
my $opt_verbose = 0;
43
my $opt_verbose = 0;
44
my $opt_rtagid;
44
my $opt_rtagid;
45
my $opt_show;
45
my $opt_show;
46
my $opt_outfile;
46
my $opt_outfile;
47
my $opt_keep;
47
my $opt_keep;
-
 
48
my $opt_zero;
48
 
49
 
49
my $result = GetOptions (
50
my $result = GetOptions (
50
                "help|h:+"          => \$opt_help,
51
                "help|h:+"          => \$opt_help,
51
                "manual:3"          => \$opt_help,
52
                "manual:3"          => \$opt_help,
52
                "verbose:+"         => \$opt_verbose,       # flag or number
53
                "verbose:+"         => \$opt_verbose,
53
                "rtagid|rtag_id=s"  => \$opt_rtagid,
54
                "rtagid|rtag_id=s"  => \$opt_rtagid,
54
                "out=s"             => \$opt_outfile,
55
                "out=s"             => \$opt_outfile,
55
                'show:s'            => \$opt_show,
56
                'show:s'            => \$opt_show,
56
                'keep'              => \$opt_keep,
57
                'keep'              => \$opt_keep,
-
 
58
                'zero!'             => \$opt_zero,
57
                );
59
                );
58
 
60
 
59
#
61
#
60
#   Process help and manual options
62
#   Process help and manual options
61
#
63
#
Line 83... Line 85...
83
    }
85
    }
84
}
86
}
85
 
87
 
86
 
88
 
87
Error( "No operation specified" )
89
Error( "No operation specified" )
88
    unless ( $opt_rtagid || defined  $opt_show );
90
    unless ( $opt_rtagid || defined  $opt_show || $opt_zero );
89
 
91
 
90
#
92
#
91
#   Intelligently select output file
93
#   Intelligently select output file
92
#       Use auto.pl if it exists
94
#       Use auto.pl if it exists
93
#       use build.pl if auto.??? does not exist and its writable
95
#       use build.pl if auto.??? does not exist and its writable
Line 101... Line 103...
101
    } else {
103
    } else {
102
        $opt_outfile = 'auto.pl';
104
        $opt_outfile = 'auto.pl';
103
    }
105
    }
104
}
106
}
105
 
107
 
-
 
108
my $file;
-
 
109
if ($opt_rtagid) {
106
#
110
    #
107
#   Connect to the RM database
111
    #   Connect to the RM database
108
#       Uses infor from the JATS environment
112
    #       Uses infor from the JATS environment
109
#           GBE_RM_LOCATION
113
    #           GBE_RM_LOCATION
110
#           GBE_RM_USERNAME
114
    #           GBE_RM_USERNAME
111
#           GBE_RM_PASSWORD
115
    #           GBE_RM_PASSWORD
112
#
116
    #
113
connectRM(\$RM_DB);
117
    connectRM(\$RM_DB);
114
 
118
 
115
#
119
    #
116
#   Display all the Release Tags in the data base
120
    #   Display all the Release Tags in the data base
117
#
121
    #
118
if ( defined $opt_show )
122
    if ( defined $opt_show )
119
{
123
    {
120
    show_rtags();
124
        show_rtags();
121
    exit (0);
125
        exit (0);
122
}
126
    }
123
 
-
 
124
#
-
 
125
#   Ensure that the RTAG exists
-
 
126
#   Extract the Release and Project Name
-
 
127
#
-
 
128
GetReleaseData( $opt_rtagid );
-
 
129
Error ("Rtag not found in Release Manager Database: $opt_rtagid") unless ( $ProjectName );
-
 
130
Message ("Project Name: $ProjectName");
-
 
131
Message ("Release Name: $ReleaseName");
-
 
132
#
-
 
133
#   Get all package info the specified release
-
 
134
#   This is done as one query so it should be fast
-
 
135
#
-
 
136
getPkgDetailsByRTAG_ID( $opt_rtagid );
-
 
137
 
127
 
-
 
128
    #
-
 
129
    #   Ensure that the RTAG exists
-
 
130
    #   Extract the Release and Project Name
-
 
131
    #
-
 
132
    GetReleaseData( $opt_rtagid );
-
 
133
    Error ("Rtag not found in Release Manager Database: $opt_rtagid") unless ( $ProjectName );
-
 
134
    Message ("Project Name: $ProjectName");
-
 
135
    Message ("Release Name: $ReleaseName");
-
 
136
    #
-
 
137
    #   Get all package info the specified release
-
 
138
    #   This is done as one query so it should be fast
-
 
139
    #
-
 
140
    getPkgDetailsByRTAG_ID( $opt_rtagid );
138
#
141
 
-
 
142
    #
139
#   Create a configuration file for use by the JATS rewrite tool
143
    #   Create a configuration file for use by the JATS rewrite tool
140
#   This will allow the build.pl file to be re-written
144
    #   This will allow the build.pl file to be re-written
141
#
145
    #
142
my $file = "jats_rewrite.cfg";
146
    $file = "jats_rewrite.cfg";
143
open CFG, ">$file" || Error("Cannot create $file", $! );
147
    open CFG, ">$file" || Error("Cannot create $file", $! );
144
print CFG "releasemanager.projectname = $ProjectName\n";
148
    print CFG "releasemanager.projectname = $ProjectName\n";
145
print CFG "releasemanager.releasename = $ReleaseName\n";
149
    print CFG "releasemanager.releasename = $ReleaseName\n";
146
 
150
 
147
foreach my $pkg ( sort keys %ReleasePackages )
151
    foreach my $pkg ( sort keys %ReleasePackages )
148
{
-
 
149
    my $ver;
-
 
150
    foreach my $prj ( sort keys %{$ReleasePackages{$pkg}} )
-
 
151
    {
152
    {
-
 
153
        my $ver;
-
 
154
        foreach my $prj ( sort keys %{$ReleasePackages{$pkg}} )
-
 
155
        {
152
        $ver  = $ReleasePackages{$pkg}{$prj};
156
            $ver  = $ReleasePackages{$pkg}{$prj};
153
        $ver .= '.' . ${prj} if ( $prj );
157
            $ver .= '.' . ${prj} if ( $prj );
154
        print CFG "${pkg} ${ver}\n";
158
            print CFG "${pkg} ${ver}\n";
-
 
159
        }
155
    }
160
    }
-
 
161
    close CFG;
156
}
162
}
157
close CFG;
-
 
158
 
163
 
159
#
164
#
160
#   Massage the build.pl file to create the auto.pl file
165
#   Massage the build.pl file to create the auto.pl file
161
#   That will be used to create the final package.
166
#   That will be used to create the final package.
162
#
167
#
163
$result = JatsTool ("jats_rewrite.pl", '-conf', $file,
168
$result = JatsTool ("jats_rewrite.pl", 
-
 
169
                             defined ($file) ? ('-conf', $file) : '',
164
                             '-verb', $opt_verbose,
170
                             '-verb', $opt_verbose,
165
                             '-outfile', $opt_outfile,
171
                             '-outfile', $opt_outfile,
166
                             '-mode=1' );
172
                             '-mode=1',
-
 
173
                             defined($opt_zero) ? '-zero' : ''
-
 
174
                              );
167
unlink $file unless $opt_keep;
175
if ( $file && !$opt_keep){
-
 
176
    unlink $file
-
 
177
}
168
Error("Did not rewrite build.pl file") if ( $result );
178
Error("Did not rewrite build.pl file") if ( $result );
169
exit 0;
179
exit 0;
170
 
180
 
171
#-------------------------------------------------------------------------------
181
#-------------------------------------------------------------------------------
172
# Function        : GetReleaseData
182
# Function        : GetReleaseData
Line 343... Line 353...
343
    -verbose            - Verbose operation
353
    -verbose            - Verbose operation
344
    -show[=text]        - Show all Release Tags, that match text
354
    -show[=text]        - Show all Release Tags, that match text
345
    -rtag=nnn           - Release Tag
355
    -rtag=nnn           - Release Tag
346
    -out=file           - Output filename [auto.pl]
356
    -out=file           - Output filename [auto.pl]
347
    -keep               - Keep the generated dependency files
357
    -keep               - Keep the generated dependency files
-
 
358
    -zero               - Zero version numbers
348
 
359
 
349
=head1 OPTIONS
360
=head1 OPTIONS
350
 
361
 
351
=over 8
362
=over 8
352
 
363
 
Line 393... Line 404...
393
 
404
 
394
=item B<-keep>
405
=item B<-keep>
395
 
406
 
396
This option will prevent the utility from deleting the generated dependency file.
407
This option will prevent the utility from deleting the generated dependency file.
397
 
408
 
-
 
409
=item B<-zero>
-
 
410
 
-
 
411
This option will update version numbers to 0.0.0000. It will still provide sanity 
-
 
412
testing of the package dependencies against the Release Manager entry is provided.
-
 
413
 
398
=back
414
=back
399
 
415
 
400
=head1 DESCRIPTION
416
=head1 DESCRIPTION
401
 
417
 
402
This utilty will update the dependency information within a build file to
418
This utilty will update the dependency information within a build file to
Line 451... Line 467...
451
The following command will update the build.pl file in the current directory so
467
The following command will update the build.pl file in the current directory so
452
that the dependecies match those from the Release with an rtag_id of 25423.
468
that the dependecies match those from the Release with an rtag_id of 25423.
453
 
469
 
454
    jats upddep -rtag_id=25423
470
    jats upddep -rtag_id=25423
455
 
471
 
-
 
472
The following command will zero the version numbers
-
 
473
 
-
 
474
    jats upddep -zero
-
 
475
 
-
 
476
 
456
=cut
477
=cut
457
 
478