3 # perl-Pod-Tree perl-Archive-Any perl-Template-Toolkit perl-YAML perl-IO-String
4 # perl-File-Iterator perl-Module-CoreList
8 use Getopt::Long qw( GetOptions );
9 use IPC::Run qw( run timeout );
10 use Pod::Select qw( podselect );
18 use File::Iterator ();
19 use Module::CoreList ();
25 - use poldek to search if dir should be packaged:
26 $ poldek -q --cmd search -f /usr/share/perl5/vendor_perl/Text
28 - first could be checked if the dir is contained by perl-base (will be faster
33 our $VERSION = sprintf "%d.%02d", q$Revision$ =~ /(\d+)/g;
35 GetOptions(\%opts, 'verbose|v', 'modulebuild|B', 'makemaker|M', 'force');
36 eval "use Data::Dump qw(pp);" if $opts{verbose};
42 pldcpan.pl [ OPTIONS ] DIST [ DIST2 DIST3 ... ]
45 -v|--verbose shout, and shout loud
46 -B|--modulebuild prefer Module::Build (default)
47 -M|--makemaker prefer ExtUtils::MakeMaker
48 --force overwrite existing *.spec files
50 This program uncompresses given archives in the current directory
51 and -- more or less successfully -- attempts to write corresponding
54 DIST can be a directory, a compressed archive, URL to fetch or module
55 name (Foo::Bar) to be found on search.cpan.org.
61 # get maximum information from directory name
65 return $info->{_tests}->{directory}
66 if defined $info->{_tests}->{directory};
68 # FIXME: use -v (hmm, what did I meant?)
84 warn " -- cannot resolve name and version: '$fooball'\n";
85 return $info->{_tests}->{directory} = 0;
88 $info->{ballname} = $1;
90 $info->{version} = $3;
93 @{$info}{qw(pdir pnam)} = $separ
94 ? (split /$separ/, $info->{ballname}, 2)
95 : ($info->{ballname}, undef);
97 [$separ ? (split /$separ/, $info->{ballname}) : ($info->{ballname})];
99 $info->{parts_joined} = join '::', @{ $info->{parts} };
100 $info->{_tests}->{directory} = 1;
103 sub test_archive_name {
104 my (undef, $info) = @_;
105 return $info->{_tests}->{archive_name}
106 if defined $info->{_tests}->{archive_name};
108 s/\.(?:(?:tar\.)?(?:gz|bz2|Z)|tar|tgz|zip|rar|arj|lha)$//;
109 $info->{_tests}->{archive_name} = test_directory($d, @_);
114 return $info->{_tests}->{has_tests}
115 if defined $info->{_tests}->{has_tests};
116 die "not a directory ($info->{dir})!" unless -d $info->{dir};
118 if (-d "$info->{dir}/t" || -f "$info->{dir}/test.pl") {
120 return $info->{_tests}->{has_tests} = 1;
122 $info->{_tests}->{has_tests} = 0;
125 sub test_has_examples {
127 return $info->{_tests}->{has_examples}
128 if defined $info->{_tests}->{has_examples};
129 die "not a directory ($info->{dir})!" unless -d $info->{dir};
133 map { $_, lc $_, uc $_ } qw(Example Examples Eg Sample Samples)];
134 $info->{_tests}->{has_examples} = @{ $info->{examples} } ? 1 : 0;
137 sub test_has_doc_files {
139 return $info->{_tests}->{has_doc_files}
140 if defined $info->{_tests}->{has_doc_files};
141 die "not a directory ($info->{dir})!" unless -d $info->{dir};
143 $info->{doc_files} = [
146 map { $_, lc $_, uc $_ }
147 map { $_, "$_.txt", "$_.TXT" }
148 qw(AUTHORS BUGS ChangeLog Changes CREDITS doc docs documentation EXTRAS
149 GOALS HACKING HISTORY INSTALL NEW NEWS NOTES PATCHING README DISCLAIMER
152 $info->{_tests}->{has_doc_files} = @{ $info->{doc_files} } ? 1 : 0;
157 return $info->{_tests}->{license}
158 if defined $info->{_tests}->{license};
159 if (load_META_yml($info) && $info->{META_yml}->{license}) {
161 $info->{META_yml}->{license} =~ /^l?gpl$/
162 ? uc $info->{META_yml}->{license}
163 : $info->{META_yml}->{license};
164 # This depends on test_find_summ_descr2
165 } elsif (my $license = $info->{pod_license}) {
166 $info->{license} = 'perl' if $license =~ /same terms as perl/i;
168 $info->{_tests}->{license} = $info->{license} ? 1 : 0;
173 return $info->{_tests}->{license}
174 if defined $info->{_tests}->{license};
176 $info->{META_yml} = YAML::LoadFile('META.yml');
179 _remove_core_meta_requires($info, 'requires');
180 _remove_core_meta_requires($info, 'build_requires');
182 $info->{_tests}->{license} = $info->{META_yml} ? 1 : 0;
185 sub _remove_core_meta_requires {
186 my ($info, $key) = @_;
188 return if ref($info->{META_yml}->{$key}) ne 'HASH';
190 # avoid perl(perl) >= 5.6... requires
191 delete $info->{META_yml}->{$key}->{perl};
193 while (my ($module, $version) = each %{ $info->{META_yml}->{$key} }) {
195 print "Checking dependency: $module $version\n" if $opts{verbose};
197 $result = Module::CoreList->first_release($module, $version);
199 $result = Module::CoreList->first_release($module);
202 if ( $result and $result < $] ) {
203 if ($opts{verbose}) {
204 print "Module $module availablie in core since $result, skipping\n"
206 delete $info->{META_yml}->{$key}->{$module};
211 sub test_find_pod_file {
213 return $info->{_tests}->{find_pod_file}
214 if defined $info->{_tests}->{find_pod_file};
215 die "not a directory ($info->{dir})!" unless -d $info->{dir};
219 my $mfile = @{ $info->{parts} }[-1];
220 if (!defined $mfile) {
221 warn " .. unable to search for \$pod_file without parts\n";
222 return $info->{_tests}->{find_pod_file} = 0;
224 my $it = File::Iterator->new(
228 sub { $_[0] =~ m#(?:^|/)\Q$mfile\E\.(?:pod|pm)$# && $_[0] !~ m#/t/# }
231 while (my $f = $it->next()) {
232 $pod = $f if $f =~ /\.pod$/;
233 $pm = $f if $f =~ /\.pm$/;
235 $pod_file = $pod ? $pod : $pm;
237 && load_META_yml($info)
238 && exists $info->{META_yml}->{version_from})
240 $pod_file = $info->{META_yml}->{version_from};
244 warn " -- no \$pod_file <@{$info->{parts}}>\n";
245 return $info->{_tests}->{find_pod_file} = 0;
248 my $tree = new Pod::Tree;
249 $tree->load_file($pod_file);
250 unless ($tree->has_pod) {
251 warn " ,, no POD in $pod_file\n";
252 return $info->{_tests}->{find_pod_file} = 0;
255 $info->{_podtree} = $tree;
256 $info->{pod_file} = $pod_file;
257 $info->{_tests}->{find_pod_file} = 1;
260 # workaround for Pod::Parser not supporting "\r\n" line endings
262 no warnings 'redefine';
264 sub Pod::Parser::preprocess_line {
265 (my $text = $_[1]) =~ y/\r//d;
270 sub test_find_summ_descr2 {
273 return $info->{_tests}->{find_summ_descr} = 0
274 unless test_find_pod_file($info);
276 my $tree = $info->{_podtree};
277 my $handler = _get_node_handler();
278 $tree->walk( $handler );
279 ($info->{summary}, $info->{descr}, $info->{pod_license}) = $handler->('data');
282 # This subroutine return closure to be used as a node handler in Pod::Tree walk() method
283 sub _get_node_handler {
286 my $we_are_in_license;
287 my $we_are_in_description;
288 my $nodes_since_description_start;
289 # data we will return
290 my ($summary, $description, $license);
295 # If not called with a node, then return collected data
297 $summary =~ s/^ \s* (.*?) \s* $/$1/gxm;
298 return ($summary, $description, $license);
301 # We want to dive into root node. Note that this is the only
302 # place we ever descend into tree
303 return 1 if $node->is_root;
305 # If we have encountered any head command then abort collecting
306 # summary and description
307 my $command = $node->get_command;
308 if ($node->is_command and $command =~ /head/) {
309 if ($command eq 'head1' or $nodes_since_description_start > 3) {
310 $we_are_in_description = 0;
312 $next_is_summary = 0;
313 $we_are_in_license = 0;
316 # If previous element started an summary section, then treat
317 # this one as summary text.
318 if ($next_is_summary) {
319 ($summary = $node->get_deep_text) =~ y/\r//d;
320 $summary =~ s/^\s+(.*?)\s+$/$1/;
321 $next_is_summary = 0;
324 if ($we_are_in_license) {
325 ($license .= $node->get_text) =~ y/\r//d;
329 # If we started collecting description then add any ordinary
330 # node to collected description
331 if ($we_are_in_description) {
332 if ($nodes_since_description_start > 5) {
333 $we_are_in_description = 0;
335 elsif ($node->is_ordinary or $node->is_verbatim) {
336 ($description .= $node->get_deep_text) =~ y/\r//d;
337 $nodes_since_description_start++;
344 # OK, next will be sumary text
345 if ($node->is_c_head1 and $node->get_text =~ /^\s*NAME\s*$/) {
346 $next_is_summary = 1;
348 # OK, description nodes will proceeed (until another head command)
349 if ($node->is_c_head1 and $node->get_text =~ /DESCRIPTION/) {
350 $we_are_in_description = 1;
351 $nodes_since_description_start = 1;
353 if ($node->is_c_head1 and $node->get_text =~ /LICENSE|COPYRIGHT/) {
354 $we_are_in_license = 1;
360 sub test_find_summ_descr {
362 return $info->{_tests}->{find_summ_descr}
363 if defined $info->{_tests}->{find_summ_descr};
364 return $info->{_tests}->{find_summ_descr} = 0
365 unless test_find_pod_file($info);
367 # my $parser = new Pod::Select;
368 # $parser->parse_from_file($info->{pod_file});
369 for my $sec ({ h => 'summary', s => 'NAME' },
370 { h => 'descr', s => 'DESCRIPTION' })
372 my $H = new IO::String \$info->{ $sec->{h} };
373 podselect({ -output => $H, -sections => [$sec->{s}] },
376 $info->{ $sec->{h} } =~ s/^\s*=head.*//;
380 my $tree = new Pod::Tree;
381 $tree->load_file($info->{pod_file});
382 unless ($tree->has_pod) {
383 warn " ,, no POD in $info->{pod_file}\n";
384 return $info->{_tests}->{find_summ_descr} = 0;
387 my $root = $tree->get_root;
388 $info->{$_} = '' for qw/summary descr/;
391 for my $n (@{ $root->get_children }) {
392 if ($n->is_c_head1) {
395 if $n->get_text =~ /^\s*NAME\b/ && !$info->{summary};
397 if $n->get_text =~ /^\s*DESCRIPTION\b/ && !$info->{descr};
400 $info->{$state} .= $n->get_text if $state;
404 $info->{summary} =~ y/\r\n\t / /s;
405 $info->{$_} =~ s/^\s+|\s+$//g for qw/summary descr/;
407 warn " ,, no summary in $info->{pod_file}\n" unless $info->{summary};
408 warn " ,, no description in $info->{pod_file}\n" unless $info->{descr};
411 my $file < io($info->{pod_file});
413 if ($file =~ /(?:^|\n)=head\d\s+NAME[\t ]*\n\s*(.+)\n+(?:=|$)/) {
414 $info->{summary} = $1;
415 $info->{summary} =~ s/\s+$//g;
418 warn " ,, no summary: $_\n";
419 $info->{summary} = '';
421 if ($file =~ /\n=head\d DESCRIPTION\s*\n\s*((?:(?<!=head).+\n){1,15})/) {
424 run ['fmt'], \$info->{descr}, \$tmp;
425 $info->{descr} = $tmp if length $tmp;
426 $info->{descr} =~ s/\s+$//g;
429 warn " ,, no description: $_\n";
434 $info->{_tests}->{find_summ_descr} =
435 ($info->{summary} || $info->{descr}) ? 1 : 0;
438 sub test_build_style {
440 return $info->{_tests}->{build_style}
441 if defined $info->{_tests}->{build_style};
442 $info->{uses_makemaker} = -e 'Makefile.PL';
443 $info->{uses_module_build} = -e 'Build.PL';
444 $info->{uses_makemaker} = 0
445 if $opts{modulebuild} && $info->{uses_module_build};
446 $info->{uses_module_build} = 0
447 if $opts{makemaker} && $info->{uses_makemaker};
448 $info->{_tests}->{build_style} =
449 ($info->{uses_module_build} || $info->{uses_makemaker}) ? 1 : 0;
452 sub gen_tarname_unexp {
455 unless exists $info->{tarname} && test_directory($info->{dir}, $info);
456 (my $tmp = $info->{tarname}) =~ s#.*/##;
457 $info->{tarname_unexp} = unexpand_macros($info, $tmp);
460 sub unexpand_macros {
463 $value =~ s/\Q$info->{pdir}\E/%{pdir}/;
464 $value =~ s/\Q$info->{pnam}\E/%{pnam}/ if $info->{pnam};
465 $value =~ s/\Q$info->{version}\E/%{version}/;
471 return $info->{_tests}->{is_xs}
472 if defined $info->{_tests}->{is_xs};
475 $info->{_tests}->{is_xs} = ( <*.c> || <*.xs> || <*/*.c> || <*/*.xs> || <*/*/*.c> || <*/*/*.xs> ) ? 1 : 0;
480 test_build_style($info);
481 return $info->{_tests}->{run_configure}
482 if defined $info->{_tests}->{run_configure};
484 $info->{tmp_destdir} = getcwd() . "/pldcpan_destdir_$$";
485 system(qw(rm -rf), $info->{tmp_destdir}) if -e $info->{tmp_destdir};
487 if ($info->{_tests}->{build_style}) {
489 $info->{uses_makemaker}
490 ? qw(perl Makefile.PL INSTALLDIRS=vendor)
492 qw(perl Build.PL installdirs=vendor config="optimize='%{rpmcflags}'"),
493 qw(destdir='$info->{tmp_destdir}')
498 qw(perl -MExtUtils::MakeMaker -wle),
499 qq#WriteMakefile(NAME=>"$info->{parts_joined}")#,
500 qw(INSTALLDIRS=>vendor)
503 $info->{_tests}->{run_configure} = run \@cmd, \undef, \my $out, \my $err,
509 return $info->{_tests}->{run_build} if defined $info->{_tests}->{run_build};
510 return $info->{_tests}->{run_build} = 0 unless run_configure($info);
513 if ($info->{_tests}->{build_style}) {
515 $info->{uses_makemaker}
522 $info->{_tests}->{run_build} = run \@cmd, \undef, \my $out, \my $err,
528 return $info->{_tests}->{run_test} if defined $info->{_tests}->{run_test};
529 return $info->{_tests}->{run_test} = 0 unless run_build($info);
532 if ($info->{_tests}->{build_style}) {
534 $info->{uses_makemaker}
536 : qw(perl ./Build test);
539 @cmd = qw(make test);
541 $info->{_tests}->{run_test} = run \@cmd, \undef, \my $out, \my $err,
547 return $info->{_tests}->{run_install}
548 if defined $info->{_tests}->{run_install};
549 return $info->{_tests}->{run_install} = 0 unless run_build($info);
552 if ($info->{_tests}->{build_style}) {
554 $info->{uses_makemaker}
555 ? (qw(make install), "DESTDIR='$info->{tmp_destdir}'")
556 : qw(perl ./Build install);
559 @cmd = (qw(make install), "DESTDIR='$info->{tmp_destdir}'");
566 return $info->{_tests}->{find_files}
567 if defined $info->{_tests}->{find_files};
568 return $info->{_tests}->{find_files} = 0 unless run_install($info);
572 sub build_reqs_list {
574 my $rr = $info->{META_yml}->{requires};
575 my $br = $info->{META_yml}->{build_requires};
576 my %RR = map format_r_or_br( $_, $rr->{$_} ), keys %$rr;
577 my %BR = map format_r_or_br( $_, $br->{$_} ), keys %$br;
578 $info->{requires} = \%RR;
579 $info->{build_requires} = \%BR;
583 my ( $package, $version ) = @_;
584 my $rpmreq = "perl($package)";
585 ( my $possible = "perl-$package" ) =~ s/::/-/g;
586 if ( run( [ 'rpm', '-q', $possible ], \my ( undef, $out, $err ) )
587 or run( [ 'rpm', '-q', '--whatprovides', $possible ], \my ( undef, $out2, $err2 ) ) )
589 return $possible => $version; # we have this package or it is provided by something else
591 elsif ( run( [ 'rpm', '-q', '--qf', '%{NAME}\n', '--whatprovides', $rpmreq ], \my ( undef, $out3, $err3 ) ) ) {
592 my @providers = grep !/^perl-(?:base|modules|devel)$/, split /\s+/, $out3; # might be more than one
593 return unless @providers; # core, ignore
594 return $providers[0] => $version if @providers == 1;
596 return $rpmreq => $version; # fallback
599 for my $arg (@ARGV) {
600 my $info = { _tests => {} };
603 ## local file; otherwise... hackish trash code :-]
604 ## TODO: %pdir / %pnam in %URL
606 elsif (my ($tarname) =
607 $arg =~ m#^(?:https?|ftp)://[^/]+/(?:[^/]+/)*([^/]+)$#)
610 warn " -- fetching '$tarname'\n";
611 my $response = LWP::Simple::mirror($info->{url}, $tarname);
612 if (HTTP::Status::is_error($response)) {
613 warn " !! fetching '$tarname' failed: code $response. omiting.\n";
618 elsif ($arg =~ /^[a-z\d_]+(?:(?:::|-)[a-z\d_]+)*$/i) {
619 (my $dist = $arg) =~ s/::/-/g;
620 warn " -- searching for '$dist' on search.cpan.org\n";
621 my $scpan = LWP::Simple::get("http://search.cpan.org/dist/$dist/");
623 || $scpan =~ /cannot be found, did you mean one of these/
624 || $scpan !~ m#<a href="/CPAN/authors/id/([^"]+/([^/"]+))">Download</a>#)
626 warn " !! searching for '$dist' on search.cpan.org failed\n";
629 $info->{url} = "http://www.cpan.org/modules/by-authors/id/$1";
631 warn " .. found $info->{url}\n";
632 my $response = LWP::Simple::mirror($info->{url}, $tarname);
633 if (HTTP::Status::is_error($response)) {
634 warn " !! fetching '$tarname' failed: code $response. omiting.\n";
640 warn " !! omiting '$arg': !-e or bad URL\n";
645 $info->{dir} = $arg =~ m#^/# ? $arg : getcwd() . "/$arg";
646 test_directory($arg, $info);
649 open my $fh, $arg or die "can't open <$arg>: $!";
650 $info->{source0md5} = Digest::MD5->new->addfile($fh)->hexdigest;
651 close $fh or die "close <$arg>: $!";
653 $info->{tarname} = $arg;
654 my $arch = Archive::Any->new($arg);
656 warn " -- unpacking failed, omiting $arg";
659 if ($arch->is_naughty) {
660 warn " !! Archive::Any says, that $arg is_naughty. omiting.\n";
663 test_archive_name($arg, $info);
664 if ($info->{is_impolite} = $arch->is_impolite) {
665 if (!$info->{_tests}->{archive_name}) {
667 "test_archive_name failed and $arg is_impolite; giving up\n";
670 $info->{dir} = getcwd() . "/$info->{ballname}-$info->{version}";
671 mkdir $info->{dir} or die "can't mkdir <$info->{dir}>, $arg!";
672 $arch->extract($info->{dir}) or die "Ni! $arg\n";
675 ($arch->files)[0] =~ m#^(?:\.?/)?([^/]+)(?:/|$)#
676 or die "can't resolve dir from content of $arg";
677 $info->{dir} = getcwd() . "/$1";
678 $arch->extract or die "Nii! $arg\n";
682 test_find_pod_file($info);
684 my $basedir = getcwd;
686 $info->{dir} =~ s#/*$##;
687 die " !! not a directory: $info->{dir}" unless -d $info->{dir};
688 warn " .. processing $info->{dir}\n";
691 # test_find_summ_descr($info);
692 test_find_summ_descr2($info);
695 test_has_tests($info);
696 test_has_examples($info);
697 test_has_doc_files($info);
698 test_build_style($info);
699 gen_tarname_unexp($info);
700 build_reqs_list($info);
702 $info->{dir} =~ s#.*/##;
703 $info->{dir_unexp} = unexpand_macros($info, $info->{dir});
705 # try to fixup the URL
706 if ($info->{url} && $info->{url} =~ m,/by-authors/id/, && $info->{pdir}) {
707 my $base_url = "http://www.cpan.org/modules/by-module/$info->{pdir}/";
708 if (LWP::Simple::head($base_url . $info->{tarname})) {
709 $info->{url} = $base_url . unexpand_macros($info, $info->{tarname});
718 map { ; "test_$_" => $info->{_tests}->{$_} }
719 keys %{ $info->{_tests} }
722 pp($info) if $opts{verbose};
724 die " !! I find the idea of overwriting perl.spec disgusting."
725 unless @{ $info->{parts} };
726 my $spec = join('-', "$basedir/perl", @{ $info->{parts} }) . '.spec';
727 warn " .. writing to '$spec'" . (-e $spec ? " ... which exists...\n" : "\n");
728 die " !! I'm not to overwriting '$spec' without --force\n"
729 if -e $spec && !$opts{force};
731 my $rotfl = tell DATA;
734 { INTERPOLATE => 0, POST_CHOMP => 0, EVAL_PERL => 1, ABSOLUTE => 1 });
735 $tmpl->process(\*DATA, $info, $spec)
736 || warn "error parsing $info->{dir}: "
737 . $tmpl->error->type . "\n"
738 . $tmpl->error->info . "\n"
739 . $tmpl->error . "\n";
740 seek DATA, $rotfl, 0;
743 # vim: ts=4 sw=4 noet noai nosi cin
745 # $[% 'Revision:$, $Date'%]:$
748 %bcond_without autodeps # don't BR packages needed only for resolving deps
749 %bcond_without tests # do not perform "make test"
751 %include /usr/lib/rpm/macros.perl
752 %define pdir [% pdir %]
754 %define pnam [% pnam %]
756 Summary: [% summary.replace('[\r\n]+', ' ') %]
758 Name: perl-[% pdir %][% IF pnam %]-[% pnam %][% END %]
759 Version: [% version %]
761 [% IF test_license && license == 'perl' -%]
763 License: GPL v1+ or Artistic
764 [% ELSIF test_license -%]
765 License: [% license %]
767 # same as perl (REMOVE THIS LINE IF NOT TRUE)
768 #License: GPL v1+ or Artistic
770 Group: Development/Languages/Perl
774 Source0: http://www.cpan.org/modules/by-module/[% pdir %]/[% tarname_unexp %]
776 Source0: http://www.cpan.org/modules/by-module/[% pdir %]/%{pdir}-%{pnam}-%{version}.tar.gz
778 Source0: http://www.cpan.org/modules/by-module/[% pdir %]/%{pdir}-%{version}.tar.gz
781 # Source0-md5: [% source0md5 %]
783 # generic URL, check or change before uncommenting
785 #URL: http://search.cpan.org/dist/[% pdir %]-[% pnam %]/
787 #URL: http://search.cpan.org/dist/[% pdir %]/
789 BuildRequires: perl-devel >= 1:5.8.0
790 BuildRequires: rpm-perlprov >= 4.1-13
791 [% IF test_has_tests -%]
792 %if %{with autodeps} || %{with tests}
793 [% FOREACH req IN requires.keys.sort -%]
794 BuildRequires: [% req %][% ' >= ' _ requires.$req IF requires.$req %]
796 [% FOREACH req IN build_requires.keys.sort -%]
797 [% NEXT IF requires.exists(req) -%]
798 BuildRequires: [% req %][% ' >= ' _ build_requires.$req IF build_requires.$req %]
802 [% IF !test_is_xs -%]
805 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
810 # %description -l pl.UTF-8
814 %setup -q -n [% dir_unexp %][% IF is_impolite %]-c[% END %]
817 [%- IF uses_module_build %]
820 config="optimize='%{rpmcflags}'" \
822 destdir=$RPM_BUILD_ROOT \
826 %{?with_tests:./Build test}
827 [%- ELSIF uses_makemaker %]
828 %{__perl} Makefile.PL \
830 %{__make}[% IF test_is_xs -%] \
831 OPTIMIZE="%{rpmcflags}"[% END %]
833 %{?with_tests:%{__make} test}
835 %{__perl} -MExtUtils::MakeMaker -wle 'WriteMakefile(NAME=>"[% parts_joined %]")' \
837 %{__make}[% IF test_is_xs -%] \
838 OPTIMIZE="%{rpmcflags}"[% END %]
840 %{?with_tests:%{__make} test}
844 rm -rf $RPM_BUILD_ROOT
846 [% IF uses_module_build || !uses_makemaker -%]
849 %{__make} pure_install \
850 DESTDIR=$RPM_BUILD_ROOT
852 [% IF test_has_examples -%]
854 install -d $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
855 [% FOREACH eg = examples -%]
856 cp -a [% eg %] $RPM_BUILD_ROOT%{_examplesdir}/%{name}-%{version}
861 rm -rf $RPM_BUILD_ROOT
864 %defattr(644,root,root,755)
865 [% IF test_has_doc_files -%]
866 %doc[% FOREACH doc = doc_files %] [% doc %][% END %]
869 %{perl_vendorarch}/[% pdir %]/*.pm
870 %dir %{perl_vendorarch}/auto/[% pdir %]/[% pnam %]
871 %{perl_vendorarch}/auto/[% pdir %]/[% pnam %]/*.bs
872 %attr(755,root,root) %{perl_vendorarch}/auto/[% pdir %]/[% pnam %]/*.so
874 [%- number = parts.size - 1 -%]
875 %{perl_vendorlib}/[% parts.first(number).join('/') %]/*.pm
876 %{perl_vendorlib}/[% pdir %]/[% parts.last(number).join('/') %]
879 [% IF test_has_examples -%]
880 %{_examplesdir}/%{name}-%{version}
883 %define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
885 * %{date} PLD Team <feedback@pld-linux.org>
886 All persons listed below can be reached at <cvs_login>@pld-linux.org