1 my ($optdep_msg, $opt_testdeps);
3 unless ($args->{with_optdeps}) {
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 may want to aim at running more tests by re-configuring via: ***
14 *** perl Makefile.PL --with-optdeps ***
16 *** which will install all optional dependencies. This is not a mandatory ***
17 *** step - the extensive CI setup will likely catch your mistakes anyway. ***
19 ******************************************************************************
20 ******************************************************************************
25 $optdep_msg = <<'EOW';
27 ******************************************************************************
28 ******************************************************************************
30 *** --with-optdeps specified: converting all optional test dependencies to ***
31 *** hard requires ( to disable re-run Makefile.PL without options ) ***
33 ******************************************************************************
34 ******************************************************************************
38 require DBIx::Class::Optional::Dependencies;
40 # exclude the rdbms_* groups which are for DBIC users
41 # and the moose-related stuff iff we are under 5.8.3
42 $opt_testdeps = DBIx::Class::Optional::Dependencies->req_list_for([
46 ( "$]" > 5.008002 or !/^ (?: test_ )? (?: admin | admin_script | replicated ) $/x )
47 } keys %{DBIx::Class::Optional::Dependencies->req_group_list}
50 # this one is "special" - we need it both in optdeps and as a hard dep
51 delete $opt_testdeps->{'DBD::SQLite'};
53 print "Including all optional deps\n";
54 $reqs->{test_requires} = {
55 %{$reqs->{test_requires}},
60 # nasty hook into both M::AI init and the prompter, so that the optdep message
61 # comes at the right places (on top and then right above the prompt)
63 require Module::AutoInstall;
64 no warnings 'redefine';
67 for (qw/_prompt import/) {
68 my $meth = "Module::AutoInstall::$_";
77 # this will run after the Makefile is written and the main Makefile.PL terminates
80 # shit already hit the fan
83 # Re-write META.yml at the end to _exclude_ all forced build-requires (we do not
84 # want to ship this) We are also not using M::I::AuthorRequires as this will be
85 # an extra dep, and deps in Makefile.PL still suck
86 # Also always test the result so we stop shipping borked dependency lists to CPAN
88 # FIXME test_requires is not yet part of META
89 my %original_build_requires = ( %$build_requires, %$test_requires );
90 my @all_build_requires = @{delete Meta->{values}{build_requires}||[]};
91 my %removed_build_requires;
93 for (@all_build_requires) {
94 if ($original_build_requires{$_->[0]}) {
95 push @{Meta->{values}{build_requires}}, $_;
98 $removed_build_requires{$_->[0]} = $_->[1]
99 unless $_->[0] eq 'ExtUtils::MakeMaker';
103 if (keys %removed_build_requires) {
104 print "Regenerating META with author requires excluded\n";
105 # M::I understands unicode in meta but does not write with the right
107 local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ };
111 # strip possible crlf from META
112 if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
113 local $ENV{PERLIO} = 'unix';
114 system( $^X, qw( -MExtUtils::Command -e dos2unix -- META.yml), );
117 # test that we really took things away (just in case, happened twice somehow)
118 if (! -f 'META.yml') {
119 warn "No META.yml generated?! aborting...\n";
123 my $meta = do { local (@ARGV, $/) = 'META.yml'; <> };
125 $meta =~ /^\Qname: DBIx-Class\E$/m or do {
126 warn "Seemingly malformed META.yml...?\n";
131 # this is safe as there is a fatal check earlier in the main Makefile.PL
132 # to make sure there are no duplicates (i.e. $opt_testdeps does not contain
133 # any real dependencies)
134 my @illegal_leftovers = grep
135 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
136 ( sort keys %$opt_testdeps )
139 if (@illegal_leftovers) {
141 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
142 map { "\t$_" } @illegal_leftovers
149 # keep the Makefile.PL eval happy