#!/usr/bin/perl # Copyright 2001-2007, Paul Johnson (pjcj@cpan.org) # This software is free. It is licensed under the same terms as Perl itself. # The latest version of this software should be available from my homepage: # http://www.pjcj.net require 5.006001; use strict; use warnings; use Cwd; use ExtUtils::MakeMaker; use ExtUtils::Manifest "maniread"; use File::Copy; $| = 1; my $Version = "0.63"; my $Date = "16th November 2007"; my $Author = 'pjcj@cpan.org'; my @perlbug = ("perlbug", "-a", $Author, "-s", "Installation of Devel::Cover $Version"); my $Perlbug = join " ", map { / / ? "'$_'" : $_ } @perlbug; my @files = sort keys %{maniread()}, "lib/Devel/Cover/Inc.pm"; my @versions = grep { $_ ne "README" && $_ ne "Makefile.PL" } @files; my $base = getcwd; my %inc = map { -d $_ ? (($_ eq "." ? $_ : Cwd::abs_path($_)) => 1) : () } @INC; my @inc = sort keys %inc; open I, ">lib/Devel/Cover/Inc.pm" or die "Cannot open lib/Devel/Cover/Inc.pm: $!"; print I <<"EOI"; # Copyright 2001-2007, Paul Johnson (pjcj\@cpan.org) # This software is free. It is licensed under the same terms as Perl itself. # The latest version of this software should be available from my homepage: # http://www.pjcj.net # This file was automatically generated by Makefile.PL. package Devel::Cover::Inc; use strict; use warnings; our \$VERSION = "$Version"; our \$Perl_version = '$]'; our \$Base = '$base'; our \@Inc = qw( @inc ); chomp (our \$Perl = <<'EOV'); # Careful with \\\\ in the path $^X EOV if (\$Perl_version ne \$]) { print STDERR <<"EOM"; This version of Devel::Cover was built with Perl version \$Perl_version. It is now being run with Perl version \$]. Attempting to make adjustments, but you may find that some of your modules do not have coverage data collected. You may need to alter the +-inc, +-ignore and +-select options. EOM eval "use Cwd"; my \%inc = map { -d \$_ ? ((\$_ eq "." ? \$_ : Cwd::abs_path(\$_)) => 1) : () } \@INC; \@Inc = sort keys \%inc; } # TODO - check for threadedness, 64bits etc. ? 1 EOI close I or die "Cannot close lib/Devel/Cover/Inc.pm: $!"; print "Writing tests ........ "; unless (-d "t") { mkdir "t" or die "Cannot mkdir t: $!"; } opendir D, "tests" or die "Cannot opendir tests: $!"; for my $t (readdir D) { next unless -f "tests/$t"; next if $t =~ /\.(pm|pl|org|bak|uncoverable)$/; next if $t =~ /~$/; if ($t =~ /\.t/) { copy("tests/$t", "t/$t") or die "Cannot copy tests/$t to t/$t: $!"; next } open T, ">t/a$t.t" or die "Cannot open t/a$t.t: $!"; print T <new("$t"); EOT close T or die "Cannot open t/a$t.t: $!"; } closedir D or die "Cannot closedir tests: $!"; print "done\n\n"; my $e; print "checking for Storable.pm ........ "; $e = < $latest_tested; Devel::Cover $Version has not been tested with perl $]. Testing will take place against expected output from perl $latest_tested. You may well find failing tests. EOM if ($] < 5.008) { print < "Devel::Cover", VERSION => $Version, AUTHOR => 'Paul Johnson (pjcj@cpan.org)', ABSTRACT => "Code coverage metrics for Perl", DIR => [], EXE_FILES => [ qw( cover gcov2perl cpancover ) ], PREREQ_PM => { Storable => 0, "Digest::MD5" => 0, }, dist => { COMPRESS => "gzip --best --force" }, clean => { FILES => join " ", "t/*" }, depend => { distdir => "@files" }, realclean => $] < 5.008008 ? { FILES => "lib/Devel/Cover/Inc.pm", POSTOP => "\$(RM_RF) cover_db t" } : { FILES => "lib/Devel/Cover/Inc.pm cover_db t" }, ); print "\n"; print < README ppm : ppd pure_all \t tar cf Devel-Cover.tar blib \t gzip --best --force Devel-Cover.tar \t \$(PERL) -pi.bak \\ -e 's/(OS NAME=")[^"]*/\$\$1MSWin32/;' \\ -e 's/(ARCHITECTURE NAME=")[^"]*/\$\$1MSWin32-x86-multi-thread/;' \\ -e 's/(CODEBASE HREF=")[^"]*/\$\$1Devel-Cover.tar.gz/;' \\ Devel-Cover.ppd TAINT = -T COVER_OPTIONS = _run : pure_all \t \$(PERL) \$(TAINT) -Iblib/lib -Iblib/arch -MDevel::Cover=-merge,0,`\$(PERL) -e '\$\$l = qx|grep __COVER__ \$\$ARGV[0]|; \$\$l =~ /__COVER__\\s+criteria\\s+(.*)/; (\$\$c = \$\$1 || "all") =~ s/\\s+/,/g; \$\$p = "\$\$1," if \$\$l =~ /__COVER__\\s+test_parameters\\s+(.*)/; print "\$\$p-coverage,\$\$c"' tests/\$(TEST)`,\$(COVER_OPTIONS) tests/\$(TEST) COVER_PARAMETERS = \$(PERL) -e '\$\$l = qx|grep __COVER__ \$\$ARGV[0]|; \$\$u = "-uncoverable_file \$\$1" if \$\$l =~ /__COVER__\\s+uncoverable_file\\s+(.*)/; (\$\$p) = \$\$l =~ /__COVER__\\s+cover_parameters\\s+(.*)/; print "\$\$u \$\$p"' tests/\$(TEST) html : _run \t \$(PERL) -Mblib cover `\$(COVER_PARAMETERS)` -report html basic : _run \t \$(PERL) -Mblib cover `\$(COVER_PARAMETERS)` -report html_basic out : _run \t \$(PERL) -Mblib cover `\$(COVER_PARAMETERS)` -report text > \$(TEST).out text : out \t \$(VISUAL) \$(TEST).out wrun : pure_all \t \$(PERL) \$(TAINT) -Iblib/lib -Iblib/arch -MDevel::Cover=-ignore,blib,-merge,0 tests/\$(TEST) DB = cover_db dump : \t \$(PERL) -Mblib cover -dump_db \$(DB) FONT = 8x13 FONT = -sun-screen-medium-r-normal-*-*-70-*-*-m-*-sun-fontspecific FONT = "Bitstream Vera Sans Mono 8" diff : out \t \$(PERL) -i -pe '\$\$t = index \$\$_, "time code" if !defined \$\$t || \$\$t < 0; substr \$\$_, \$\$t, 7, "" if /^line err stmt/ .. /^--------/ and length > \$\$t' \$(TEST).out \t gvim -d -font \$(FONT) `\$(PERL) -Mblib -MDevel::Cover::Test -e '\$\$t = Devel::Cover::Test->new("\$(TEST)", run_test_at_end => 0); print \$\$t->cover_gold'` \$(TEST).out gold : pure_all \t \$(PERL) create_gold \$(TEST) all_test : \t exec \$(PERL) all_versions make test all_gold : \t rm -rf test_output \t exec \$(PERL) all_versions make gold mani : \t \$(PERL) -i.bak -ne '\$\$d = "test_output/cover"; print unless /^\$\$d/; END { open M, ">>MANIFEST"; opendir D, \$\$d; print M "\$\$d/\$\$_\\n" for sort grep -f "\$\$d/\$\$_", readdir D }' MANIFEST ok : \t \@$Perlbug -okay || echo "Please send your report manually to $Author" nok : \t \@$Perlbug -nokay || echo "Please send your report manually to $Author" ] }