RPM4
view release on metacpan or search on metacpan
lib/RPM4/Spec.pm view on Meta::CPAN
my @buildflags;
for (qw/p c i/) {
$options{shortcircuit} && $f ne $_ and next;
/^p$/ and push (@buildflags, "PREP");
/^c$/ and push (@buildflags, "BUILD");
/^l$/ and push (@buildflags, "FILECHECK");
/^i$/ and push (@buildflags, qw/INSTALL CHECK/);
$f eq $_ and last;
}
for ($f) {
/^a$/ and push(@buildflags, qw/PACKAGESOURCE PACKAGEBINARY/);
/^b$/ and push(@buildflags, qw/PACKAGEBINARY/);
/^s$/ and push(@buildflags, qw/PACKAGESOURCE/);
}
$options{clean} and push(@buildflags, qw/RMBUILD RMSOURCE/);
$options{rmspec} and push(@buildflags, qw/RMSPEC/);
if (!$options{nodeps}) {
my $sh = $spec->srcheader() or die "Can't get source header from spec object"; # Can't happend
$options{db}->transadd($sh, "", 0);
$options{db}->transcheck;
my $pbs = RPM4::Transaction::Problems->new($options{db});
$options{db}->transreset();
if ($pbs) {
$pbs->print_all(\*STDERR);
return 1;
}
}
return $options{db}->specbuild($spec, [ @buildflags ]);
}
1;
__END__
=head1 NAME
RPM4::Spec
=head1 SYNOPSIS
=head1 DESCRIPTION
Extend method availlable on RPM4::Spec objects
=head1 METHODS
=head2 new(file, var => value, ...)
Create a C<RPM4::Spec> instance, only the file values is mandatory.
=over 4
=item file
The spec file from wich to create the object
=item passphrase
If specified, the passphrase will be used for gpg signing after build.
=item rootdir
If specified, root dir will be use root instead '/'.
=item cookies
the cookies is string rpm will put into RPMCOOKIES tag, a way to know if a rpm
has been built from a specific src. You get this value from L<installsrpm>.
=item anyarch
If set, you'll get a spec object even the spec can't be build on the
current %_target_cpu. Notice if you set this value, starting a build over
the spec object will works !
=item force
Normally, source analyze is done during spec parsing, getting a spec object
failed if a source file is missing, else you set force value.
TAKE CARE: if force is set, rpm will not check source type, so patch will NOT
be gunzip/bunzip... If you want to compile the spec, don't set it to 1, if you
just want run clean/packagesource stage, setting force to 1 is ok.
=back
By default anyarch and force are set to 0.
=head2 RPM4::Spec->srcheader()
Returns a RPM4::Header object like source rpm will be.
Please notice that the header is not finish and header information you'll
get can be incomplete, it depend if you call the function before or after
RPM4::Spec->build().
=head2 RPM4::Spec->srcrpm()
Returns the source filename spec file will build. The function take care
about rpmlib configuration (build dir path).
=head2 RPM4::Spec->binrpm()
Returns files names of binaries rpms that spec will build. The function take
care about rpmlib configuration (build dir path).
=head2 RPM4::Spec->build([ @actions ])
Run build process on spec file.
Each value in @actions is one or more actions to do:
- PACKAGESOURCE: build source package,
- PREP: run prep stage,
- BUILD: run build stage,
- INSTALL: run install stage,
- CHECK: check installed files,
- FILECHECK: check installed files,
- PACKAGEBINARY: build binaries packages,
- CLEAN: run clean stage,
- RMSPEC: delete spec file,
( run in 0.882 second using v1.01-cache-2.11-cpan-df04353d9ac )