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