LCFG-Build-Tools
view release on metacpan or search on metacpan
lib/LCFG/Build/Tool/GenDeb.pm view on Meta::CPAN
my $tt = Template->new(
{
ABSOLUTE => 1,
}
) or die $Template::ERROR . "\n";
my $args = {
spec => $spec,
vcs => $vcs,
docs => \@docs,
is_component => $is_component,
comp_type => $comp_type,
looks_like_perl_lib => $looks_like_perl_lib,
has_nagios => $has_nagios,
};
for my $key (sort keys %templates) {
# Only need these files for components
if ( $key =~ m/^COMP/ && !$is_component ) {
next;
}
if ( $key =~ m/^COMP-nagios/ && ( !$is_component || !$has_nagios ) ) {
next;
}
my $tmpl = $templates{$key};
my $target = $key;
# Need to translate 'COMP' separately as otherwise it could
# potentially resolve to the wrong thing.
my $deb_name = $spec->deb_name;
$target =~ s/\bCOMP\b/$deb_name/g;
$target =~ s/\b((?:LCFG|DEB)_[A-Z]+)\b/
LCFG::Build::Utils::translate_macro($spec,$1)/gxe;
$self->log("Creating debian/$target metadata file");
my $tmpfile = File::Spec->catfile( $tmpdir, $target );
$tt->process( $tmpl, $args, $tmpfile )
or die $tt->error() . "\n";
if ( $key eq 'rules' ) {
chmod oct('0755'), $tmpfile;
}
}
my $debdir = File::Spec->catdir( $dir, 'debian' );
if ( !-d $debdir ) {
$self->log("Creating debian directory '$debdir'");
if ( !$self->dryrun ) {
rename $tmpdir, $debdir
or $self->fail("Failed to rename temporary directory: $!");
$vcs->run_cmd( 'add', $debdir );
my $rules_file = File::Spec->catfile( $debdir, 'rules' );
$vcs->run_cmd( 'propset', 'svn:executable', '1', $rules_file );
}
} else {
$self->log("Updating debian directory '$debdir'");
if ( !$self->dryrun ) {
File::Copy::Recursive::dircopy( $tmpdir, $debdir )
or $self->fail("Failed to update debian directory: $!");
}
}
$self->log("Please review the debian directory for this project");
return;
}
no Moose;
1;
__END__
=head1 NAME
LCFG::Build::Tool::GenDeb - Generate debian package metadata for project
=head1 VERSION
This documentation refers to LCFG::Build::Tool::GenDeb version 0.9.30
=head1 SYNOPSIS
my $tool = LCFG::Build::Tool::GenDeb->new( dir => '.' );
$tool->execute;
my $tool2 = LCFG::Build::Tool::GenDeb->new_with_options();
$tool2->execute;
=head1 DESCRIPTION
This module provides software release tools for the LCFG build
suite.
This module can be used to generate the necessary metadata for
building a simple Debian package for a project. The generated files
are not expected to be perfect but rather are intended to be a good
starting point which will require at least minor modification in most
cases.
More information on the LCFG build tools is available from the website
http://www.lcfg.org/doc/buildtools/
=head1 ATTRIBUTES
The following attributes are modifiable via the command-line (i.e. via
@ARGV) as well as the normal way when the Tool object is
created. Unless stated the options take strings as arguments and can
be used like C<--foo=bar>. Boolean options can be expressed as either
C<--foo> or C<--no-foo> to signify true and false values.
=over
( run in 0.631 second using v1.01-cache-2.11-cpan-71847e10f99 )