line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LCFG::Build::Tool::DevRPM; # -*-cperl-*- |
2
|
1
|
|
|
1
|
|
1941
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
40
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# $Id: DevRPM.pm.in 15905 2011-02-17 17:01:27Z squinney@INF.ED.AC.UK $ |
6
|
|
|
|
|
|
|
# $Source: /var/cvs/dice/LCFG-Build-Tools/lib/LCFG/Build/Tool/DevRPM.pm.in,v $ |
7
|
|
|
|
|
|
|
# $Revision: 15905 $ |
8
|
|
|
|
|
|
|
# $HeadURL: https://svn.lcfg.org/svn/source/tags/LCFG-Build-Tools/LCFG_Build_Tools_0_4_0/lib/LCFG/Build/Tool/DevRPM.pm.in $ |
9
|
|
|
|
|
|
|
# $Date: 2011-02-17 17:01:27 +0000 (Thu, 17 Feb 2011) $ |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.4.0'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
6
|
use LCFG::Build::Utils::RPM; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
14
|
1
|
|
|
1
|
|
19
|
use File::Basename (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
13
|
|
15
|
1
|
|
|
1
|
|
5
|
use File::Copy (); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
16
|
1
|
|
|
1
|
|
5
|
use File::Spec (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
500
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
extends 'LCFG::Build::Tool::DevPack'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'sourceonly' => ( |
23
|
|
|
|
|
|
|
is => 'rw', |
24
|
|
|
|
|
|
|
isa => 'Bool', |
25
|
|
|
|
|
|
|
default => 0, |
26
|
|
|
|
|
|
|
documentation => 'Only build source package', |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has 'deps' => ( |
30
|
|
|
|
|
|
|
is => 'rw', |
31
|
|
|
|
|
|
|
isa => 'Bool', |
32
|
|
|
|
|
|
|
default => 1, |
33
|
|
|
|
|
|
|
documentation => 'Build dependency checking', |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'sign' => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
isa => 'Bool', |
39
|
|
|
|
|
|
|
default => 0, |
40
|
|
|
|
|
|
|
documentation => 'Embed a GPG signature in the package', |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
override 'abstract' => sub { |
44
|
|
|
|
|
|
|
return q{Build binary RPMS from the development source tree}; |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
override 'execute' => sub { |
48
|
|
|
|
|
|
|
my ($self) = @_; |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
super; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
my %opts; |
53
|
|
|
|
|
|
|
if ( !$self->deps ) { |
54
|
|
|
|
|
|
|
$opts{nodeps} = 1; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
if ( $self->sourceonly ) { |
57
|
|
|
|
|
|
|
$opts{sourceonly} = 1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
if ( $self->sign ) { |
60
|
|
|
|
|
|
|
$opts{sign} = 1; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
my $spec = $self->spec; |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
my $module = $spec->fullname; |
66
|
|
|
|
|
|
|
my $version = $spec->version; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
my $dirname = join q{-}, $module, $version; |
69
|
|
|
|
|
|
|
my $outdir = File::Spec->catdir( $self->resultsdir, $dirname ); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# For 'devel' packages it can be useful to keep the build |
72
|
|
|
|
|
|
|
# directory to make it easier to inspect the build products. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
$opts{builddir} = $outdir; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
my $tarname = $spec->tarname; |
77
|
|
|
|
|
|
|
my $tarfile = File::Spec->catfile( $outdir, $tarname ); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
my $packname = join q{-}, $spec->fullname, $spec->version; |
80
|
|
|
|
|
|
|
my $specname = $packname . '.spec'; |
81
|
|
|
|
|
|
|
my $specfile = File::Spec->catfile( $outdir, $specname ); |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
my $result = LCFG::Build::Utils::RPM->build( $outdir, $specfile, \%opts ); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
$self->log("Successfully built source package for $module"); |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
my $source_path = $result->{source}; |
88
|
|
|
|
|
|
|
$self->log("Source: $source_path"); |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
if ( !$self->sourceonly ) { |
91
|
|
|
|
|
|
|
$self->log("Successfully built packages for $module"); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
for my $package ( @{ $result->{packages} } ) { |
94
|
|
|
|
|
|
|
$self->log("Package: $package"); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
return; |
99
|
|
|
|
|
|
|
}; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
no Moose; |
104
|
|
|
|
|
|
|
1; |
105
|
|
|
|
|
|
|
__END__ |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 NAME |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
LCFG::Build::Tool::DevRPM - LCFG software packaging tool |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 VERSION |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This documentation refers to LCFG::Build::Tool::DevRPM version 0.4.0 |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 SYNOPSIS |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
my $tool = LCFG::Build::Tool::DevRPM->new( dir => '.' ); |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
$tool->execute; |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
my $tool2 = LCFG::Build::Tool::DevRPM->new_with_options(); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$tool2->execute; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=head1 DESCRIPTION |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
This module provides software release tools for the LCFG build |
128
|
|
|
|
|
|
|
suite. |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
This is a tool to take a development tree (working copy) of the source |
131
|
|
|
|
|
|
|
for a project managed with the LCFG build tools and package it into a |
132
|
|
|
|
|
|
|
gzipped source tar file. Build metadata files for supported platforms |
133
|
|
|
|
|
|
|
(e.g. a specfile for building binary RPMs) are also generated at the |
134
|
|
|
|
|
|
|
same time. It is also possible to do limited autoconf-style macro |
135
|
|
|
|
|
|
|
substitution prior to the source being packaged. This allows the |
136
|
|
|
|
|
|
|
generation of 'pristine' tar files where downstream users will be |
137
|
|
|
|
|
|
|
unaware of the additional source-file processing that has been carried |
138
|
|
|
|
|
|
|
out prior to distribution. Binary RPM packages will then be generated |
139
|
|
|
|
|
|
|
from the gzipped source tar file using the generated specfile. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
More information on the LCFG build tools is available from the website |
142
|
|
|
|
|
|
|
http://www.lcfg.org/doc/buildtools/ |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The following attributes are modifiable via the command-line (i.e. via |
147
|
|
|
|
|
|
|
@ARGV) as well as the normal way when the Tool object is |
148
|
|
|
|
|
|
|
created. Unless stated the options take strings as arguments and can |
149
|
|
|
|
|
|
|
be used like C<--foo=bar>. Boolean options can be expressed as either |
150
|
|
|
|
|
|
|
C<--foo> or C<--no-foo> to signify true and false values. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=over 4 |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=item dryrun |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
A boolean value which indicates whether actions which permanently |
157
|
|
|
|
|
|
|
alter the contents of files should be carried out. The default value |
158
|
|
|
|
|
|
|
is false (0). When running in dry-run mode various you will typically |
159
|
|
|
|
|
|
|
get extra output to the screen showing what would have been done. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item quiet |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
A boolean value which indicates whether the actions should attempt to |
164
|
|
|
|
|
|
|
be quieter. The default value is false (0). |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=item dir |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
The path of the project directory which contains the software for |
169
|
|
|
|
|
|
|
which you want to create a release. If this is not specified then a |
170
|
|
|
|
|
|
|
default value of the current directory (.) will be used. This |
171
|
|
|
|
|
|
|
directory must already contain the LCFG build metadata file (lcfg.yml) |
172
|
|
|
|
|
|
|
for the software. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=item resultsdir |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
When a project is packaged for release the generated products (the |
177
|
|
|
|
|
|
|
gzipped source tar file, various build metadata files and possibly |
178
|
|
|
|
|
|
|
binary RPMS, etc) are stored into a directory named after the |
179
|
|
|
|
|
|
|
combination of the full name of the project and the version |
180
|
|
|
|
|
|
|
number. For example, a project named 'foo' with version '1.2.3' would |
181
|
|
|
|
|
|
|
have an output directory of 'foo-1.2.3'. You should note that if the |
182
|
|
|
|
|
|
|
C<base> attribute is specified in the metadata file (this is the case |
183
|
|
|
|
|
|
|
for LCFG components) then that is also used. If the previous example |
184
|
|
|
|
|
|
|
was an LCFG component it would have a directory named |
185
|
|
|
|
|
|
|
'lcfg-foo-1.2.3'. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
This attribute controls the parent directory into which that generated |
188
|
|
|
|
|
|
|
directory will be placed. The default on a Unix system is |
189
|
|
|
|
|
|
|
C<$HOME/lcfgbuild/> which will be created if it does not already |
190
|
|
|
|
|
|
|
exist. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item gencmake |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This is a boolean value which controls whether CMake build files will |
195
|
|
|
|
|
|
|
be created when the source code for the project is packaged. The |
196
|
|
|
|
|
|
|
default is to take the setting from C<gencmake> option in the |
197
|
|
|
|
|
|
|
C<buildinfo> section of the LCFG build metadata file. |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item translate |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
This is a boolean value which controls whether source files will be |
202
|
|
|
|
|
|
|
translated BEFORE they are packaged. The default is to take the |
203
|
|
|
|
|
|
|
setting from C<translate_before_pack> option in the C<buildinfo> |
204
|
|
|
|
|
|
|
section of the LCFG build metadata file. |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item remove_after_translate |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This is a boolean value which controls whether input files will be |
209
|
|
|
|
|
|
|
removed after they have been translated. They are only removed if the |
210
|
|
|
|
|
|
|
input and output filenames do not match (e.g. foo.cin becomes |
211
|
|
|
|
|
|
|
foo). The default is to take the setting from |
212
|
|
|
|
|
|
|
C<remove_input_after_translate> option in the C<buildinfo> section of |
213
|
|
|
|
|
|
|
the LCFG build metadata file. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=item sourceonly |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
This is a boolean value which controls whether the binary packages |
218
|
|
|
|
|
|
|
should be built as well as the source RPM. |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item sign |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
This is a boolean value which controls whether C<rpmbuild> should |
223
|
|
|
|
|
|
|
embed a GPG signature in the package. |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=item deps |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This is a boolean value which controls whether C<rpmbuild> checks the |
228
|
|
|
|
|
|
|
dependencies specified in the RPM specfile when it builds the source |
229
|
|
|
|
|
|
|
or binary RPMs. |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
=back |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
The following methods are not modifiable by the command-line, they are |
234
|
|
|
|
|
|
|
however directly modifiable via the Tool object if |
235
|
|
|
|
|
|
|
necessary. Typically you will only need to query these attributes, |
236
|
|
|
|
|
|
|
they are automatically created when you need them using values for |
237
|
|
|
|
|
|
|
some of the other command-line attributes. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
=over 4 |
240
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
=item spec |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
This is a reference to the current project metadata object, see |
244
|
|
|
|
|
|
|
L<LCFG::Build::PkgSpec> for full details. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=item vcs |
247
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
This is a reference to the current version-control object, see |
249
|
|
|
|
|
|
|
L<LCFG::Build::VCS> for full details. |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=back |
252
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
254
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=over 4 |
256
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
=item execute |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
This method first calls the execute() method in |
260
|
|
|
|
|
|
|
L<LCFG::Build::Tool::DevPack> to generate a gzipped source tar file |
261
|
|
|
|
|
|
|
and the build metadata files for the various supported platforms |
262
|
|
|
|
|
|
|
(e.g. a specfile for creating binary RPMs). Once that is done |
263
|
|
|
|
|
|
|
C<rpmbuild> is used to create binary RPMs from the generated source |
264
|
|
|
|
|
|
|
tar file and specfile. |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
=item fail($message) |
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
Immediately fails (i.e. dies) and displays the message. |
269
|
|
|
|
|
|
|
|
270
|
|
|
|
|
|
|
=item log($message) |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
Logs the message to the screen if the C<quiet> attribute has not been |
273
|
|
|
|
|
|
|
specified. A message string is prefixed with 'LCFG: ' to help visually |
274
|
|
|
|
|
|
|
separate it from other output. |
275
|
|
|
|
|
|
|
|
276
|
|
|
|
|
|
|
=back |
277
|
|
|
|
|
|
|
|
278
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
279
|
|
|
|
|
|
|
|
280
|
|
|
|
|
|
|
This module is L<Moose> powered and uses L<MooseX::App::Cmd> to handle |
281
|
|
|
|
|
|
|
command-line options. |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
The following modules from the LCFG build tools suite are also |
284
|
|
|
|
|
|
|
required: L<LCFG::Build::Tool::DevPack>, L<LCFG::Build::PkgSpec>, |
285
|
|
|
|
|
|
|
L<LCFG::Build::VCS> and VCS helper module for your preferred |
286
|
|
|
|
|
|
|
version-control system. |
287
|
|
|
|
|
|
|
|
288
|
|
|
|
|
|
|
For building RPMs you will also need L<LCFG::Build::Utils::RPM>. |
289
|
|
|
|
|
|
|
|
290
|
|
|
|
|
|
|
=head1 SEE ALSO |
291
|
|
|
|
|
|
|
|
292
|
|
|
|
|
|
|
L<LCFG::Build::Tools>, L<LCFG::Build::Skeleton>, lcfg-reltool(1) |
293
|
|
|
|
|
|
|
|
294
|
|
|
|
|
|
|
=head1 PLATFORMS |
295
|
|
|
|
|
|
|
|
296
|
|
|
|
|
|
|
This is the list of platforms on which we have tested this |
297
|
|
|
|
|
|
|
software. We expect this software to work on any Unix-like platform |
298
|
|
|
|
|
|
|
which is supported by Perl. |
299
|
|
|
|
|
|
|
|
300
|
|
|
|
|
|
|
Fedora12, Fedora13, ScientificLinux5, ScientificLinux6, MacOSX7 |
301
|
|
|
|
|
|
|
|
302
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
303
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
There are no known bugs in this application. Please report any |
305
|
|
|
|
|
|
|
problems to bugs@lcfg.org, feedback and patches are also always very |
306
|
|
|
|
|
|
|
welcome. |
307
|
|
|
|
|
|
|
|
308
|
|
|
|
|
|
|
=head1 AUTHOR |
309
|
|
|
|
|
|
|
|
310
|
|
|
|
|
|
|
Stephen Quinney <squinney@inf.ed.ac.uk> |
311
|
|
|
|
|
|
|
|
312
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
Copyright (C) 2008 University of Edinburgh. All rights reserved. |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
317
|
|
|
|
|
|
|
it under the terms of the GPL, version 2 or later. |
318
|
|
|
|
|
|
|
|
319
|
|
|
|
|
|
|
=cut |