File Coverage

blib/lib/LCFG/Build/Tool/SRPM.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


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