X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=t%2Flib%2FDBICTest%2FAuthorCheck.pm;h=c75b88735675cf21de9baefeb18350e13a51804b;hb=49eb5522ff64004f2fb7667b0e032555521bad32;hp=1e58b93909e66d757b485e921d6fff2d7bcdb507;hpb=fd3d890d5b5502fde946d5d45f5639ee58a43f93;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/t/lib/DBICTest/AuthorCheck.pm b/t/lib/DBICTest/AuthorCheck.pm index 1e58b93..c75b887 100644 --- a/t/lib/DBICTest/AuthorCheck.pm +++ b/t/lib/DBICTest/AuthorCheck.pm @@ -27,24 +27,36 @@ sub _check_author_makefile { my $root = _find_co_root() or return; + my $optdeps = file('lib/DBIx/Class/Optional/Dependencies.pm'); + # not using file->stat as it invokes File::stat which in turn breaks stat(_) - my ($mf_pl_mtime, $mf_mtime) = ( map - { (stat ($root->file ($_)) )[9] } - qw/Makefile.PL Makefile/ + my ($mf_pl_mtime, $mf_mtime, $optdeps_mtime) = ( map + { (stat ($root->file ($_)) )[9] || undef } # stat returns () on nonexistent files + (qw|Makefile.PL Makefile|, $optdeps) ); return unless $mf_pl_mtime; # something went wrong during co_root detection ? - if ( - not -d $root->subdir ('inc') - or - not $mf_mtime - or - $mf_mtime < $mf_pl_mtime - ) { - print STDERR <<'EOE'; + my @fail_reasons; + if(not -d $root->subdir ('inc')) { + push @fail_reasons, "Missing ./inc directory"; + } + if(not $mf_mtime) { + push @fail_reasons, "Missing ./Makefile"; + } + else { + if($mf_mtime < $mf_pl_mtime) { + push @fail_reasons, "./Makefile.PL is newer than ./Makefile"; + } + if($mf_mtime < $optdeps_mtime) { + push @fail_reasons, "./$optdeps is newer than ./Makefile"; + } + } + + if (@fail_reasons) { + print STDERR <<'EOE'; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -54,31 +66,52 @@ sub _check_author_makefile { We have a number of reasons to believe that this is a development checkout and that you, the user, did not run `perl Makefile.PL` before using this code. You absolutely _must_ perform this step, -as not doing so often results in a lot of wasted time for other -contributors trying to assit you with "it broke!" problems. +to ensure you have all required dependencies present. Not doing +so often results in a lot of wasted time for other contributors +trying to assit you with spurious "its broken!" problems. + +By default DBICs Makefile.PL turns all optional dependenciess into +*HARD REQUIREMENTS*, in order to make sure that the entire test +suite is executed, and no tests are skipped due to missing modules. +If you for some reason need to disable this behavior - supply the +--skip_author_deps option when running perl Makefile.PL If you are seeing this message unexpectedly (i.e. you are in fact -attempting a regular installation be it through CPAN or manually, -set the variable DBICTEST_NO_MAKEFILE_VERIFICATION to a true value -so you can continue. Also _make_absolutely_sure_ to report this to -either the mailing list or to the irc channel as described in +attempting a regular installation be it through CPAN or manually), +please report the situation to either the mailing list or to the +irc channel as described in http://search.cpan.org/dist/DBIx-Class/lib/DBIx/Class.pm#GETTING_HELP/SUPPORT -Failure to do this will make us believe that all these checks are -indeed foolproof and we will remove the ability to override this -entirely. - The DBIC team +Reasons you received this message: EOE + foreach my $r (@fail_reasons) { + print STDERR " * $r\n"; + } + print STDERR "\n\n\n"; + exit 1; } } +# Mimic $Module::Install::AUTHOR +sub is_author { + + my $root = _find_co_root() + or return undef; + + return ( + ( not -d $root->subdir ('inc') ) + or + ( -e $root->subdir ('inc')->file ($^O eq 'VMS' ? '_author' : '.author') ) + ); +} + # Try to determine the root of a checkout/untar if possible # or return undef sub _find_co_root {