1 my ($optdep_msg, $opt_testdeps);
3 if ($args->{skip_author_deps}) {
6 ******************************************************************************
7 ******************************************************************************
9 *** IGNORING AUTHOR MODE: no optional test dependencies will be forced. ***
11 *** If you are using this checkout with the intention of submitting a DBIC ***
12 *** patch, you are *STRONGLY ENCOURAGED* to install all dependencies, so ***
13 *** that every possible unit-test will run. ***
15 ******************************************************************************
16 ******************************************************************************
21 $optdep_msg = <<'EOW';
23 ******************************************************************************
24 ******************************************************************************
26 *** AUTHOR MODE: all optional test dependencies converted to hard requires ***
27 *** ( to disable re-run Makefile.PL with --skip-author-deps ) ***
29 ******************************************************************************
30 ******************************************************************************
34 require DBIx::Class::Optional::Dependencies;
36 # exclude the rdbms_* groups which are for DBIC users
37 # and the moose-related stuff iff we are under 5.8.3
38 $opt_testdeps = DBIx::Class::Optional::Dependencies->req_list_for([
42 ($] > 5.008002 or !/^ (?: test_ )? (?: admin | admin_script | replicated ) $/x )
43 } keys %{DBIx::Class::Optional::Dependencies->req_group_list}
46 print "Including all optional deps\n";
47 $reqs->{test_requires} = {
48 %{$reqs->{test_requires}},
53 # nasty hook into both M::AI init and the prompter, so that the optdep message
54 # comes at the right places (on top and then right above the prompt)
56 require Module::AutoInstall;
57 no warnings 'redefine';
60 for (qw/_prompt import/) {
61 my $meth = "Module::AutoInstall::$_";
70 # this will run after the Makefile is written and the main Makefile.PL terminates
73 # shit already hit the fan
76 # Re-write META.yml at the end to _exclude_ all forced build-requires (we do not
77 # want to ship this) We are also not using M::I::AuthorRequires as this will be
78 # an extra dep, and deps in Makefile.PL still suck
79 # Also always test the result so we stop shipping borked dependency lists to CPAN
81 # FIXME test_requires is not yet part of META
82 my %original_build_requires = ( %$build_requires, %$test_requires );
83 my @all_build_requires = @{delete Meta->{values}{build_requires}||[]};
84 my %removed_build_requires;
86 for (@all_build_requires) {
87 if ($original_build_requires{$_->[0]}) {
88 push @{Meta->{values}{build_requires}}, $_;
91 $removed_build_requires{$_->[0]} = $_->[1]
92 unless $_->[0] eq 'ExtUtils::MakeMaker';
96 if (keys %removed_build_requires) {
97 print "Regenerating META with author requires excluded\n";
98 # M::I understands unicode in meta but does not write with the right
100 local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ };
104 # strip possible crlf from META
105 if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
106 local $ENV{PERLIO} = 'unix';
107 system( $^X, qw( -MExtUtils::Command -e dos2unix -- META.yml), );
110 # test that we really took things away (just in case, happened twice somehow)
111 if (! -f 'META.yml') {
112 warn "No META.yml generated?! aborting...\n";
116 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
118 $meta =~ /^\Qname: DBIx-Class\E$/m or do {
119 warn "Seemingly malformed META.yml...?\n";
124 # this is safe as there is a fatal check earlier in the main Makefile.PL
125 # to make sure there are no duplicates (i.e. $opt_testdeps does not contain
126 # any real dependencies)
127 my @illegal_leftovers = grep
128 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
129 ( sort keys %$opt_testdeps )
132 if (@illegal_leftovers) {
134 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
135 map { "\t$_" } @illegal_leftovers
142 # keep the Makefile.PL eval happy