lib/Module/Build/t/add_property.t Module::Build
lib/Module/Build/t/basic.t Module::Build
lib/Module/Build/t/bundled/Tie/CPHash.pm Module::Build.pm
+lib/Module/Build/t/compat/exit.t Module::Build
lib/Module/Build/t/compat.t Module::Build
lib/Module/Build/t/destinations.t Module::Build
lib/Module/Build/t/extend.t Module::Build
use vars qw($VERSION @ISA);
@ISA = qw(Module::Build::Base);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
# Okay, this is the brute-force method of finding out what kind of
'actions'. In this case the actions run are 'build' (the default
action), 'test', and 'install'. Other actions defined so far include:
- build manifest
- clean manpages
- code pardist
- config_data ppd
- diff ppmdist
+ build manpages
+ clean pardist
+ code ppd
+ config_data ppmdist
+ diff prereq_data
dist prereq_report
distcheck pure_install
distclean realclean
help testpod
html testpodcoverage
install versioninstall
+ manifest
You can run the 'help' action for a complete list of actions.
output, so you can supply C<tar> and/or C<gzip> parameters to affect
the result.
+=item prereq_data
+
+[version 0.32]
+
+This action prints out a Perl data structure of all prerequsites and the versions
+required. The output can be loaded again using C<eval()>. This can be useful for
+external tools that wish to query a Build script for prerequisites.
+
=item prereq_report
[version 0.28]
}
}
+=item prereq_data()
+
+[version 0.32]
+
+Returns a reference to a hash describing all prerequisites. The keys of the
+hash will the various prerequisite types ('requires', 'build_requires',
+'configure_requires', 'recommends', or 'conflicts') and the values will
+references to hashes of module names and version numbers. Only prerequisites
+types that are defined will be included. The C<prereq_data> action is just a
+thin wrapper around the C<prereq_data()> method and dumps the hash as a string
+that can be loaded using C<eval()>.
+
=item prereq_report()
[version 0.28]
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
BEGIN { require 5.00503 }
}
}
- $self->log_warn("\n");
+ $self->log_warn("\n") unless $self->quiet;
}
sub prereq_failures {
$self->log_info( $self->prereq_report );
}
-sub prereq_report {
+sub ACTION_prereq_data {
+ my $self = shift;
+ $self->log_info( Module::Build::Dumper->_data_dump( $self->prereq_data ) );
+}
+
+sub prereq_data {
my $self = shift;
my @types = @{ $self->prereq_action_types };
- my $info = { map { $_ => $self->$_() } @types };
+ my $info = { map { $_ => $self->$_() } grep { %{$self->$_()} } @types };
+ return $info;
+}
+
+sub prereq_report {
+ my $self = shift;
+ my $info = $self->prereq_data;
my $output = '';
- foreach my $type (@types) {
+ foreach my $type (keys %$info) {
my $prereqs = $info->{$type};
- next unless %$prereqs;
$output .= "\n$type:\n";
my $mod_len = 2;
my $ver_len = 4;
sub ACTION_fakeinstall {
my ($self) = @_;
require ExtUtils::Install;
+ my $eui_version = ExtUtils::Install->VERSION;
+ if ( $eui_version < 1.32 ) {
+ $self->log_warn(
+ "The 'fakeinstall' action requires Extutils::Install 1.32 or later.\n"
+ . "(You only have version $eui_version)."
+ );
+ return;
+ }
$self->depends_on('build');
ExtUtils::Install::install($self->install_map, !$self->quiet, 1, $self->{args}{uninst}||0);
}
return $self->_prefixify_default( $type, $rprefix );
} elsif( !File::Spec->file_name_is_absolute($path) ) {
$self->log_verbose(" path is relative, not prefixifying.\n");
- } elsif( $sprefix eq $rprefix ) {
- $self->log_verbose(" no new prefix.\n");
} elsif( $path !~ s{^\Q$sprefix\E\b}{}s ) {
$self->log_verbose(" cannot prefixify, falling back to default.\n");
return $self->_prefixify_default( $type, $rprefix );
);
$args{verbose} = !$self->quiet
unless exists $args{verbose};
-
+
my $file = $args{from};
unless (defined $file and length $file) {
die "No 'from' parameter given to copy_if_modified";
}
-
+
+ # makes no sense to replicate an absolute path, so assume flatten
+ $args{flatten} = 1 if File::Spec->file_name_is_absolute( $file );
+
my $to_path;
if (defined $args{to} and length $args{to}) {
$to_path = $args{to};
Revision history for Perl extension Module::Build.
+0.31_04 - Fri Feb 20 11:04:59 PST 2009
+
+ Other
+ - Bumped Test::Harness prereq to 3.16 for latest PERL5LIB fixes (solves
+ test failures when installing Module::Build using CPANPLUS::Dist::Build)
+ [David Golden]
+
+0.31_03 - Sun Feb 8 14:54:01 PST 2009
+
+ Enhancements
+ - added a "prereq_data" action that prints a Perl data structure of
+ all prerequisites; can be loaded by external tools using eval()
+ [David Golden]
+
+ Bug-fixes
+ - 'fakeinstall' action warns and skips without ExtUtils::Install 1.32+
+ [David Golden, reported by Zefram]
+ - allows Module::Build version mismatch when installing self; works around
+ limitations in CPANPLUS::Dist::Build [David Golden]
+
+0.31_02 - Tue Jan 27 09:16:43 PST 2009
+
+ Other
+ - tests now use File::Temp (added to build_requires); appears to fix
+ Win32 testing heisenbug on directory removal during high system loads
+ - use_tap_harness.t will skip unless a release version of TAP::Harness
+ is installed
+ - improved diagnostics to ensure_blib() tests in t/lib/MBTest.pm
+
+ Compat
+ - passthrough Makefile.PL will now play nice with cpantesters' on
+ exit(0) (RT#32018) [Eric Wilhelm]
+
+ Bug Fixes
+ - fix for doubling-up of --prefix (RT#19951)
+
0.31012 - Wed Jan 14 01:36:19 PST 2009
Bug Fixes
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
use File::Spec;
use IO::File;
eval "use Module::Build::Compat 0.02; 1" or die $@;
%s
Module::Build::Compat->run_build_pl(args => \@ARGV);
+ exit(0) unless(-e 'Build'); # cpantesters convention
require %s;
Module::Build::Compat->write_makefile(build_class => '%s');
EOF
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Config;
package Module::Build::Cookbook;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
=head1 NAME
package Module::Build::Dumper;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
# This is just a split-out of a wrapper function to do Data::Dumper
# stuff "the right way". See:
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use File::Spec;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Data::Dumper;
use IO::File;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use vars qw(@ISA);
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Base;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Config;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use Module::Build::Platform::Unix;
use strict;
use vars qw($VERSION);
-$VERSION = '0.31012';
+$VERSION = '0.31_04';
$VERSION = eval $VERSION;
use vars qw(@ISA);
'Should be non-verbose';
(my $libdir2 = $libdir) =~ s/libdir/lbiidr/;
- my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2");
- 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);
+ SKIP: {
+ require ExtUtils::Install;
+ skip "Needs ExtUtils::Install 1.32 or later", 2
+ if ExtUtils::Install->VERSION < 1.32;
+
+ my @make_args = ('INSTALLDIRS=vendor', "INSTALLVENDORLIB=$libdir2");
+
+ 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/x,
- 'Should have installdirs=vendor';
+ ($output) = stdout_stderr_of(
+ sub {
+ $ran_ok = $mb->do_system(@make, 'fakeinstall', @make_args);
+ }
+ );
+
+ 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/x,
+ 'Should have installdirs=vendor';
+ }
stdout_of( sub { $mb->do_system(@make, 'realclean'); } );
ok ! -e $makefile, "$makefile shouldn't exist";
--- /dev/null
+#!/usr/bin/perl -w
+
+use strict;
+
+use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
+use MBTest tests => 5;
+
+use_ok 'Module::Build';
+ensure_blib('Module::Build');
+
+#########################
+
+my $tmp = MBTest->tmpdir;
+
+# Create test distribution; set requires and build_requires
+use DistGen;
+my $dist = DistGen->new( dir => $tmp );
+
+$dist->regen;
+
+$dist->chdir_in;
+
+#########################
+
+my $mb; stdout_of(sub{ $mb = Module::Build->new_from_context});
+
+use Module::Build::Compat;
+
+$dist->regen;
+
+Module::Build::Compat->create_makefile_pl('passthrough', $mb);
+
+# as silly as all of this exit(0) business is, that is what the cpan
+# testers have instructed everybody to do so...
+$dist->change_file('Build.PL' =>
+ "warn qq(you have no libthbbt\n); exit;\n" . $dist->get_file('Build.PL')
+);
+
+$dist->regen;
+
+stdout_of(sub{ $mb->ACTION_realclean });
+
+my $result;
+my ($stdout, $stderr ) = stdout_stderr_of (sub {
+ $result = $mb->run_perl_script('Makefile.PL');
+});
+ok $result, "Makefile.PL exit";
+like $stdout, qr/running Build\.PL/;
+like $stderr, qr/you have no libthbbt$/;
+#warn "out: $stdout"; warn "err: $stderr";
+
+# vim:ts=2:sw=2:et:sta
{
# Make sure run_perl_script() propagates @INC
- my $dir = 'whosiewhatzit';
- mkdir $dir, 0777;
+ my $dir = MBTest->tmpdir;
local @INC = ($dir, @INC);
my $output = stdout_of( sub { Module::Build->run_perl_script('-le', [], ['print for @INC']) } );
- like $output, qr{^$dir}m;
- rmdir $dir;
+ like $output, qr{^\Q$dir\E}m;
}
##################################################################
use strict;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-use MBTest tests => 8;
+use MBTest tests => 6;
use_ok 'Module::Build';
ensure_blib('Module::Build');
$dist->chdir_in;
-
-
my $mb = Module::Build->new_from_context;
-my @files;
{
# Make sure copy_if_modified() can handle spaces in filenames
my @tmp;
- foreach (1..2) {
- my $tmp = File::Spec->catdir('t', "tmp$_");
- $mb->add_to_cleanup($tmp);
- push @files, $tmp;
- unless (-d $tmp) {
- mkdir($tmp, 0777) or die "Can't create $tmp: $!";
- }
- ok -d $tmp;
- $tmp[$_] = $tmp;
- }
+ push @tmp, MBTest->tmpdir for (0 .. 1);
my $filename = 'file with spaces.txt';
- my $file = File::Spec->catfile($tmp[1], $filename);
+ my $file = File::Spec->catfile($tmp[0], $filename);
my $fh = IO::File->new($file, '>') or die "Can't create $file: $!";
print $fh "Foo\n";
$fh->close;
ok -e $file;
- my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[2]);
+ my $file2 = $mb->copy_if_modified(from => $file, to_dir => $tmp[1]);
ok $file2;
ok -e $file2;
}
use strict;
use Module::Build;
my \$b = Module::Build->new(
+ # Some CPANPLUS::Dist::Build versions need to allow mismatches
+ # On logic: thanks to Module::Install, CPAN.pm must set both keys, but
+ # CPANPLUS sets only the one
+ allow_mb_mismatch => (
+ \$ENV{PERL5_CPANPLUS_IS_RUNNING} && ! \$ENV{PERL5_CPAN_IS_RUNNING} ? 1 : 0
+ ),
$args
);
\$b->create_build_script();
$self->{pending}{change}{$file} = 1;
}
+sub get_file {
+ my $self = shift;
+ my $file = shift;
+ exists($self->{filedata}{$file}) or croak("no such entry: '$file'");
+ return $self->{filedata}{$file};
+}
+
sub chdir_in {
my $self = shift;
use strict;
use File::Spec;
+use File::Temp ();
use File::Path ();
# We pass everything through to Test::More
use vars qw($VERSION @ISA @EXPORT %EXPORT_TAGS $TODO);
-$VERSION = 0.01;
+$VERSION = 0.01_01;
@ISA = qw(Test::More); # Test::More isa Exporter
@EXPORT = @Test::More::EXPORT;
%EXPORT_TAGS = %Test::More::EXPORT_TAGS;
########################################################################
-{ # Setup a temp directory if it doesn't exist
+# always return to the current directory
+{
my $cwd = Cwd::cwd;
- my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' . $$);
- mkdir $tmp, 0777 unless -d $tmp;
- sub tmpdir { $tmp }
END {
- if(-d $tmp) {
- # Go back to where you came from!
- chdir $cwd or die "Couldn't chdir to $cwd";
- File::Path::rmtree($tmp) or diag "cannot clean dir '$tmp'";
- }
+ # Go back to where you came from!
+ chdir $cwd or die "Couldn't chdir to $cwd";
}
}
########################################################################
}
########################################################################
+# Setup a temp directory
+sub tmpdir {
+ return File::Temp::tempdir( 'MB-XXXXXXXX',
+ CLEANUP => 1, DIR => $ENV{PERL_CORE} ? Cwd::cwd : File::Spec->tmpdir
+ );
+}
+
sub save_handle {
my ($handle, $subr) = @_;
my $outfile = temp_file_name();
# Make sure the given module was loaded from blib/, not the larger system
my $mod = shift;
(my $path = $mod) =~ s{::}{/}g;
-
+
+ local $Test::Builder::Level = $Test::Builder::Level + 1;
SKIP: {
skip "no blib in core", 1 if $ENV{PERL_CORE};
- like $INC{"$path.pm"}, qr/\bblib\b/, "Make sure $mod was loaded from blib/";
+ like $INC{"$path.pm"}, qr/\bblib\b/, "Make sure $mod was loaded from blib/"
+ or diag "PERL5LIB: " . ($ENV{PERL5LIB} || '') . "\n" .
+ "PERL5OPT: " . ($ENV{PERL5OPT} || '') . "\n" .
+ "\@INC contains:\n " . join("\n ", @INC) . "\n";
}
}
use strict;
use Test::More;
use lib $ENV{PERL_CORE} ? '../lib/Module/Build/t/lib' : 't/lib';
-if (eval { require TAP::Parser }) {
+if (eval { require TAP::Harness } && TAP::Harness->VERSION >= 3) {
plan tests => 8;
} else {
- plan skip_all => 'TAP::Parser not installed'
+ plan skip_all => 'TAP::Harness 3+ not installed'
}
use MBTest;