package VineLinux::VSS::Type::SelfBuild;

use base qw( VineLinux::VSS::Type );

use VineLinux::VSS::Skeleton::SelfBuild::SelfBuildSpec;
use VineLinux::VSS::Skeleton::SelfBuild::Spec;

sub generate {
    my $class = shift;
    my $vss = shift;

    my $filename = '';
    my @skeleton_data;
    my $tmpl;

    my $params = $class->_set_params($vss);

    # self-build-<package>-vl.spec
    @skeleton_data = <VineLinux::VSS::Skeleton::SelfBuild::SelfBuildSpec::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
                                die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = 'self-build-' . $vss->package_name . '-vl.spec';
    $class->_generate_file($filename, $tmpl->output);

    # <package>-vl.spec
    @skeleton_data = <VineLinux::VSS::Skeleton::SelfBuild::Spec::DATA>;
    $tmpl = HTML::Template->new(arrayref => \@skeleton_data,
                                die_on_bad_params => 0);
    $tmpl->param($params);
    $filename = $vss->package_name . '-vl.spec';
    $class->_generate_file($filename, $tmpl->output);
}


1;
