Skip Menu |

This queue is for tickets about the Module-Build CPAN distribution.

Report information
The Basics
Id: 21642
Status: resolved
Priority: 0/
Queue: Module-Build

People
Owner: Nobody in particular
Requestors: smueller [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)



Subject: Adding a pardist target. [PATCH]
Hi, I'd like to see a "pardist" target akin to the "ppmdist" target. The attached patch implements it including a test file loosely based on the ppm.t test file. Drop me a note and a commit bit if you want me to apply this to the repository version. The patch is against the current version of the SVN repository. Keep up the great work! Steffen
Subject: pardist.patch
Index: t/par.t =================================================================== --- t/par.t (Revision 0) +++ t/par.t (Revision 0) @@ -0,0 +1,93 @@ +#!/usr/bin/perl -w + +use strict; +use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib'; +use MBTest; +use Module::Build; +use Module::Build::ConfigData; + +{ + my ($have_c_compiler, $C_support_feature) = check_compiler(); + if (! $C_support_feature) { + plan skip_all => 'C_support not enabled'; + } elsif ( ! $have_c_compiler ) { + plan skip_all => 'C_support enabled, but no compiler found'; + } elsif ( ! eval {require PAR::Dist; PAR::Dist->VERSION(0.17)} ) { + plan skip_all => "PAR::Dist 0.17 or up not installed to check .par's."; + } elsif ( ! eval {require Archive::Zip} ) { + plan skip_all => "Archive::Zip required."; + } else { + plan tests => 3; + } +} + + +use Cwd (); +my $cwd = Cwd::cwd; +my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' ); + + +use DistGen; +my $dist = DistGen->new( dir => $tmp, xs => 1 ); +$dist->add_file( 'hello', <<'---' ); +#!perl -w +print "Hello, World!\n"; +__END__ + +=pod + +=head1 NAME + +hello + +=head1 DESCRIPTION + +Says "Hello" + +=cut +--- +$dist->change_file( 'Build.PL', <<"---" ); + +my \$build = new Module::Build( + module_name => @{[$dist->name]}, + version => '0.01', + license => 'perl', + scripts => [ 'hello' ], +); + +\$build->create_build_script; +--- +$dist->regen; + +chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; + +use File::Spec::Functions qw(catdir); + +use Module::Build; +my @installstyle = qw(lib perl5); +my $mb = Module::Build->new_from_context( + verbose => 0, + quiet => 1, + + installdirs => 'site', +); + +my $filename = $mb->dispatch('pardist'); + +ok( -f $filename, '.par distributions exists' ); +my $distname = $dist->name; +ok( $filename =~ /^\Q$distname\E/, 'Distribution name seems correct' ); + +my $meta; +eval { $meta = PAR::Dist::get_meta($filename) }; + +ok( + (not $@ and defined $meta and not $meta eq ''), + 'Distribution contains META.yml' +); + +$dist->clean(); + +use File::Path; +rmtree( $tmp ); + Index: lib/Module/Build/Base.pm =================================================================== --- lib/Module/Build/Base.pm (Revision 7850) +++ lib/Module/Build/Base.pm (Arbeitskopie) @@ -2795,6 +2795,26 @@ $self->delete_filetree( $ppm ); } +sub ACTION_pardist { + my ($self) = @_; + + # Need PAR::Dist + if ( not eval { require PAR::Dist; PAR::Dist->VERSION(0.17) } ) { + $self->log_warn( + "In order to create .par distributions, you need to\n" + . "install PAR::Dist first." + ); + return(); + } + + $self->depends_on( 'build' ); + + return PAR::Dist::blib_to_par( + name => $self->dist_name, + version => $self->dist_version, + ); +} + sub ACTION_dist { my ($self) = @_; Index: lib/Module/Build.pm =================================================================== --- lib/Module/Build.pm (Revision 7850) +++ lib/Module/Build.pm (Arbeitskopie) @@ -450,6 +450,15 @@ the command line with the C<bindoc> and C<libdoc> installation targets. +=item pardist + +[version 0.2806] + +Generates a PAR binary distribution for use with L<PAR> or L<PAR::Dist>. + +It requires that the PAR::Dist module (version 0.17 and up) is +installed on your system. + =item ppd [version 0.20] Index: Changes =================================================================== --- Changes (Revision 7850) +++ Changes (Arbeitskopie) @@ -4,6 +4,8 @@ - Changes to do_system() & friends on VMS to get system calls working much better there. [Craig Berry] + - Added the "pardist" target which creates a PAR binary distribution + akin to a PPM distribution. [Steffen Mueller] 0.2805_01 Thu Sep 7 21:57:29 CDT 2006
Thanks, applied. -Ken