summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Golden <dagolden@cpan.org>2009-08-27 11:41:10 -0400
committerDavid Golden <dagolden@cpan.org>2009-08-27 11:41:10 -0400
commitcdbde1c3701b0cb92ce2e5d6926444ea6ea6a710 (patch)
treea7b12122e9fc72084f7485b682826882b9980f5e
parent744c27e5aa4aa3ee30df5711b0799332655b563e (diff)
downloadperl-cdbde1c3701b0cb92ce2e5d6926444ea6ea6a710.tar.gz
Update Module::Build to 0.35
0.35 - Thu Aug 27 09:12:02 EDT 2009 Bug fixes: - Fix t/destinations.t segfault on 5.6.2 0.34_06 - Sat Aug 22 21:58:26 EDT 2009 Bug fixes: - Multiple test fixes for OS2 [Ilya Zakharevich] - Generated.ppd files use :utf8 if possible (RT#48827) [Olivier Mengue] - Fixed preservation of custom install_paths on resume (RT#41166) [David Golden] - Warn instead of crashing when Pod::Man tries to create files with colons on vfat partitions on unix (RT#45544) [David Golden] 0.34_05 - Sun Aug 9 22:31:37 EDT 2009 Bug fixes: - When auto_configure_requires is true (the default), Module::Build will only add last 'major' version of Module:Build (e.g. 0.XX) to configure_requires to avoid specifying a minor development release not available on CPAN [David Golden] 0.34_04 - Sat Aug 8 11:02:24 EDT 2009 Other: - Added documentation warning that 'get_options' should be capitalized to avoid conflicting with future Module::Build options and changed the examples accordingly. 0.34_03 - Sat Aug 8 07:39:16 EDT 2009 Bug fixes: - Fixed failing xs.t if /tmp is mounted noexec (RT#47331) [David Golden] - Fixed failing debug.t on VMS (RT#48362) [Craig Berry] - Prevent par.t from dying on error in .zip extraction [David Golden] - Fixed potential runthrough.t failure on 5.6.2 [David Golden] Other: - Archive::Tar changed from 'requires' to 'recommends' so non-authors without IO::Zlib can still use Module::Build to install modules [reported by Matt Trout, fix by David Golden]
-rw-r--r--MANIFEST1
-rwxr-xr-xPorting/Maintainers.pl2
-rw-r--r--lib/Module/Build.pm2
-rw-r--r--lib/Module/Build/API.pod23
-rw-r--r--lib/Module/Build/Base.pm158
-rw-r--r--lib/Module/Build/Changes45
-rw-r--r--lib/Module/Build/Compat.pm6
-rw-r--r--lib/Module/Build/Config.pm2
-rw-r--r--lib/Module/Build/Cookbook.pm2
-rw-r--r--lib/Module/Build/Dumper.pm2
-rw-r--r--lib/Module/Build/ModuleInfo.pm2
-rw-r--r--lib/Module/Build/Notes.pm2
-rw-r--r--lib/Module/Build/PPMMaker.pm3
-rw-r--r--lib/Module/Build/Platform/Amiga.pm2
-rw-r--r--lib/Module/Build/Platform/Default.pm2
-rw-r--r--lib/Module/Build/Platform/EBCDIC.pm2
-rw-r--r--lib/Module/Build/Platform/MPEiX.pm2
-rw-r--r--lib/Module/Build/Platform/MacOS.pm2
-rw-r--r--lib/Module/Build/Platform/RiscOS.pm2
-rw-r--r--lib/Module/Build/Platform/Unix.pm2
-rw-r--r--lib/Module/Build/Platform/VMS.pm2
-rw-r--r--lib/Module/Build/Platform/VOS.pm2
-rw-r--r--lib/Module/Build/Platform/Windows.pm2
-rw-r--r--lib/Module/Build/Platform/aix.pm2
-rw-r--r--lib/Module/Build/Platform/cygwin.pm2
-rw-r--r--lib/Module/Build/Platform/darwin.pm2
-rw-r--r--lib/Module/Build/Platform/os2.pm2
-rw-r--r--lib/Module/Build/PodParser.pm2
-rw-r--r--lib/Module/Build/t/PL_files.t2
-rw-r--r--lib/Module/Build/t/add_property.t2
-rw-r--r--lib/Module/Build/t/compat.t54
-rw-r--r--lib/Module/Build/t/debug.t8
-rw-r--r--lib/Module/Build/t/destinations.t3
-rw-r--r--lib/Module/Build/t/help.t4
-rw-r--r--lib/Module/Build/t/install_extra_target.t137
-rw-r--r--lib/Module/Build/t/lib/DistGen.pm215
-rw-r--r--lib/Module/Build/t/lib/MBTest.pm19
-rw-r--r--lib/Module/Build/t/metadata.t5
-rw-r--r--lib/Module/Build/t/metadata2.t2
-rw-r--r--lib/Module/Build/t/runthrough.t27
-rw-r--r--lib/Module/Build/t/script_dist.t1
-rw-r--r--lib/Module/Build/t/tilde.t8
-rw-r--r--lib/Module/Build/t/write_default_maniskip.t5
-rw-r--r--lib/Module/Build/t/xs.t9
44 files changed, 581 insertions, 200 deletions
diff --git a/MANIFEST b/MANIFEST
index ad1a707556..a6194a79d5 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -2624,6 +2624,7 @@ lib/Module/Build/t/extend.t Module::Build
lib/Module/Build/t/ext.t Module::Build
lib/Module/Build/t/files.t Module::Build
lib/Module/Build/t/help.t Module::Build
+lib/Module/Build/t/install_extra_target.t Module::Build tests
lib/Module/Build/t/install.t Module::Build
lib/Module/Build/t/lib/DistGen.pm Module::Build
lib/Module/Build/t/lib/MBTest.pm Module::Build
diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 0c833b030f..62f24d0c64 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1185,7 +1185,7 @@ package Maintainers;
'Module::Build' =>
{
'MAINTAINER' => 'kwilliams',
- 'DISTRIBUTION' => 'DAGOLDEN/Module-Build-0.340201.tar.gz',
+ 'DISTRIBUTION' => 'DAGOLDEN/Module-Build-0.35.tar.gz',
'FILES' => q[lib/Module/Build lib/Module/Build.pm],
'EXCLUDED' => [ qw{ t/par.t t/signature.t scripts/bundle.pl}, ],
'CPAN' => 1,
diff --git a/lib/Module/Build.pm b/lib/Module/Build.pm
index 3859fdec92..be8c1f7079 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.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
# Okay, this is the brute-force method of finding out what kind of
diff --git a/lib/Module/Build/API.pod b/lib/Module/Build/API.pod
index e9a739ed83..f4e4cea09d 100644
--- a/lib/Module/Build/API.pod
+++ b/lib/Module/Build/API.pod
@@ -78,7 +78,9 @@ method.
This parameter determines whether Module::Build will add itself
automatically to configure_requires (and build_requires) if Module::Build
-is not already there. The default value is true.
+is not already there. The required version will be the last 'major' release,
+as defined by the decimal version truncated to two decimal places (e.g. 0.34,
+instead of 0.3402). The default value is true.
=item auto_features
@@ -387,23 +389,24 @@ hash returned by C<args()>. For example:
(
module_name => 'Foo::Bar',
get_options => {
- loud => { store => \$loud },
- dbd => { type => '=s' },
- quantity => { type => '+' },
+ Loud => { store => \$loud },
+ Dbd => { type => '=s' },
+ Quantity => { type => '+' },
}
);
print STDERR "HEY, ARE YOU LISTENING??\n" if $loud;
- print "We'll use the ", $build->args('dbd'), " DBI driver\n";
+ print "We'll use the ", $build->args('Dbd'), " DBI driver\n";
print "Are you sure you want that many?\n"
- if $build->args('quantity') > 2;
+ if $build->args('Quantity') > 2;
The arguments for such a specification can be called like so:
- perl Build.PL --loud --dbd=DBD::pg --quantity --quantity --quantity
+ perl Build.PL --Loud --Dbd=DBD::pg --Quantity --Quantity --Quantity
B<WARNING:> Any option specifications that conflict with Module::Build's own
-options (defined by its properties) will throw an exception.
+options (defined by its properties) will throw an exception. Use capitalized
+option names to avoid unintended conflicts with future Module::Build options.
Consult the Getopt::Long documentation for details on its usage.
@@ -1809,8 +1812,6 @@ accessor methods for the following properties:
=item install_base()
-=item install_sets()
-
=item installdirs()
=item libdoc_dirs()
@@ -1831,8 +1832,6 @@ accessor methods for the following properties:
=item orig_dir()
-=item original_prefix()
-
=item perl()
=item pm_files()
diff --git a/lib/Module/Build/Base.pm b/lib/Module/Build/Base.pm
index ade64c8dec..531c35487e 100644
--- a/lib/Module/Build/Base.pm
+++ b/lib/Module/Build/Base.pm
@@ -4,7 +4,7 @@ package Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
BEGIN { require 5.00503 }
@@ -42,7 +42,6 @@ sub new {
$self->dist_name;
$self->dist_version;
- $self->_set_install_paths;
$self->_find_nested_builds;
return $self;
@@ -86,8 +85,6 @@ sub resume {
$self->{invoked_action} = $self->{action} ||= 'build';
- $self->_set_install_paths;
-
return $self;
}
@@ -208,10 +205,12 @@ sub log_warn {
}
-sub _set_install_paths {
+# install paths must be generated when requested to be sure all changes
+# to config (from various sources) are included
+sub _default_install_paths {
my $self = shift;
my $c = $self->{config};
- my $p = $self->{properties};
+ my $p = {};
my @libstyle = $c->get('installstyle') ?
File::Spec->splitdir($c->get('installstyle')) : qw(lib perl5);
@@ -318,7 +317,7 @@ sub _set_install_paths {
libhtml => ['html'],
},
};
-
+ return $p
}
sub _find_nested_builds {
@@ -1839,6 +1838,8 @@ sub _detildefy {}
sub _merge_arglist {
my( $self, $opts1, $opts2 ) = @_;
+ $opts1 ||= {};
+ $opts2 ||= {};
my %new_opts = %$opts1;
while (my ($key, $val) = each %$opts2) {
if ( exists( $opts1->{$key} ) ) {
@@ -2738,7 +2739,8 @@ sub manify_bin_pods {
my $outfile = File::Spec->catfile($mandir, $manpage);
next if $self->up_to_date( $file, $outfile );
$self->log_info("Manifying $file -> $outfile\n");
- $parser->parse_from_file( $file, $outfile );
+ eval { $parser->parse_from_file( $file, $outfile ); 1 }
+ or $self->log_warn("Error creating '$outfile': $@\n");
$files->{$file} = $outfile;
}
}
@@ -2762,7 +2764,8 @@ sub manify_lib_pods {
my $outfile = File::Spec->catfile( $mandir, $manpage);
next if $self->up_to_date( $file, $outfile );
$self->log_info("Manifying $file -> $outfile\n");
- $parser->parse_from_file( $file, $outfile );
+ eval { $parser->parse_from_file( $file, $outfile ); 1 }
+ or $self->log_warn("Error creating '$outfile': $@\n");
$files->{$file} = $outfile;
}
}
@@ -3754,7 +3757,8 @@ sub prepare_metadata {
&& $self->auto_configure_requires
&& ! exists $prereq_types{'configure_requires'}{'Module::Build'}
) {
- $prereq_types{configure_requires}{'Module::Build'} = $VERSION;
+ (my $ver = $VERSION) =~ s/^(\d+\.\d\d).*$/$1/; # last major release only
+ $prereq_types{configure_requires}{'Module::Build'} = $ver;
}
for my $t ( keys %prereq_types ) {
@@ -3976,7 +3980,10 @@ sub make_tarball {
$self->do_system($self->split_like_shell($self->{args}{tar}), $tar_flags, "$file.tar", $dir);
$self->do_system($self->split_like_shell($self->{args}{gzip}), "$file.tar") if $self->{args}{gzip};
} else {
- require Archive::Tar;
+ eval { require Archive::Tar && Archive::Tar->VERSION(1.08); 1 }
+ or die "You must install Archive::Tar to make a distribution tarball\n".
+ "or specify a binary tar program with the '--tar' option.\n".
+ "See the documentation for the 'dist' action.\n";
# Archive::Tar versions >= 1.09 use the following to enable a compatibility
# hack so that the resulting archive is compatible with older clients.
@@ -4018,73 +4025,118 @@ sub install_path {
return $map->{$type} = $value;
}
+sub install_sets {
+ # Usage: install_sets('site'), install_sets('site', 'lib'),
+ # or install_sets('site', 'lib' => $value);
+ my ($self, $dirs, $key, $value) = @_;
+ $dirs = $self->installdirs unless defined $dirs;
+ # update property before merging with defaults
+ if ( @_ == 4 && defined $dirs && defined $key) {
+ # $value can be undef; will mask default
+ $self->{properties}{install_sets}{$dirs}{$key} = $value;
+ }
+ my $map = { $self->_merge_arglist(
+ $self->{properties}{install_sets},
+ $self->_default_install_paths->{install_sets}
+ )};
+ if ( defined $dirs && defined $key ) {
+ return $map->{$dirs}{$key};
+ }
+ elsif ( defined $dirs ) {
+ return $map->{$dirs};
+ }
+ else {
+ croak "Can't determine installdirs for install_sets()";
+ }
+}
+
+sub original_prefix {
+ # Usage: original_prefix(), original_prefix('lib'),
+ # or original_prefix('lib' => $value);
+ my ($self, $key, $value) = @_;
+ # update property before merging with defaults
+ if ( @_ == 3 && defined $key) {
+ # $value can be undef; will mask default
+ $self->{properties}{original_prefix}{$key} = $value;
+ }
+ my $map = { $self->_merge_arglist(
+ $self->{properties}{original_prefix},
+ $self->_default_install_paths->{original_prefix}
+ )};
+ return $map unless defined $key;
+ return $map->{$key}
+}
+
sub install_base_relpaths {
# Usage: install_base_relpaths(), install_base_relpaths('lib'),
# or install_base_relpaths('lib' => $value);
my $self = shift;
- my $map = $self->{properties}{install_base_relpaths};
+ if ( @_ > 1 ) { # change values before merge
+ $self->_set_relpaths($self->{properties}{install_base_relpaths}, @_);
+ }
+ my $map = { $self->_merge_arglist(
+ $self->{properties}{install_base_relpaths},
+ $self->_default_install_paths->{install_base_relpaths}
+ )};
return $map unless @_;
- return $self->_relpaths($map, @_);
+ my $relpath = $map->{$_[0]};
+ return defined $relpath ? File::Spec->catdir( @$relpath ) : undef;
}
-
-# Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
-sub prefix_relative {
- my ($self, $type) = @_;
- my $installdirs = $self->installdirs;
-
- my $relpath = $self->install_sets($installdirs)->{$type};
-
- return $self->_prefixify($relpath,
- $self->original_prefix($installdirs),
- $type,
- );
+# Defaults to use in case the config install paths cannot be prefixified.
+sub prefix_relpaths {
+ # Usage: prefix_relpaths('site'), prefix_relpaths('site', 'lib'),
+ # or prefix_relpaths('site', 'lib' => $value);
+ my $self = shift;
+ my $installdirs = shift || $self->installdirs
+ or croak "Can't determine installdirs for prefix_relpaths()";
+ if ( @_ > 1 ) { # change values before merge
+ $self->{properties}{prefix_relpaths}{$installdirs} ||= {};
+ $self->_set_relpaths($self->{properties}{prefix_relpaths}{$installdirs}, @_);
+ }
+ my $map = {$self->_merge_arglist(
+ $self->{properties}{prefix_relpaths}{$installdirs},
+ $self->_default_install_paths->{prefix_relpaths}{$installdirs}
+ )};
+ return $map unless @_;
+ my $relpath = $map->{$_[0]};
+ return defined $relpath ? File::Spec->catdir( @$relpath ) : undef;
}
-sub _relpaths {
+sub _set_relpaths {
my $self = shift;
- my( $map, $type, $value ) = ( @_, '<empty>' );
+ my( $map, $type, $value ) = @_;
Carp::croak( 'Type argument missing' )
unless defined( $type );
- my @value = ();
-
- # delete existing value if $value is literal undef()
- unless ( defined( $value ) ) {
- delete( $map->{$type} );
- return undef;
- }
-
- # return existing value if no new $value is given
- elsif ( $value eq '<empty>' ) {
- return undef unless exists $map->{$type};
- @value = @{ $map->{$type} };
+ # set undef if $value is literal undef()
+ if ( ! defined( $value ) ) {
+ $map->{$type} = undef;
+ return;
}
-
# set value if $value is a valid relative path
else {
Carp::croak( "Value must be a relative path" )
if File::Spec::Unix->file_name_is_absolute($value);
- @value = split( /\//, $value );
+ my @value = split( /\//, $value );
$map->{$type} = \@value;
}
-
- return File::Spec->catdir( @value );
}
-# Defaults to use in case the config install paths cannot be prefixified.
-sub prefix_relpaths {
- # Usage: prefix_relpaths('site'), prefix_relpaths('site', 'lib'),
- # or prefix_relpaths('site', 'lib' => $value);
- my $self = shift;
- my $installdirs = shift || $self->installdirs;
- my $map = $self->{properties}{prefix_relpaths}{$installdirs};
- return $map unless @_;
- return $self->_relpaths($map, @_);
-}
+# Translated from ExtUtils::MM_Any::init_INSTALL_from_PREFIX
+sub prefix_relative {
+ my ($self, $type) = @_;
+ my $installdirs = $self->installdirs;
+ my $relpath = $self->install_sets($installdirs)->{$type};
+
+ return $self->_prefixify($relpath,
+ $self->original_prefix($installdirs),
+ $type,
+ );
+}
# Translated from ExtUtils::MM_Unix::prefixify()
sub _prefixify {
diff --git a/lib/Module/Build/Changes b/lib/Module/Build/Changes
index 9ef9eaec01..df66502dbd 100644
--- a/lib/Module/Build/Changes
+++ b/lib/Module/Build/Changes
@@ -1,5 +1,48 @@
Revision history for Perl extension Module::Build.
+0.35 - Thu Aug 27 09:12:02 EDT 2009
+
+ Bug fixes:
+ - Fix t/destinations.t segfault on 5.6.2
+
+0.34_06 - Sat Aug 22 21:58:26 EDT 2009
+
+ Bug fixes:
+ - Multiple test fixes for OS2 [Ilya Zakharevich]
+ - Generated.ppd files use :utf8 if possible (RT#48827) [Olivier Mengue]
+ - Fixed preservation of custom install_paths on resume (RT#41166)
+ [David Golden]
+ - Warn instead of crashing when Pod::Man tries to create files with
+ colons on vfat partitions on unix (RT#45544) [David Golden]
+
+0.34_05 - Sun Aug 9 22:31:37 EDT 2009
+
+ Bug fixes:
+ - When auto_configure_requires is true (the default), Module::Build will
+ only add last 'major' version of Module:Build (e.g. 0.XX) to
+ configure_requires to avoid specifying a minor development release not
+ available on CPAN [David Golden]
+
+0.34_04 - Sat Aug 8 11:02:24 EDT 2009
+
+ Other:
+ - Added documentation warning that 'get_options' should be capitalized
+ to avoid conflicting with future Module::Build options and changed
+ the examples accordingly.
+
+0.34_03 - Sat Aug 8 07:39:16 EDT 2009
+
+ Bug fixes:
+ - Fixed failing xs.t if /tmp is mounted noexec (RT#47331) [David Golden]
+ - Fixed failing debug.t on VMS (RT#48362) [Craig Berry]
+ - Prevent par.t from dying on error in .zip extraction [David Golden]
+ - Fixed potential runthrough.t failure on 5.6.2 [David Golden]
+
+ Other:
+ - Archive::Tar changed from 'requires' to 'recommends' so non-authors
+ without IO::Zlib can still use Module::Build to install modules
+ [reported by Matt Trout, fix by David Golden]
+
0.340201 - Sun Aug 9 22:11:04 EDT 2009
Other:
@@ -9,7 +52,7 @@ Revision history for Perl extension Module::Build.
Bug-fixes:
- Bundled Module::Build::Version updated to bring into sync with CPAN
- version.pm 0.77
+ version.pm 0.77 [John Peacock]
0.34_01 - Sat Jul 18 16:32:09 EDT 2009
diff --git a/lib/Module/Build/Compat.pm b/lib/Module/Build/Compat.pm
index 58bed056d3..dfe75d5e1a 100644
--- a/lib/Module/Build/Compat.pm
+++ b/lib/Module/Build/Compat.pm
@@ -2,7 +2,7 @@ package Module::Build::Compat;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
use File::Basename ();
use File::Spec;
@@ -318,7 +318,9 @@ sub fake_makefile {
my $unlink = $class->oneliner('1 while unlink $ARGV[0]', [], [$args{makefile}]);
$unlink =~ s/\$/\$\$/g unless $class->is_vmsish;
- my $maketext = <<"EOF";
+ my $maketext = ($^O eq 'os2' ? "SHELL = sh\n\n" : '');
+
+ $maketext .= <<"EOF";
all : force_do_it
$perl $Build
realclean : force_do_it
diff --git a/lib/Module/Build/Config.pm b/lib/Module/Build/Config.pm
index c153f023c3..de8b44d092 100644
--- a/lib/Module/Build/Config.pm
+++ b/lib/Module/Build/Config.pm
@@ -2,7 +2,7 @@ package Module::Build::Config;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Config;
diff --git a/lib/Module/Build/Cookbook.pm b/lib/Module/Build/Cookbook.pm
index 300e79c21b..82c8e01d67 100644
--- a/lib/Module/Build/Cookbook.pm
+++ b/lib/Module/Build/Cookbook.pm
@@ -1,7 +1,7 @@
package Module::Build::Cookbook;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
=head1 NAME
diff --git a/lib/Module/Build/Dumper.pm b/lib/Module/Build/Dumper.pm
index 08ff42f728..1cd8cd0e16 100644
--- a/lib/Module/Build/Dumper.pm
+++ b/lib/Module/Build/Dumper.pm
@@ -1,7 +1,7 @@
package Module::Build::Dumper;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
# This is just a split-out of a wrapper function to do Data::Dumper
# stuff "the right way". See:
diff --git a/lib/Module/Build/ModuleInfo.pm b/lib/Module/Build/ModuleInfo.pm
index 8df58b3bfa..4de09b4c68 100644
--- a/lib/Module/Build/ModuleInfo.pm
+++ b/lib/Module/Build/ModuleInfo.pm
@@ -8,7 +8,7 @@ package Module::Build::ModuleInfo;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use File::Spec;
diff --git a/lib/Module/Build/Notes.pm b/lib/Module/Build/Notes.pm
index 72bde6c933..fe98419759 100644
--- a/lib/Module/Build/Notes.pm
+++ b/lib/Module/Build/Notes.pm
@@ -4,7 +4,7 @@ package Module::Build::Notes;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Data::Dumper;
use IO::File;
diff --git a/lib/Module/Build/PPMMaker.pm b/lib/Module/Build/PPMMaker.pm
index 588c799ccc..35b5a75317 100644
--- a/lib/Module/Build/PPMMaker.pm
+++ b/lib/Module/Build/PPMMaker.pm
@@ -2,7 +2,7 @@ package Module::Build::PPMMaker;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
@@ -113,6 +113,7 @@ EOF
my $ppd_file = "$dist{name}.ppd";
my $fh = IO::File->new(">$ppd_file")
or die "Cannot write to $ppd_file: $!";
+ $fh->binmode(":utf8") if $fh->can("binmode");
print $fh $ppd;
close $fh;
diff --git a/lib/Module/Build/Platform/Amiga.pm b/lib/Module/Build/Platform/Amiga.pm
index 34002db208..5ce8cf58a2 100644
--- a/lib/Module/Build/Platform/Amiga.pm
+++ b/lib/Module/Build/Platform/Amiga.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::Amiga;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/Default.pm b/lib/Module/Build/Platform/Default.pm
index 04cbcd7e94..df29af5f68 100644
--- a/lib/Module/Build/Platform/Default.pm
+++ b/lib/Module/Build/Platform/Default.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::Default;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/EBCDIC.pm b/lib/Module/Build/Platform/EBCDIC.pm
index be8bae7ee8..d68836c1a3 100644
--- a/lib/Module/Build/Platform/EBCDIC.pm
+++ b/lib/Module/Build/Platform/EBCDIC.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::EBCDIC;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/MPEiX.pm b/lib/Module/Build/Platform/MPEiX.pm
index 90adff5520..a835c30d49 100644
--- a/lib/Module/Build/Platform/MPEiX.pm
+++ b/lib/Module/Build/Platform/MPEiX.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::MPEiX;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/MacOS.pm b/lib/Module/Build/Platform/MacOS.pm
index a3556758f3..9c9281adac 100644
--- a/lib/Module/Build/Platform/MacOS.pm
+++ b/lib/Module/Build/Platform/MacOS.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::MacOS;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
use vars qw(@ISA);
diff --git a/lib/Module/Build/Platform/RiscOS.pm b/lib/Module/Build/Platform/RiscOS.pm
index c039eca35a..c240750c46 100644
--- a/lib/Module/Build/Platform/RiscOS.pm
+++ b/lib/Module/Build/Platform/RiscOS.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::RiscOS;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/Unix.pm b/lib/Module/Build/Platform/Unix.pm
index 579b6254b2..879ca3ad4e 100644
--- a/lib/Module/Build/Platform/Unix.pm
+++ b/lib/Module/Build/Platform/Unix.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/VMS.pm b/lib/Module/Build/Platform/VMS.pm
index 102bc5f548..3305154b2d 100644
--- a/lib/Module/Build/Platform/VMS.pm
+++ b/lib/Module/Build/Platform/VMS.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::VMS;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/VOS.pm b/lib/Module/Build/Platform/VOS.pm
index b35e7956b6..be46a80416 100644
--- a/lib/Module/Build/Platform/VOS.pm
+++ b/lib/Module/Build/Platform/VOS.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::VOS;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Base;
diff --git a/lib/Module/Build/Platform/Windows.pm b/lib/Module/Build/Platform/Windows.pm
index d70563ff89..6cf9da9cc3 100644
--- a/lib/Module/Build/Platform/Windows.pm
+++ b/lib/Module/Build/Platform/Windows.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::Windows;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Config;
diff --git a/lib/Module/Build/Platform/aix.pm b/lib/Module/Build/Platform/aix.pm
index 0caa376272..45feb3cdd4 100644
--- a/lib/Module/Build/Platform/aix.pm
+++ b/lib/Module/Build/Platform/aix.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::aix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
diff --git a/lib/Module/Build/Platform/cygwin.pm b/lib/Module/Build/Platform/cygwin.pm
index f73ce958aa..62a6461ce2 100644
--- a/lib/Module/Build/Platform/cygwin.pm
+++ b/lib/Module/Build/Platform/cygwin.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::cygwin;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
diff --git a/lib/Module/Build/Platform/darwin.pm b/lib/Module/Build/Platform/darwin.pm
index 6ba7cb9a54..39e9e36911 100644
--- a/lib/Module/Build/Platform/darwin.pm
+++ b/lib/Module/Build/Platform/darwin.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::darwin;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
diff --git a/lib/Module/Build/Platform/os2.pm b/lib/Module/Build/Platform/os2.pm
index a0c5fd5abd..ace01a3291 100644
--- a/lib/Module/Build/Platform/os2.pm
+++ b/lib/Module/Build/Platform/os2.pm
@@ -2,7 +2,7 @@ package Module::Build::Platform::os2;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
diff --git a/lib/Module/Build/PodParser.pm b/lib/Module/Build/PodParser.pm
index d4e1822c4c..b17b80b189 100644
--- a/lib/Module/Build/PodParser.pm
+++ b/lib/Module/Build/PodParser.pm
@@ -2,7 +2,7 @@ package Module::Build::PodParser;
use strict;
use vars qw($VERSION);
-$VERSION = '0.340201';
+$VERSION = '0.35';
$VERSION = eval $VERSION;
use vars qw(@ISA);
diff --git a/lib/Module/Build/t/PL_files.t b/lib/Module/Build/t/PL_files.t
index b359e100b3..4d0e13fd47 100644
--- a/lib/Module/Build/t/PL_files.t
+++ b/lib/Module/Build/t/PL_files.t
@@ -82,5 +82,5 @@ END
my %cleanup = map { $_ => 1 } $mb->cleanup;
is($cleanup{foo}, undef, "generated special file not added to cleanup");
-
+ $dist->chdir_original if $dist->did_chdir;
}
diff --git a/lib/Module/Build/t/add_property.t b/lib/Module/Build/t/add_property.t
index ed18eb946c..c1c11c4871 100644
--- a/lib/Module/Build/t/add_property.t
+++ b/lib/Module/Build/t/add_property.t
@@ -91,3 +91,5 @@ eval { $build->installdirs('foo') };
ok $err = $@, 'Should catch exception for invalid "installdirs" value';
like $err, qr/ERROR: installdirs must be one of "core", "site", or "vendor"/,
'And it should suggest the proper values in the error message';
+
+$dist->chdir_original if $dist->did_chdir;
diff --git a/lib/Module/Build/t/compat.t b/lib/Module/Build/t/compat.t
index 0b42923a48..b529cfa2e6 100644
--- a/lib/Module/Build/t/compat.t
+++ b/lib/Module/Build/t/compat.t
@@ -216,28 +216,46 @@ ok $mb, "Module::Build->new_from_context";
my $libarch2 = File::Spec->catdir($libdir2, 'arch');
SKIP: {
+ my @cases = (
+ {
+ label => "INSTALLDIRS=vendor",
+ args => [ 'INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", "INSTALLVENDORARCH=$libarch2"],
+ check => qr/\Q$libdir2\E .* Simple\.pm/ix,
+ },
+ {
+ label => "PREFIX=\$libdir2",
+ args => [ "PREFIX=$libdir2"],
+ check => qr/\Q$libdir2\E .* Simple\.pm/ix,
+ },
+ {
+ label => "PREFIX=\$libdir2 LIB=mylib",
+ args => [ "PREFIX=$libdir2", "LIB=mylib" ],
+ check => qr{\Q$libdir2\E[/\\]mylib[/\\]Simple\.pm}ix,
+ },
+ );
+
require ExtUtils::Install;
- skip "Needs ExtUtils::Install 1.32 or later", 2
+ skip "Needs ExtUtils::Install 1.32 or later", 2 * @cases
if ExtUtils::Install->VERSION < 1.32;
- my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2", "INSTALLVENDORARCH=$libarch2");
-
- if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
- $make_args[0] = '/macro=("' . join('","',@make_args) . '")';
- pop @make_args while scalar(@make_args) > 1;
- }
-
- ($output) = stdout_stderr_of(
- sub {
- $ran_ok = $mb->do_system(@make, 'fakeinstall', @make_args);
+ for my $c (@cases) {
+ my @make_args = @{$c->{args}};
+ if ($is_vms_mms) { # VMS MMK/MMS macros use different syntax.
+ $make_args[0] = '/macro=("' . join('","',@make_args) . '")';
+ pop @make_args while scalar(@make_args) > 1;
}
- );
-
- ok $ran_ok, "make fakeinstall with INSTALLDIRS=vendor ran ok";
- $output =~ s/^/# /gm; # Don't confuse our own test output
- like $output,
- qr/\Q$libdir2\E .* Simple\.pm/ix,
- 'Should have installdirs=vendor';
+ ($output) = stdout_stderr_of(
+ sub {
+ $result = $mb->run_perl_script('Makefile.PL', [], \@make_args);
+ $ran_ok = $mb->do_system(@make, 'fakeinstall');
+ }
+ );
+
+ ok $ran_ok, "fakeinstall $c->{label} ran ok";
+ $output =~ s/^/# /gm; # Don't confuse our own test output
+ like $output, $c->{check},
+ "Saw destination directory for $c->{label}";
+ }
}
stdout_of( sub { $mb->do_system(@make, 'realclean'); } );
diff --git a/lib/Module/Build/t/debug.t b/lib/Module/Build/t/debug.t
index decce51afe..7146e6636a 100644
--- a/lib/Module/Build/t/debug.t
+++ b/lib/Module/Build/t/debug.t
@@ -21,12 +21,8 @@ $dist->chdir_in;
# Test debug output
{
my $output;
- $output = stdout_of sub {
- Module::Build->run_perl_script('Build.PL', [], [])
- };
- $output = stdout_of sub {
- Module::Build->run_perl_script('Build', [], ['--debug'])
- };
+ $output = stdout_of sub { $dist->run_build_pl };
+ $output = stdout_of sub { $dist->run_build('--debug') };
like($output, '/Starting ACTION_build.*?Starting ACTION_code.*?Finished ACTION_code.*?Finished ACTION_build/ms',
"found nested ACTION_* debug statements"
);
diff --git a/lib/Module/Build/t/destinations.t b/lib/Module/Build/t/destinations.t
index 5319afd594..1c6705ff02 100644
--- a/lib/Module/Build/t/destinations.t
+++ b/lib/Module/Build/t/destinations.t
@@ -248,13 +248,14 @@ $mb->prefix(undef);
}
# Poke at the innards of MB to change the default install locations.
- local $mb->install_sets->{site} = \%test_config;
+ my $old = $mb->install_sets->{site} = \%test_config;
$mb->config(siteprefixexp => catdir(File::Spec->rootdir,
'wierd', 'prefix'));
my $prefix = catdir('another', 'prefix');
$mb->prefix($prefix);
test_prefix($prefix, \%test_config);
+ $mb->install_sets->{site} = $old;
}
diff --git a/lib/Module/Build/t/help.t b/lib/Module/Build/t/help.t
index 18fb082adc..201e5ae416 100644
--- a/lib/Module/Build/t/help.t
+++ b/lib/Module/Build/t/help.t
@@ -22,7 +22,7 @@ $dist->regen;
my $restart = sub {
$dist->clean();
- chdir( $cwd );
+ DistGen::chdir_all( $cwd );
File::Path::rmtree( $tmp );
# we're redefining the same package as we go, so...
delete($::{'MyModuleBuilder::'});
@@ -274,7 +274,7 @@ is($mb->get_action_docs('batz'), undef, 'nothing after uplevel');
# cleanup
$dist->clean();
-chdir( $cwd );
+DistGen::chdir_all($cwd);
File::Path::rmtree( $tmp );
# vim:ts=2:sw=2:et:sta
diff --git a/lib/Module/Build/t/install_extra_target.t b/lib/Module/Build/t/install_extra_target.t
new file mode 100644
index 0000000000..23e9d11a37
--- /dev/null
+++ b/lib/Module/Build/t/install_extra_target.t
@@ -0,0 +1,137 @@
+#!perl -w
+# Contributed by: Thorben Jaendling
+
+use strict;
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest tests => 8;
+
+require_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+use File::Spec::Functions qw( catdir );
+
+my $tmp = MBTest->tmpdir;
+my $output;
+
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+
+# note("Dist is in $tmp\n");
+
+$dist->add_file("Build.PL", <<'===EOF===');
+#!perl -w
+
+use strict;
+use Module::Build;
+
+my $subclass = Module::Build->subclass(code => <<'=EOF=');
+sub copy_files
+{
+ my $self = shift;
+ my $dir = shift;
+
+ my $files = $self->rscan_dir($dir, sub {-f $_ and not m!/\.|[#~]$!});
+
+ foreach my $file (@$files) {
+ $self->copy_if_modified(from => $file, to_dir => "blib");
+ }
+}
+
+#Copy etc files to blib
+sub process_etc_files
+{
+ my $self = shift;
+
+ $self->copy_files("etc");
+}
+
+#Copy share files to blib
+sub process_share_files
+{
+ my $self = shift;
+
+ $self->copy_files("share");
+}
+
+1;
+=EOF=
+
+my $build = $subclass->new(
+ module_name => 'Simple',
+ license => 'perl'
+);
+
+$build->add_build_element('etc');
+$build->add_build_element('share');
+
+my $distdir = lc $build->dist_name();
+
+foreach my $id ('core', 'site', 'vendor') {
+ #Where to install these build types when using prefix symantics
+ $build->prefix_relpaths($id, 'share' => "share/$distdir");
+ $build->prefix_relpaths($id, 'etc' => "etc/$distdir");
+
+ #Where to install these build types when using default symantics
+ my $set = $build->install_sets($id);
+ $set->{'share'} = '/usr/'.($id eq 'site' ? 'local/':'')."share/$distdir";
+ $set->{'etc'} = ($id eq 'site' ? '/usr/local/etc/':'/etc/').$distdir;
+}
+
+#Where to install these types when using install_base symantics
+$build->install_base_relpaths('share' => "share/$distdir");
+$build->install_base_relpaths('etc' => "etc/$distdir");
+
+$build->create_build_script();
+
+===EOF===
+
+#Test Build.PL exists ok?
+
+$dist->add_file("etc/config", <<'===EOF===');
+[main]
+Foo = bar
+Jim = bob
+
+[supplemental]
+stardate = 1234344
+
+===EOF===
+
+$dist->add_file("share/data", <<'===EOF===');
+7 * 9 = 42?
+
+===EOF===
+
+$dist->add_file("share/html/index.html", <<'===EOF===');
+<HTML>
+ <BODY>
+ <H1>Hello World!</H1>
+ </BODY>
+</HTML>
+
+===EOF===
+
+$dist->regen;
+$dist->chdir_in;
+
+my $installdest = catdir($tmp, 't', "install_extra_targets-$$");
+
+$output = stdout_of sub { $dist->run_build_pl("--install_base=$installdest") };
+
+$output .= stdout_of sub { $dist->run_build };
+
+my $error;
+$error++ unless ok(-e "blib/etc/config", "Built etc/config");
+$error++ unless ok(-e "blib/share/data", "Built share/data");
+$error++ unless ok(-e "blib/share/html/index.html", "Built share/html");
+diag "OUTPUT:\n$output" if $error;
+
+$output = stdout_of sub { $dist->run_build('install') };
+
+$error = 0;
+$error++ unless ok(-e "$installdest/etc/simple/config", "installed etc/config");
+$error++ unless ok(-e "$installdest/share/simple/data", "installed share/data");
+$error++ unless ok(-e "$installdest/share/simple/html/index.html", "installed share/html");
+diag "OUTPUT:\n$output" if $error;
+
+$dist->remove();
diff --git a/lib/Module/Build/t/lib/DistGen.pm b/lib/Module/Build/t/lib/DistGen.pm
index c3fc162627..86ee794f3b 100644
--- a/lib/Module/Build/t/lib/DistGen.pm
+++ b/lib/Module/Build/t/lib/DistGen.pm
@@ -62,6 +62,13 @@ sub undent {
return($string);
}
+
+sub chdir_all ($) {
+ # OS/2 has "current directory per disk", undeletable;
+ # doing chdir() to another disk won't change cur-dir of initial disk...
+ chdir('/') if $^O eq 'os2';
+ chdir shift;
+}
########################################################################
sub new {
@@ -72,7 +79,7 @@ sub new {
$options{dir} ||= Cwd::cwd();
my %data = (
- skip_manifest => 0,
+ no_manifest => 0,
xs => 0,
%options,
);
@@ -286,7 +293,7 @@ sub regen {
my $real_filename = $self->_real_filename( $file );
my $fullname = File::Spec->catfile( $dist_dirname, $real_filename );
if ( -e $fullname ) {
- 1 while unlink( $fullname );
+ 1 while unlink( $fullname );
}
print "Unlinking pending file '$file'\n" if $VERBOSE;
delete( $self->{pending}{remove}{$file} );
@@ -297,8 +304,8 @@ sub regen {
my $real_filename = $self->_real_filename( $file );
my $fullname = File::Spec->catfile( $dist_dirname, $real_filename );
- if ( ! -e $fullname ||
- ( -e $fullname && $self->{pending}{change}{$file} ) ) {
+ if ( ! -e $fullname ||
+ ( -e $fullname && $self->{pending}{change}{$file} ) ) {
print "Changed file '$file'.\n" if $VERBOSE;
@@ -326,7 +333,7 @@ sub regen {
}
my $manifest = File::Spec->catfile( $dist_dirname, 'MANIFEST' );
- unless ( $self->{skip_manifest} ) {
+ unless ( $self->{no_manifest} ) {
if ( -e $manifest ) {
1 while unlink( $manifest );
}
@@ -388,7 +395,7 @@ sub clean {
}
}, ($^O eq 'VMS' ? './' : File::Spec->curdir) );
- chdir( $here );
+ chdir_all( $here );
}
sub remove {
@@ -478,10 +485,23 @@ sub chdir_original {
croak("never called chdir_in()") unless($self->{original_dir});
my $dir = $self->{original_dir};
- chdir($dir) or die "Can't chdir to '$dir': $!";
+ chdir_all($dir) or die "Can't chdir to '$dir': $!";
}
########################################################################
+sub run_build_pl {
+ my ($self, @args) = @_;
+ require Module::Build;
+ Module::Build->run_perl_script('Build.PL', [], [@args])
+}
+
+sub run_build {
+ my ($self, @args) = @_;
+ require Module::Build;
+ my $build_script = $^O eq 'VMS' ? 'Build.com' : 'Build';
+ Module::Build->run_perl_script($build_script, [], [@args])
+}
+
1;
__END__
@@ -495,20 +515,59 @@ DistGen - Creates simple distributions for testing.
use DistGen;
- my $dist = DistGen->new(dir => $tmp);
- ...
+ # create distribution and prepare to test
+ my $dist = DistGen->new(name => 'Foo::Bar', dir => $tmp);
+ $dist->regen;
+ $dist->chdir_in;
+
+ # change distribution files
$dist->add_file('t/some_test.t', $contents);
- ...
+ $dist->change_file('MANIFEST.SKIP', $new_contents);
+ $dist->remove_file('t/some_test.t');
$dist->regen;
- chdir($dist->dirname) or
- die "Cannot chdir to '@{[$dist->dirname]}': $!";
- ...
+ # clean up extraneous files
$dist->clean;
- ...
- chdir($cwd) or die "cannot return to $cwd";
+
+ # exercise the command-line interface
+ $dist->run_build_pl();
+ $dist->run_build('test');
+
+ # finish testing and clean up
+ $dist->chdir_original;
$dist->remove;
+=head1 USAGE
+
+A DistGen object manages a set of files in a distribution directory.
+
+The constructor and some methods only define the target state of the
+distribution. They do B<not> make any changes to the filesystem:
+
+ new
+ add_file
+ change_file
+ change_build_pl
+ remove_file
+
+Other methods then change the filesystem to match the target state of
+the distribution (or to remove it entirely):
+
+ regen
+ clean
+ remove
+
+Other methods are provided for a convenience during testing. The
+most important are ones that manage the current directory:
+
+ chdir_in
+ chdir_original
+
+Additional methods portably encapsulate running Build.PL and Build:
+
+ run_build_pl
+ run_build
+
=head1 API
=head2 Constructor
@@ -519,9 +578,10 @@ Create a new object. Does not write its contents (see L</regen()>.)
my $tmp = MBTest->tmpdir;
my $dist = DistGen->new(
- name => 'Foo::Bar',
- dir => $tmp,
- xs => 1,
+ name => 'Foo::Bar',
+ dir => $tmp,
+ xs => 1,
+ no_manifest => 0,
);
The parameters are as follows.
@@ -544,33 +604,84 @@ under this according to the "dist" form of C<name> (e.g. "Foo-Bar".)
If true, generates an XS based module.
+=item no_manifest
+
+If true, C<regen()> will not create a MANIFEST file.
+
=back
-=head2 Manipulating the Distribution
+The following files are added as part of the default distribution:
-These methods immediately affect the filesystem.
+ Build.PL
+ lib/Simple.pm # based on name parameter
+ t/basic.t
-=head3 regen()
+If an XS module is generated, Simple.pm and basic.t are different and
+the following files are also added:
-Regenerate all missing or changed files.
+ typemap
+ lib/Simple.xs # based on name parameter
- $dist->regen(clean => 1);
+=head2 Adding and editing files
-If the optional C<clean> argument is given, it also removes any
-extraneous files that do not belong to the distribution.
+Note that C<$filename> should always be specified with unix-style paths,
+and are relative to the distribution root directory, e.g. C<lib/Module.pm>.
-=head2 chdir_in
+No changes are made to the filesystem until the distribution is regenerated.
-Change directory into the dist root.
+=head3 add_file()
- $dist->chdir_in;
+Add a $filename containing $content to the distribution.
-=head2 chdir_original
+ $dist->add_file( $filename, $content );
-Returns to whatever directory you were in before chdir_in() (regardless
-of the cwd.)
+=head3 change_file()
- $dist->chdir_original;
+Changes the contents of $filename to $content. No action is performed
+until the distribution is regenerated.
+
+ $dist->change_file( $filename, $content );
+
+=head3 change_build_pl()
+
+A wrapper around change_file specifically for setting Build.PL. Instead
+of file C<$content>, it takes a hash-ref of Module::Build constructor
+arguments:
+
+ $dist->change_build_pl(
+ {
+ module_name => $dist->name,
+ dist_version => '3.14159265',
+ license => 'perl',
+ create_readme => 1,
+ }
+ );
+
+=head3 get_file
+
+Retrieves the target contents of C<$filename>.
+
+ $content = $dist->get_file( $filename );
+
+=head3 remove_file()
+
+Removes C<$filename> from the distribution.
+
+ $dist->remove_file( $filename );
+
+=head2 Changing the distribution directory
+
+These methods immediately affect the filesystem.
+
+=head3 regen()
+
+Regenerate all missing or changed files. Also deletes any files
+flagged for removal with remove_file().
+
+ $dist->regen(clean => 1);
+
+If the optional C<clean> argument is given, it also removes any
+extraneous files that do not belong to the distribution.
=head3 clean()
@@ -595,31 +706,41 @@ the built-in files.
Removes the entire distribution directory.
-=head2 Editing Files
+=head2 Changing directories
-Note that C<$filename> should always be specified with unix-style paths,
-and are relative to the distribution root directory, e.g. C<lib/Module.pm>.
+=head3 chdir_in
-No filesystem action is performed until the distribution is regenerated.
+Change directory into the dist root.
-=head3 add_file()
+ $dist->chdir_in;
-Add a $filename containing $content to the distribution.
+=head3 chdir_original
- $dist->add_file( $filename, $content );
+Returns to whatever directory you were in before chdir_in() (regardless
+of the cwd.)
-=head3 remove_file()
+ $dist->chdir_original;
-Removes C<$filename> from the distribution.
+=head2 Command-line helpers
- $dist->remove_file( $filename );
+These use Module::Build->run_perl_script() to ensure that Build.PL or Build are
+run in a separate process using the current perl interpreter. (Module::Build
+is loaded on demand). They also ensure appropriate naming for operating
+systems that require a suffix for Build.
-=head3 change_file()
+=head3 run_build_pl
-Changes the contents of $filename to $content. No action is performed
-until the distribution is regenerated.
+Runs Build.PL using the current perl interpreter. Any arguments are
+passed on the command line.
- $dist->change_file( $filename, $content );
+ $dist->run_build_pl('--quiet');
+
+=head3 run_build
+
+Runs Build using the current perl interpreter. Any arguments are
+passed on the command line.
+
+ $dist->run_build(qw/test --verbose/);
=head2 Properties
@@ -627,6 +748,8 @@ until the distribution is regenerated.
Returns the name of the distribution.
+ $dist->name: # e.g. Foo::Bar
+
=head3 dirname()
Returns the directory where the distribution is created.
diff --git a/lib/Module/Build/t/lib/MBTest.pm b/lib/Module/Build/t/lib/MBTest.pm
index 291b196be0..42f6eb6ce2 100644
--- a/lib/Module/Build/t/lib/MBTest.pm
+++ b/lib/Module/Build/t/lib/MBTest.pm
@@ -123,8 +123,10 @@ __PACKAGE__->export(scalar caller, @extra_exports);
# Setup a temp directory
sub tmpdir {
+ my ($self, $usr_tmp) = @_;
return File::Temp::tempdir( 'MB-XXXXXXXX',
- CLEANUP => 1, DIR => $ENV{PERL_CORE} ? Cwd::cwd : File::Spec->tmpdir
+ CLEANUP => 1, DIR => $ENV{PERL_CORE} ? Cwd::cwd :
+ $usr_tmp ? $usr_tmp : File::Spec->tmpdir
);
}
@@ -200,7 +202,20 @@ sub check_compiler {
my $have_c_compiler;
stderr_of( sub {$have_c_compiler = $mb->have_c_compiler} );
- return ($have_c_compiler, $mb->feature('C_support'));
+ # check noexec tmpdir
+ my $tmp_exec;
+ if ( $have_c_compiler ) {
+ my $dir = MBTest->tmpdir;
+ my $c_file = File::Spec->catfile($dir,'test.c');
+ open my $fh, ">", $c_file;
+ print {$fh} "int main() { return 0; }\n";
+ close $fh;
+ my $exe = $mb->cbuilder->link_executable(
+ objects => $mb->cbuilder->compile( source => $c_file )
+ );
+ $tmp_exec = 0 == system( $exe );
+ }
+ return ($have_c_compiler, $mb->feature('C_support'), $tmp_exec);
}
sub have_module {
diff --git a/lib/Module/Build/t/metadata.t b/lib/Module/Build/t/metadata.t
index 37a7de76cc..609d6e9122 100644
--- a/lib/Module/Build/t/metadata.t
+++ b/lib/Module/Build/t/metadata.t
@@ -65,6 +65,9 @@ my $mb = Module::Build->new_from_context;
{
my $mb_prereq = { 'Module::Build' => $Module::Build::VERSION };
+ my $mb_config_req = {
+ 'Module::Build' => int($Module::Build::VERSION * 100)/100
+ };
my $node = $mb->prepare_metadata( {} );
# exists() doesn't seem to work here
@@ -73,7 +76,7 @@ my $mb = Module::Build->new_from_context;
is $node->{abstract}, $metadata{dist_abstract};
is_deeply $node->{author}, $metadata{dist_author};
is $node->{license}, $metadata{license};
- is_deeply $node->{configure_requires}, $mb_prereq, 'Add M::B to configure_requires';
+ is_deeply $node->{configure_requires}, $mb_config_req, 'Add M::B to configure_requires';
like $node->{generated_by}, qr{Module::Build};
ok defined( $node->{'meta-spec'}{version} ),
"'meta-spec' -> 'version' field present in META.yml";
diff --git a/lib/Module/Build/t/metadata2.t b/lib/Module/Build/t/metadata2.t
index e582a5b1b0..4d2894d4e9 100644
--- a/lib/Module/Build/t/metadata2.t
+++ b/lib/Module/Build/t/metadata2.t
@@ -19,7 +19,7 @@ SKIP: {
skip( 'YAML_support feature is not enabled', 4 )
unless Module::Build::ConfigData->feature('YAML_support');
- my $dist = DistGen->new( dir => $tmp, skip_manifest => 1 );
+ my $dist = DistGen->new( dir => $tmp, no_manifest => 1 );
$dist->regen;
$dist->chdir_in;
diff --git a/lib/Module/Build/t/runthrough.t b/lib/Module/Build/t/runthrough.t
index 98913281d2..ce15295e4c 100644
--- a/lib/Module/Build/t/runthrough.t
+++ b/lib/Module/Build/t/runthrough.t
@@ -16,7 +16,6 @@ my $tmp = MBTest->tmpdir;
use DistGen;
my $dist = DistGen->new( dir => $tmp );
-$dist->remove_file( 't/basic.t' );
$dist->change_build_pl
({
module_name => 'Simple',
@@ -29,22 +28,6 @@ $dist->add_file( 'script', <<'---' );
#!perl -w
print "Hello, World!\n";
---
-$dist->add_file( 'test.pl', <<'---' );
-#!/usr/bin/perl
-
-use Test;
-plan tests => 2;
-
-ok 1;
-
-require Module::Build;
-skip $ENV{PERL_CORE} && "no blib in core",
- $INC{'Module/Build.pm'}, qr/blib/, 'Module::Build should be loaded from blib';
-
-print "# Cwd: ", Module::Build->cwd, "\n";
-print "# \@INC: (@INC)\n";
-print "Done.\n"; # t/compat.t looks for this
----
$dist->add_file( 'lib/Simple/Script.PL', <<'---' );
#!perl -w
@@ -116,9 +99,9 @@ ok grep {$_ eq 'save_out' } $mb->cleanup;
unless ($all_ok) {
# We use diag() so Test::Harness doesn't get confused.
- diag("vvvvvvvvvvvvvvvvvvvvv Simple/test.pl output vvvvvvvvvvvvvvvvvvvvv");
+ diag("vvvvvvvvvvvvvvvvvvvvv Simple/t/basic.t output vvvvvvvvvvvvvvvvvvvvv");
diag($output);
- diag("^^^^^^^^^^^^^^^^^^^^^ Simple/test.pl output ^^^^^^^^^^^^^^^^^^^^^");
+ diag("^^^^^^^^^^^^^^^^^^^^^ Simple/t/basic.t output ^^^^^^^^^^^^^^^^^^^^^");
}
}
@@ -150,10 +133,8 @@ SKIP: {
cmp_ok $1, '==', $mb->VERSION, "Check version used to create META.yml: $1 == " . $mb->VERSION;
SKIP: {
- skip( "not sure if we can create a tarball on this platform", 1 )
- unless $mb->check_installed_version('Archive::Tar', 0) ||
- $mb->isa('Module::Build::Platform::Unix');
-
+ skip( "Archive::Tar 1.08+ not installed", 1 )
+ unless eval { require Archive::Tar && Archive::Tar->VERSION(1.08); 1 };
$mb->add_to_cleanup($mb->dist_dir . ".tar.gz");
eval {$mb->dispatch('dist')};
is $@, '';
diff --git a/lib/Module/Build/t/script_dist.t b/lib/Module/Build/t/script_dist.t
index 2b13c02597..0a86cafe45 100644
--- a/lib/Module/Build/t/script_dist.t
+++ b/lib/Module/Build/t/script_dist.t
@@ -77,3 +77,4 @@ SKIP: {
my $yml = YAML::LoadFile('META.yml');
is_deeply($yml->{provides}, \%meta_provides);
}
+$dist->chdir_original if $dist->did_chdir;
diff --git a/lib/Module/Build/t/tilde.t b/lib/Module/Build/t/tilde.t
index d2abfdf015..299d4b5bd6 100644
--- a/lib/Module/Build/t/tilde.t
+++ b/lib/Module/Build/t/tilde.t
@@ -55,10 +55,6 @@ SKIP: {
is( run_sample( $p => '~/foo' )->$p(), "$home/foo" );
- is( run_sample( $p => '~~' )->$p(), '~~' );
-
- is( run_sample( $p => '~ foo' )->$p(), '~ foo' );
-
is( run_sample( $p => '~/ foo')->$p(), "$home/ foo" );
is( run_sample( $p => '~/fo o')->$p(), "$home/fo o" );
@@ -91,6 +87,10 @@ SKIP: {
$mb->$p('~');
is( $mb->$p(), '~', 'API does not expand tildes' );
+
+ skip "On OS/2 EMX all users are equal", 2 if $^O eq 'os2';
+ is( run_sample( $p => '~~' )->$p(), '~~' );
+ is( run_sample( $p => '~ foo' )->$p(), '~ foo' );
}
# Again, with named users
diff --git a/lib/Module/Build/t/write_default_maniskip.t b/lib/Module/Build/t/write_default_maniskip.t
index b43e5275f5..0a293b0dad 100644
--- a/lib/Module/Build/t/write_default_maniskip.t
+++ b/lib/Module/Build/t/write_default_maniskip.t
@@ -5,11 +5,14 @@ use warnings;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
use MBTest 'no_plan';
+use DistGen;
+use Cwd;
use_ok 'Module::Build';
ensure_blib 'Module::Build';
{
+ my $cwd = Cwd::cwd;
chdir MBTest->tmpdir();
my $build = Module::Build->new(
@@ -34,4 +37,6 @@ ensure_blib 'Module::Build';
like $have, qr/^\Q$head\E/, "default MANIFEST.SKIP used";
like $have, qr/^# Avoid Module::Build generated /ms, "Module::Build specific entries";
like $have, qr/Foo-Bar-/, "distribution tarball entry";
+
+ DistGen::chdir_all($cwd);
}
diff --git a/lib/Module/Build/t/xs.t b/lib/Module/Build/t/xs.t
index bd2fc1c497..f637d7e665 100644
--- a/lib/Module/Build/t/xs.t
+++ b/lib/Module/Build/t/xs.t
@@ -6,8 +6,10 @@ use MBTest;
use Module::Build;
use Config;
+my $tmp;
+
{
- my ($have_c_compiler, $C_support_feature) = check_compiler();
+ my ($have_c_compiler, $C_support_feature, $tmp_exec) = check_compiler();
if (! $C_support_feature) {
plan skip_all => 'C_support not enabled';
@@ -20,6 +22,8 @@ use Config;
} else {
plan tests => 23;
}
+ require Cwd;
+ $tmp = MBTest->tmpdir( $tmp_exec ? undef : Cwd::cwd );
}
ensure_blib('Module::Build');
@@ -27,9 +31,6 @@ ensure_blib('Module::Build');
#########################
-
-my $tmp = MBTest->tmpdir;
-
use DistGen;
my $dist = DistGen->new( dir => $tmp, xs => 1 );
$dist->regen;