Arepa
view release on metacpan or search on metacpan
lib/Arepa/Builder.pm view on Meta::CPAN
sub uninit {
my ($self, $builder) = @_;
$self->do_uninit($builder);
}
sub do_compile_package_from_dsc {
my ($self, $dsc_file, %user_opts) = @_;
croak "Not implemented";
}
sub compile_package_from_dsc {
my ($self, $dsc_file, %user_opts) = @_;
$self->do_compile_package_from_dsc($dsc_file, %user_opts);
}
sub do_compile_package_from_repository {
my ($self, $pkg_name, $pkg_version, %user_opts) = @_;
croak "Not implemented";
}
sub compile_package_from_repository {
my ($self, $pkg_name, $pkg_version, %user_opts) = @_;
$self->do_compile_package_from_repository($pkg_name,
$pkg_version,
%user_opts);
}
sub do_create {
my ($self, $builder_dir, $mirror, $distribution, %opts) = @_;
croak "Not implemented";
}
sub create {
my ($self, $builder_dir, $mirror, $distribution, %user_opts) = @_;
my %opts = (builder_config_dir => '/etc/arepa/builders',
arch => `dpkg-architecture -qDEB_BUILD_ARCH`,
%user_opts);
chomp($opts{arch});
$self->do_create($builder_dir, $mirror, $distribution, %opts);
$self->ui_module->print_title("Configuration for config.yml");
my $type = $self->type;
my $config_string = <<EOD;
type: $type
architecture: $opts{arch}
# Compile "Architecture: all" packages with this builder?
architecture_all: 0
# This is the distribution the packages compiled by this builder go to. For a
# package to be compiled by this builder, it has to have the correct
# architecture and this distribution (or an alias or similar, see below) in
# its *.changes file.
distribution: $distribution
# Other names for this distribution (if the distribution name is
# mycompany-squeeze, you might want 'squeeze' and 'testing' as aliases)
distribution_aliases: []
# Recompile packages (binNMU or Binary-only Non-Maintainer Upload; see
# http://www.debian.org/doc/developers-reference/pkgs.html#nmu-binnmu)
# originally uploaded for other distributions in this builder. This option is
# an easy way to get "for free" packages compiled for several distributions.
# Typical values for this list would be 'unstable' or 'lenny'
bin_nmu_for: []
EOD
my $builder_name = basename($builder_dir);
my $path = File::Spec->catfile($opts{builder_config_dir},
"$builder_name.yml");
open F, ">$path" or croak "Can't write builder configuration in $path";
print F $config_string;
close F;
my $sources_list_path = File::Spec->catfile($builder_dir, "etc", "apt",
"sources.list");
$self->ui_module->print_title("Done");
print <<EOM
Next steps
----------
* Tweak the builder configuration in $path
* Review $sources_list_path
* Add all relevant repository keys to the builder (eg. "apt-key add ...")
EOM
}
1;
__END__
=head1 NAME
Arepa::Builder - Arepa builder base "class"
=head1 SYNOPSIS
my $module = Arepa::Builder->ui_module;
Arepa::Builder->ui_module($new_ui_module);
Arepa::Builder->init($builder_name);
Arepa::Builder->compile_package_from_dsc($builder_name, $dsc_file);
Arepa::Builder->compile_package_from_dsc($builder_name, $dsc_file,
output_dir => 1);
Arepa::Builder->compile_package_from_repository($builder_name,
$dsc_file);
Arepa::Builder->compile_package_from_repository($builder_name,
$dsc_file,
output_dir => 1,
bin_nmu => 1);
my $log = Arepa::Builder->last_build_log;
Arepa::Builder->create($builder_dir, $mirror, $distribution);
=head1 DESCRIPTION
This module contains the interface for an Arepa builder. It should be the
"subclass" for any builder module. Every Arepa builder type must have a module
( run in 0.617 second using v1.01-cache-2.11-cpan-b16cb0d3907 )