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 # this one is "special" - we need it both in optdeps and as a hard dep
47 delete $opt_testdeps->{'DBD::SQLite'};
49 print "Including all optional deps\n";
50 $reqs->{test_requires} = {
51 %{$reqs->{test_requires}},
56 # nasty hook into both M::AI init and the prompter, so that the optdep message
57 # comes at the right places (on top and then right above the prompt)
59 require Module::AutoInstall;
60 no warnings 'redefine';
63 for (qw/_prompt import/) {
64 my $meth = "Module::AutoInstall::$_";
73 # this will run after the Makefile is written and the main Makefile.PL terminates
76 # shit already hit the fan
79 # Re-write META.yml at the end to _exclude_ all forced build-requires (we do not
80 # want to ship this) We are also not using M::I::AuthorRequires as this will be
81 # an extra dep, and deps in Makefile.PL still suck
82 # Also always test the result so we stop shipping borked dependency lists to CPAN
84 # FIXME test_requires is not yet part of META
85 my %original_build_requires = ( %$build_requires, %$test_requires );
86 my @all_build_requires = @{delete Meta->{values}{build_requires}||[]};
87 my %removed_build_requires;
89 for (@all_build_requires) {
90 if ($original_build_requires{$_->[0]}) {
91 push @{Meta->{values}{build_requires}}, $_;
94 $removed_build_requires{$_->[0]} = $_->[1]
95 unless $_->[0] eq 'ExtUtils::MakeMaker';
99 if (keys %removed_build_requires) {
100 print "Regenerating META with author requires excluded\n";
101 # M::I understands unicode in meta but does not write with the right
103 local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ };
107 # strip possible crlf from META
108 if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
109 local $ENV{PERLIO} = 'unix';
110 system( $^X, qw( -MExtUtils::Command -e dos2unix -- META.yml), );
113 # test that we really took things away (just in case, happened twice somehow)
114 if (! -f 'META.yml') {
115 warn "No META.yml generated?! aborting...\n";
119 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
121 $meta =~ /^\Qname: DBIx-Class\E$/m or do {
122 warn "Seemingly malformed META.yml...?\n";
127 # this is safe as there is a fatal check earlier in the main Makefile.PL
128 # to make sure there are no duplicates (i.e. $opt_testdeps does not contain
129 # any real dependencies)
130 my @illegal_leftovers = grep
131 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
132 ( sort keys %$opt_testdeps )
135 if (@illegal_leftovers) {
137 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
138 map { "\t$_" } @illegal_leftovers
145 # keep the Makefile.PL eval happy