Red Cricket
Red Cricket

Reputation: 10470

Perl Build ignores destdir

I am try to create a RPM for the Perl Module YAML::Tiny and in my spec file I have this ...

%build
/usr/perl/bin/perl Build.PL INSTALLDIRS=vendor
./Build
./Build test
%install
rm -rf $RPM_BUILD_ROOT
./Build install destdir=$RPM_BUILD_ROOT

... and when I run rpmbuild I get this error:

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/perl-5.14.1/lib/red_perl/YAML'
mkdir /usr/perl-5.14.1/lib/red_perl/YAML: Permission denied at /usr/perl-5.14.1/lib/5.14.1/ExtUtils/Install.pm line 494

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Any help is appreciated. Thanks!

Upvotes: 0

Views: 504

Answers (1)

cjm
cjm

Reputation: 62109

YAML::Tiny currently uses Module::Build::Tiny for installation. That isn't as flexible about how you pass parameters. To quote its docs:

Module::Build has an extremely permissive way of argument handling, Module::Build::Tiny only supports a (sane) subset of that. In particular, ./Build destdir=/foo does not work, you will need to pass it as ./Build --destdir=/foo.

(This is so it can outsource argument parsing to Getopt::Long instead of having to include a custom command-line parser like Module::Build does.)

So your spec should look like this:

%build
/usr/perl/bin/perl Build.PL --installdirs=vendor
./Build
./Build test
%install
rm -rf $RPM_BUILD_ROOT
./Build install --destdir=$RPM_BUILD_ROOT

Upvotes: 2

Related Questions