1 package RpmSpecProjectCreator
;
3 # ************************************************************
4 # Description : An RPM .spec file Project Creator
5 # Author : Adam Mitz (OCI)
6 # Create Date : 11/23/2010
7 # ************************************************************
9 # ************************************************************
11 # ************************************************************
19 @ISA = qw(ProjectCreator);
21 # ************************************************************
23 # ************************************************************
25 sub project_file_extension
{
29 # Don't actually write anything, just keep MPC internal data structures
30 # up-to-date as if it had been written. We don't want a .spec file for each
31 # MPC project because that is too fine-grained. See the corresponding
32 # workspace creator for the actual .spec file creation.
33 sub write_output_file
{
35 my $tover = $self->get_template_override();
36 my @templates = $self->get_template();
37 @templates = ($tover) if (defined $tover);
39 if (scalar @templates != 1) {
40 return 0, 'there should be only one template';
43 my $template = $templates[0];
44 $self->{'current_template'} = $template;
46 my $name = $self->transform_file_name($self->project_file_name(undef,
48 $self->process_assignment('project_file', $name);
49 new TemplateParser
($self)->collect_data();
51 if (defined $self->{'source_callback'}) {
52 my $cb = $self->{'source_callback'};
53 my $pjname = $self->get_assignment('project_name');
54 my @list = $self->get_component_list('source_files');
55 if (UNIVERSAL
::isa
($cb, 'ARRAY')) {
58 &$s(@copy, $name, $pjname, \
@list);
60 elsif (UNIVERSAL
::isa
($cb, 'CODE')) {
61 &$cb($name, $pjname, \
@list);
64 $self->warning("Ignoring callback: $cb.");
68 # Still need outdir since ProjectCreator::write_install_file (or similar)
69 # may depend on outdir existing before the WorkspaceCreator runs.
70 my $outdir = $self->get_outdir();
71 mkpath
($outdir, 0, 0777) if ($outdir ne '.');
73 $self->add_file_written($name);