[Module-build-checkins] Module-Build/lib/Module/Build Base.pm,1.369,1.370
Status: Beta
Brought to you by:
kwilliams
From: Ken W. <kwi...@us...> - 2005-01-06 02:34:42
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7935/lib/Module/Build Modified Files: Base.pm Log Message: Route warnings & info messages through new warn() & info() methods Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.369 retrieving revision 1.370 diff -C2 -d -r1.369 -r1.370 *** Base.pm 5 Jan 2005 04:38:52 -0000 1.369 --- Base.pm 6 Jan 2005 02:34:21 -0000 1.370 *************** *** 13,16 **** --- 13,17 ---- use IO::File (); use Text::ParseWords (); + use Carp (); #################### Constructors ########################### *************** *** 41,46 **** unless ($self->_perl_is_same($self->{properties}{perl})) { my $perl = $self->find_perl_interpreter; ! warn(" * WARNING: Configuration was initially created with '$self->{properties}{perl}',\n". ! " but we are now using '$perl'.\n"); } --- 42,47 ---- unless ($self->_perl_is_same($self->{properties}{perl})) { my $perl = $self->find_perl_interpreter; ! $self->warn(" * WARNING: Configuration was initially created with '$self->{properties}{perl}',\n". ! " but we are now using '$perl'.\n"); } *************** *** 99,103 **** # (e.g. to run tests). $p->{perl} = $self->find_perl_interpreter ! or warn "Warning: Can't locate your perl binary"; $p->{bindoc_dirs} ||= [ "$p->{blib}/script" ]; --- 100,104 ---- # (e.g. to run tests). $p->{perl} = $self->find_perl_interpreter ! or $self->warn("Warning: Can't locate your perl binary"); $p->{bindoc_dirs} ||= [ "$p->{blib}/script" ]; *************** *** 118,121 **** --- 119,125 ---- ################## End constructors ######################### + sub info { shift; print @_; } + sub warn { shift; Carp::carp @_; } + sub _set_install_paths { my $self = shift; *************** *** 288,292 **** return if $self->up_to_date([$self->config_file('config_data'), $self->config_file('features')], $notes_pm); ! print "Writing config notes to $notes_pm\n"; File::Path::mkpath(File::Basename::dirname($notes_pm)); my $fh = IO::File->new("> $notes_pm") or die "Can't create '$notes_pm': $!"; --- 292,296 ---- return if $self->up_to_date([$self->config_file('config_data'), $self->config_file('features')], $notes_pm); ! $self->info("Writing config notes to $notes_pm\n"); File::Path::mkpath(File::Basename::dirname($notes_pm)); my $fh = IO::File->new("> $notes_pm") or die "Can't create '$notes_pm': $!"; *************** *** 618,622 **** my $filename = File::Spec->catfile($build_dir, 'lib', split '::', $opts{class}) . '.pm'; my $filedir = File::Basename::dirname($filename); ! print "Creating custom builder $filename in $filedir\n"; File::Path::mkpath($filedir); --- 622,626 ---- my $filename = File::Spec->catfile($build_dir, 'lib', split '::', $opts{class}) . '.pm'; my $filedir = File::Basename::dirname($filename); ! $pack->info("Creating custom builder $filename in $filedir\n"); File::Path::mkpath($filedir); *************** *** 743,747 **** my $result = eval $eval; *UNIVERSAL::VERSION = $old_version; ! warn "Error evaling version line '$eval' in $file: $@\n" if $@; # Unbless it if it's a version.pm object --- 747,751 ---- my $result = eval $eval; *UNIVERSAL::VERSION = $old_version; ! $self->warn("Error evaling version line '$eval' in $file: $@\n") if $@; # Unbless it if it's a version.pm object *************** *** 877,891 **** my $failures = $self->prereq_failures($info); if ($failures) { ! warn "Feature '$name' disabled because of the following prerequisite failures:\n"; foreach my $type (qw(requires build_requires conflicts recommends)) { next unless $failures->{$type}; while (my ($module, $status) = each %{$failures->{$type}}) { ! warn " * $status->{message}\n"; } ! warn "\n"; } $self->feature($name => 0); } else { ! warn "Feature '$name' enabled.\n\n"; $self->feature($name => 1); } --- 881,895 ---- my $failures = $self->prereq_failures($info); if ($failures) { ! $self->warn("Feature '$name' disabled because of the following prerequisite failures:\n"); foreach my $type (qw(requires build_requires conflicts recommends)) { next unless $failures->{$type}; while (my ($module, $status) = each %{$failures->{$type}}) { ! $self->warn(" * $status->{message}\n"); } ! $self->warn("\n"); } $self->feature($name => 0); } else { ! $self->warn("Feature '$name' enabled.\n\n"); $self->feature($name => 1); } *************** *** 937,946 **** my $prefix = $type eq 'recommends' ? '' : 'ERROR: '; while (my ($module, $status) = each %{$failures->{$type}}) { ! warn " * $prefix$status->{message}\n"; } } ! warn "ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions\n". ! " of the modules indicated above before proceeding with this installation.\n\n"; return 0; } --- 941,950 ---- my $prefix = $type eq 'recommends' ? '' : 'ERROR: '; while (my ($module, $status) = each %{$failures->{$type}}) { ! $self->warn(" * $prefix$status->{message}\n"); } } ! $self->warn("ERRORS/WARNINGS FOUND IN PREREQUISITES. You may wish to install the versions\n". ! " of the modules indicated above before proceeding with this installation.\n\n"); return 0; } *************** *** 1026,1030 **** my $eval_str = "\$v1 $op \$v2"; my $result = eval $eval_str; ! warn "error comparing versions: '$eval_str' $@" if $@; return $result; --- 1030,1034 ---- my $eval_str = "\$v1 $op \$v2"; my $result = eval $eval_str; ! $self->warn("error comparing versions: '$eval_str' $@") if $@; return $result; *************** *** 1148,1156 **** if ( $self->delete_filetree($build_script) ) { ! print "Removed previous script '$build_script'\n"; } ! print("Creating new '$build_script' script for ", ! "'$dist_name' version '$dist_version'\n"); my $fh = IO::File->new(">$build_script") or die "Can't create '$build_script': $!"; $self->print_build_script($fh); --- 1152,1160 ---- if ( $self->delete_filetree($build_script) ) { ! $self->info("Removed previous script '$build_script'\n"); } ! $self->info("Creating new '$build_script' script for ", ! "'$dist_name' version '$dist_version'\n"); my $fh = IO::File->new(">$build_script") or die "Can't create '$build_script': $!"; $self->print_build_script($fh); *************** *** 1163,1166 **** --- 1167,1171 ---- sub check_manifest { + my $self = shift; return unless -e 'MANIFEST'; *************** *** 1168,1182 **** # could easily be re-written into a modern Perl dialect. - print "Checking whether your kit is complete...\n"; require ExtUtils::Manifest; # ExtUtils::Manifest is not warnings clean. local ($^W, $ExtUtils::Manifest::Quiet) = (0,1); if (my @missed = ExtUtils::Manifest::manicheck()) { ! print "Warning: the following files are missing in your kit:\n"; ! print "\t", join "\n\t", @missed; ! print "\n"; ! print "Please inform the author.\n"; } else { ! print "Looks good\n"; } } --- 1173,1185 ---- # could easily be re-written into a modern Perl dialect. require ExtUtils::Manifest; # ExtUtils::Manifest is not warnings clean. local ($^W, $ExtUtils::Manifest::Quiet) = (0,1); if (my @missed = ExtUtils::Manifest::manicheck()) { ! $self->warn("Warning: the following files are missing in your kit:\n", ! "\t", join("\n\t", @missed), "\n", ! "Please inform the author.\n"); } else { ! $self->info("Checking whether your kit is complete...\nLooks good\n"); } } *************** *** 1475,1479 **** Test::Harness::runtests(@$tests); } else { ! print("No tests defined.\n"); } --- 1478,1482 ---- Test::Harness::runtests(@$tests); } else { ! $self->info("No tests defined.\n"); } *************** *** 1510,1514 **** unless ($self->find_module_by_name('Devel::Cover', \@INC)) { ! warn("Cannot run testcover action unless Devel::Cover is installed.\n"); return; } --- 1513,1517 ---- unless ($self->find_module_by_name('Devel::Cover', \@INC)) { ! $self->warn("Cannot run testcover action unless Devel::Cover is installed.\n"); return; } *************** *** 1719,1723 **** my $interpreter = $self->{properties}{perl}; ! print STDOUT "Changing sharpbang in $file to $interpreter" if $self->{verbose}; my $shb = ''; $shb .= "$c->{sharpbang}$interpreter $arg\n" if $does_shbang; --- 1722,1726 ---- my $interpreter = $self->{properties}{perl}; ! $self->info("Changing sharpbang in $file to $interpreter") if $self->{verbose}; my $shb = ''; $shb .= "$c->{sharpbang}$interpreter $arg\n" if $does_shbang; *************** *** 1747,1751 **** unlink "$file.bak" ! or warn "Couldn't clean up $file.bak, leaving it there"; $self->do_system($c->{eunicefix}, $file) if $c->{eunicefix} ne ':'; --- 1750,1754 ---- unlink "$file.bak" ! or $self->warn("Couldn't clean up $file.bak, leaving it there"); $self->do_system($c->{eunicefix}, $file) if $c->{eunicefix} ne ':'; *************** *** 1805,1809 **** my $outfile = File::Spec->catfile( $mandir, $manpage); next if $self->up_to_date( $file, $outfile ); ! print "Manifying $file -> $outfile\n"; $parser->parse_from_file( $file, $outfile ); $files->{$file} = $outfile; --- 1808,1812 ---- my $outfile = File::Spec->catfile( $mandir, $manpage); next if $self->up_to_date( $file, $outfile ); ! $self->info("Manifying $file -> $outfile\n"); $parser->parse_from_file( $file, $outfile ); $files->{$file} = $outfile; *************** *** 1825,1829 **** my $outfile = File::Spec->catfile( $mandir, $manpage); next if $self->up_to_date( $file, $outfile ); ! print "Manifying $file -> $outfile\n"; $parser->parse_from_file( $file, $outfile ); $files->{$file} = $outfile; --- 1828,1832 ---- my $outfile = File::Spec->catfile( $mandir, $manpage); next if $self->up_to_date( $file, $outfile ); ! $self->info("Manifying $file -> $outfile\n"); $parser->parse_from_file( $file, $outfile ); $files->{$file} = $outfile; *************** *** 1947,1952 **** push @opts, "--css=$path2root/$args{css}" if $args{css}; ! print "Creating $outfile\n"; ! print "pod2html @opts\n" if $self->verbose; Pod::Html::pod2html(@opts); # or warn "pod2html @opts failed: $!"; } --- 1950,1955 ---- push @opts, "--css=$path2root/$args{css}" if $args{css}; ! $self->info("Creating $outfile\n"); ! $self->info("pod2html @opts\n") if $self->verbose; Pod::Html::pod2html(@opts); # or warn "pod2html @opts failed: $!"; } *************** *** 2119,2123 **** chmod($mode, $manifest); ! print map "Added to $manifest: $_\n", @$lines; } --- 2122,2126 ---- chmod($mode, $manifest); ! $self->info(map "Added to $manifest: $_\n", @$lines); } *************** *** 2126,2130 **** unless (eval { require Module::Signature; 1 }) { ! warn "Couldn't load Module::Signature for 'distsign' action:\n $@\n"; return; } --- 2129,2133 ---- unless (eval { require Module::Signature; 1 }) { ! $self->warn("Couldn't load Module::Signature for 'distsign' action:\n $@\n"); return; } *************** *** 2200,2204 **** unless ($dist_files and keys %$dist_files); ! warn "*** Did you forget to add $self->{metafile} to the MANIFEST?\n" unless exists $dist_files->{$self->{metafile}}; --- 2203,2207 ---- unless ($dist_files and keys %$dist_files); ! $self->warn("*** Did you forget to add $self->{metafile} to the MANIFEST?\n") unless exists $dist_files->{$self->{metafile}}; *************** *** 2210,2214 **** my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0); chmod +(stat $file)[2], $new ! or warn "Couldn't set permissions on $new: $!"; } --- 2213,2217 ---- my $new = $self->copy_if_modified(from => $file, to_dir => $dist_dir, verbose => 0); chmod +(stat $file)[2], $new ! or $self->warn("Couldn't set permissions on $new: $!"); } *************** *** 2276,2280 **** my $maniskip = 'MANIFEST.SKIP'; unless ( -e 'MANIFEST' || -e $maniskip ) { ! warn "File '$maniskip' does not exist: Creating a default '$maniskip'\n"; $self->_write_default_maniskip($maniskip); } --- 2279,2283 ---- my $maniskip = 'MANIFEST.SKIP'; unless ( -e 'MANIFEST' || -e $maniskip ) { ! $self->warn("File '$maniskip' does not exist: Creating a default '$maniskip'\n"); $self->_write_default_maniskip($maniskip); } *************** *** 2366,2370 **** unless ($p->{license}) { ! warn "No license specified, setting license = 'unknown'\n"; $p->{license} = 'unknown'; } --- 2369,2373 ---- unless ($p->{license}) { ! $self->warn("No license specified, setting license = 'unknown'\n"); $p->{license} = 'unknown'; } *************** *** 2385,2389 **** require Module::Build::ConfigData; # Only works after the 'build' unless (Module::Build::ConfigData->feature('YAML_support')) { ! warn <<EOM; \nCouldn't load YAML.pm, generating a minimal META.yml without it. Please check and edit the generated metadata, or consider installing YAML.pm.\n --- 2388,2392 ---- require Module::Build::ConfigData; # Only works after the 'build' unless (Module::Build::ConfigData->feature('YAML_support')) { ! $self->warn(<<EOM); \nCouldn't load YAML.pm, generating a minimal META.yml without it. Please check and edit the generated metadata, or consider installing YAML.pm.\n *************** *** 2477,2481 **** $file ||= $dir; ! print "Creating $file.tar.gz\n"; if ($self->{args}{tar}) { --- 2480,2484 ---- $file ||= $dir; ! $self->info("Creating $file.tar.gz\n"); if ($self->{args}{tar}) { *************** *** 2580,2584 **** foreach (@_) { next unless -e $_; ! print "Deleting $_\n"; File::Path::rmtree($_, 0, 0); die "Couldn't remove '$_': $!\n" if -e $_; --- 2583,2587 ---- foreach (@_) { next unless -e $_; ! $self->info("Deleting $_\n"); File::Path::rmtree($_, 0, 0); die "Couldn't remove '$_': $!\n" if -e $_; *************** *** 2622,2628 **** return $p->{have_compiler} if defined $p->{have_compiler}; ! print "Checking if compiler tools configured... " if $p->{verbose}; my $have = $self->_cbuilder->have_compiler; ! print($have ? "ok.\n" : "failed.\n") if $p->{verbose}; return $p->{have_compiler} = $have; } --- 2625,2631 ---- return $p->{have_compiler} if defined $p->{have_compiler}; ! $self->info("Checking if compiler tools configured... ") if $p->{verbose}; my $have = $self->_cbuilder->have_compiler; ! $self->info($have ? "ok.\n" : "failed.\n") if $p->{verbose}; return $p->{have_compiler} = $have; } *************** *** 2669,2673 **** my ($self, $file, %args) = @_; ! print "$file -> $args{outfile}\n"; if (eval {require ExtUtils::ParseXS; 1}) { --- 2672,2676 ---- my ($self, $file, %args) = @_; ! $self->info("$file -> $args{outfile}\n"); if (eval {require ExtUtils::ParseXS; 1}) { *************** *** 2691,2695 **** qq{-typemap "$typemap" "$file"}); ! print $command; my $fh = IO::File->new("> $args{outfile}") or die "Couldn't write $args{outfile}: $!"; print $fh `$command`; --- 2694,2698 ---- qq{-typemap "$typemap" "$file"}); ! $self->info($command); my $fh = IO::File->new("> $args{outfile}") or die "Couldn't write $args{outfile}: $!"; print $fh `$command`; *************** *** 2777,2781 **** unless ($self->up_to_date($file, "$file_base.bs")) { require ExtUtils::Mkbootstrap; ! print "ExtUtils::Mkbootstrap::Mkbootstrap('$file_base')\n"; ExtUtils::Mkbootstrap::Mkbootstrap($file_base); # Original had $BSLOADLIBS - what's that? {my $fh = IO::File->new(">> $file_base.bs")} # create --- 2780,2784 ---- unless ($self->up_to_date($file, "$file_base.bs")) { require ExtUtils::Mkbootstrap; ! $self->info("ExtUtils::Mkbootstrap::Mkbootstrap('$file_base')\n"); ExtUtils::Mkbootstrap::Mkbootstrap($file_base); # Original had $BSLOADLIBS - what's that? {my $fh = IO::File->new(">> $file_base.bs")} # create *************** *** 2790,2794 **** sub do_system { my ($self, @cmd) = @_; ! print "@cmd\n"; return !system(@cmd); } --- 2793,2797 ---- sub do_system { my ($self, @cmd) = @_; ! $self->info("@cmd\n"); return !system(@cmd); } *************** *** 2822,2826 **** File::Path::mkpath(File::Basename::dirname($to_path), 0, 0777); ! print "$file -> $to_path\n" if $args{verbose}; File::Copy::copy($file, $to_path) or die "Can't copy('$file', '$to_path'): $!"; return $to_path; --- 2825,2829 ---- File::Path::mkpath(File::Basename::dirname($to_path), 0, 0777); ! $self->info("$file -> $to_path\n") if $args{verbose}; File::Copy::copy($file, $to_path) or die "Can't copy('$file', '$to_path'): $!"; return $to_path; *************** *** 2837,2841 **** foreach my $file (@$source) { unless (-e $file) { ! warn "Can't find source file $file for up-to-date check"; next; } --- 2840,2844 ---- foreach my $file (@$source) { unless (-e $file) { ! $self->warn("Can't find source file $file for up-to-date check"); next; } |