From: Steve Peters Date: Sun, 12 Mar 2006 13:48:10 +0000 (+0000) Subject: Upgrade to Module-Build-0.27_09 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=47f13fd55e4d882bda57d039f2f9bd7f39161c25;p=p5sagit%2Fp5-mst-13.2.git Upgrade to Module-Build-0.27_09 p4raw-id: //depot/perl@27481 --- diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl index d8ef76b..b05ae74 100644 --- a/Porting/Maintainers.pl +++ b/Porting/Maintainers.pl @@ -59,7 +59,8 @@ package Maintainers; 'smccam' => 'Stephen McCamant ', 'tels' => 'perl_dummy a-t bloodgate.com', 'tomhughes' => 'Tom Hughes ', - 'tjenness' => 'Tim Jenness ' + 'tjenness' => 'Tim Jenness ', + 'yves' => 'Yves Orton ', ); # The FILES is either filenames, or glob patterns, or directory @@ -223,10 +224,18 @@ package Maintainers; 'CPAN' => 1, }, + 'ExtUtils::Install' => + + { + 'MAINTAINER' => 'yves', + 'FILES' => q[lib/ExtUtils/{Install,Installed,Packlist}.pm], + 'CPAN' => 1, + }, + 'ExtUtils::MakeMaker' => { 'MAINTAINER' => 'mschwern', - 'FILES' => q[lib/ExtUtils/{Command,Install,Installed,Liblist,MakeMaker,Manifest,Mkbootstrap,Mksymlists,MM*,MY,Packlist,testlib}.pm lib/ExtUtils/{Command,Liblist,MakeMaker,MANIFEST.SKIP} + 'FILES' => q[lib/ExtUtils/{Command,Liblist,MakeMaker,Manifest,Mkbootstrap,Mksymlists,MM*,MY,testlib}.pm lib/ExtUtils/{Command,Liblist,MakeMaker,MANIFEST.SKIP} lib/ExtUtils/t t/lib/MakeMaker t/lib/TieIn.pm t/lib/TieOut.pm], 'CPAN' => 1, }, diff --git a/lib/Module/Build.pm b/lib/Module/Build.pm index 5aa73d8..cd0b8b5 100644 --- a/lib/Module/Build.pm +++ b/lib/Module/Build.pm @@ -15,7 +15,7 @@ use Module::Build::Base; use vars qw($VERSION @ISA); @ISA = qw(Module::Build::Base); -$VERSION = '0.27_08'; +$VERSION = '0.27_09'; $VERSION = eval $VERSION; # Okay, this is the brute-force method of finding out what kind of @@ -149,21 +149,22 @@ This illustrates initial configuration and the running of three 'actions'. In this case the actions run are 'build' (the default action), 'test', and 'install'. Other actions defined so far include: - build html - clean install - code manifest - config_data manpages - diff ppd - dist ppmdist - distcheck prereq_report - distclean pure_install - distdir realclean - distmeta skipcheck - distsign test - disttest testcover - docs testdb - fakeinstall testpod + build install + clean manifest + code manpages + config_data ppd + diff ppmdist + dist prereq_report + distcheck pure_install + distclean realclean + distdir skipcheck + distmeta test + distsign testcover + disttest testdb + docs testpod + fakeinstall testpodcoverage help versioninstall + html You can run the 'help' action for a complete list of actions. @@ -237,6 +238,12 @@ C action, which in turn runs the C and C actions. This is analogous to the MakeMaker 'make all' target. +=item testpodcoverage + +This checks the pod coverage of the distribution and +produces C-style output. If you are a module author, +this is useful to run before creating a new release. + =item clean This action will clean up any files that the build process may have diff --git a/lib/Module/Build/Authoring.pod b/lib/Module/Build/Authoring.pod index 4c5d645..a92a81b 100644 --- a/lib/Module/Build/Authoring.pod +++ b/lib/Module/Build/Authoring.pod @@ -1335,8 +1335,6 @@ accessor methods for the following properties: =item destdir() -=item dist_version_from() - =item get_options() =item html_css() diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm index ba73e7f..d8ec8ee 100644 --- a/lib/Module/Build/Base.pm +++ b/lib/Module/Build/Base.pm @@ -333,8 +333,16 @@ sub find_perl_interpreter { } elsif (defined $exe) { $thisperl .= $exe unless $thisperl =~ m/$exe$/i; } - - foreach my $perl ( $c->{perlpath}, + + my $uninstperl; + if ($ENV{PERL_CORE}) { + # CBuilder is also in the core, so it should be available here + require ExtUtils::CBuilder; + $uninstperl = File::Spec->catfile(ExtUtils::CBuilder::->perl_src, $thisperl); + } + + foreach my $perl ( $uninstperl || (), + $c->{perlpath}, map File::Spec->catfile($_, $thisperl), File::Spec->path() ) { return $perl if -f $perl and $proto->_perl_is_same($perl); @@ -762,22 +770,21 @@ sub dist_name { return $p->{dist_name} if defined $p->{dist_name}; die "Can't determine distribution name, must supply either 'dist_name' or 'module_name' parameter" - unless $p->{module_name}; + unless $self->module_name; - ($p->{dist_name} = $p->{module_name}) =~ s/::/-/g; + ($p->{dist_name} = $self->module_name) =~ s/::/-/g; return $p->{dist_name}; } -sub _find_dist_version_from { +sub dist_version_from { my ($self) = @_; my $p = $self->{properties}; if ($self->module_name) { - return $p->{dist_version_from} ||= + $p->{dist_version_from} ||= join( '/', 'lib', split(/::/, $self->module_name) ) . '.pm'; - } else { - return undef; } + return $p->{dist_version_from} || undef; } sub dist_version { @@ -785,11 +792,9 @@ sub dist_version { my $p = $self->{properties}; return $p->{dist_version} if defined $p->{dist_version}; - - $self->_find_dist_version_from; - if ( $p->{dist_version_from} ) { - my $version_from = File::Spec->catfile( split( qr{/}, $p->{dist_version_from} ) ); + if ( my $dist_version_from = $self->dist_version_from ) { + my $version_from = File::Spec->catfile( split( qr{/}, $dist_version_from ) ); my $pm_info = Module::Build::ModuleInfo->new_from_file( $version_from ) or die "Can't find file $version_from to determine version"; $p->{dist_version} = $pm_info->version(); @@ -2172,6 +2177,18 @@ sub ACTION_testpod { } } +sub ACTION_testpodcoverage { + my $self = shift; + + $self->depends_on('docs'); + + eval q{use Test::Pod::Coverage 1.00; 1} + or die "The 'testpodcoverage' action requires ", + "Test::Pod::Coverage version 1.00"; + + all_pod_coverage_ok(); +} + sub ACTION_docs { my $self = shift; @@ -2369,7 +2386,7 @@ sub htmlify_pods { ($path2root, $self->installdirs eq 'core' ? () : qw(site) ) ); - my $fh = IO::File->new($infile); + my $fh = IO::File->new($infile) or die "Can't read $infile: $!"; my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract(); my $title = join( '::', (@dirs, $name) ); @@ -2748,7 +2765,6 @@ EOF sub _main_docfile { my $self = shift; - $self->_find_dist_version_from; if ( my $pm_file = $self->dist_version_from ) { (my $pod_file = $pm_file) =~ s/.pm$/.pod/; return (-e $pod_file ? $pod_file : $pm_file); @@ -3065,7 +3081,7 @@ sub prepare_metadata { foreach (qw(dist_name dist_version dist_author dist_abstract license)) { (my $name = $_) =~ s/^dist_//; $node->{$name} = $self->$_(); - die "ERROR: Missing required field '$name' for META.yml\n" + die "ERROR: Missing required field '$_' for META.yml\n" unless defined($node->{$name}) && length($node->{$name}); } @@ -3418,12 +3434,14 @@ sub install_map { "WARNING: Can't figure out install path for types: @skipping\n" . "Files will not be installed.\n" ) if @skipping; - + # Write the packlist into the same place as ExtUtils::MakeMaker. - my $archdir = $self->install_destination('arch'); - my @ext = split /::/, $self->module_name; - $map{write} = File::Spec->catdir($archdir, 'auto', @ext, '.packlist'); - + if (my $module_name = $self->module_name) { + my $archdir = $self->install_destination('arch'); + my @ext = split /::/, $module_name; + $map{write} = File::Spec->catdir($archdir, 'auto', @ext, '.packlist'); + } + # Handle destdir if (length(my $destdir = $self->destdir || '')) { foreach (keys %map) { diff --git a/lib/Module/Build/Changes b/lib/Module/Build/Changes index e3a2b15..1edb670 100644 --- a/lib/Module/Build/Changes +++ b/lib/Module/Build/Changes @@ -1,5 +1,25 @@ Revision history for Perl extension Module::Build. +0.27_09 Sat Mar 11 22:48:54 EST 2006 + + - Fixed find_perl_interpreter() so we can find the perl executable + when running from uninstalled perl even when $^X contains a + relative path. [Yitzchak Scott-Thoennes] + + - Fixed warning message where we were printing the wrong field names. + [Chris Dolan] + + - Added a 'testpodcoverage' action that runs a POD coverage check for + all modules in the distribution. [Yanick Champoux] + + - Added a Cookbook example of subclassing to modify an action. [Dylan + Martin and David Golden] + + - When building HTML documentation, we were opening the POD file and + not checking whether the open succeeded, which of course caused + problems down the line if it failed. Now we do "or die(...)" like + everywhere else. [Spotted by Joerg Braun] + 0.27_08 Fri Mar 3 21:22:41 CST 2006 - Due to shell quoting issues and differences in syntax between diff --git a/lib/Module/Build/Compat.pm b/lib/Module/Build/Compat.pm index 25ce823..1010866 100644 --- a/lib/Module/Build/Compat.pm +++ b/lib/Module/Build/Compat.pm @@ -90,8 +90,9 @@ EOF # Save this 'cause CPAN will chdir all over the place. my $cwd = Cwd::cwd(); - # There seems to be no way to determine if this install was successful CPAN::Shell->install('Module::Build::Compat'); + CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate + or die "Couldn't install Module::Build, giving up.\n"; chdir $cwd or die "Cannot chdir() back to $cwd: $!"; } diff --git a/lib/Module/Build/Cookbook.pm b/lib/Module/Build/Cookbook.pm index 9c761ec..738daee 100644 --- a/lib/Module/Build/Cookbook.pm +++ b/lib/Module/Build/Cookbook.pm @@ -329,6 +329,40 @@ was very easy to do with M::B. =back 4 +=head2 Modifying an action + +Sometimes you might need an to have an action, say C<./Build install>, +do something unusual. For instance, you might need to change the +ownership of a file or do something else peculiar to your application. + +You can subclass C on the fly using the C +method and override the methods that perform the actions. You may need +to read through C to find the methods you +want to override, but the general pattern is C followed by +the name of the action you want to modify. Here's an example of how +it would work for C: + + # Build.PL + use Module::Build; + my $class = Module::Build->subclass( + class => "Module::Build::Custom", + code => <<'SUBCLASS' ); + + sub ACTION_install { + my $self = shift; + # YOUR CODE HERE + $self->SUPER::ACTION_install; + } + SUBCLASS + + $class->new( + module_name => 'Your::Module', + # rest of the usual Module::Build parameters + )->create_build_script; + +See the C pod in 0.27 or above for more +complete documentation on this. + =head1 AUTHOR Ken Williams