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;
35 my %reqs_for_group = %{DBIx::Class::Optional::Dependencies->req_group_list};
37 # exclude the rdbms_* groups which are for DBIC users
38 # and the moose-related stuff iff we are under 5.8.3
40 map { %{$reqs_for_group{$_}} } grep {
43 ($] > 5.008002 or !/^ (?: test_ )? (?: admin | admin_script | replicated ) $/x )
44 } keys %reqs_for_group
47 print "Including all optional deps\n";
48 $reqs->{test_requires} = {
49 %{$reqs->{test_requires}},
54 # nasty hook into both M::AI init and the prompter, so that the optdep message
55 # comes at the right places (on top and then right above the prompt)
57 require Module::AutoInstall;
58 no warnings 'redefine';
61 for (qw/_prompt import/) {
62 my $meth = "Module::AutoInstall::$_";
71 # this will run after the Makefile is written and the main Makefile.PL terminates
74 # shit already hit the fan
77 # Re-write META.yml at the end to _exclude_ all forced build-requires (we do not
78 # want to ship this) We are also not using M::I::AuthorRequires as this will be
79 # an extra dep, and deps in Makefile.PL still suck
80 # Also always test the result so we stop shipping borked dependency lists to CPAN
82 # FIXME test_requires is not yet part of META
83 my %original_build_requires = ( %$build_requires, %$test_requires );
84 my @all_build_requires = @{delete Meta->{values}{build_requires}||[]};
85 my %removed_build_requires;
87 for (@all_build_requires) {
88 if ($original_build_requires{$_->[0]}) {
89 push @{Meta->{values}{build_requires}}, $_;
92 $removed_build_requires{$_->[0]} = $_->[1]
93 unless $_->[0] eq 'ExtUtils::MakeMaker';
97 if (keys %removed_build_requires) {
98 print "Regenerating META with author requires excluded\n";
99 # M::I understands unicode in meta but does not write with the right
101 local $SIG{__WARN__} = sub { warn $_[0] unless $_[0] =~ /Wide character in print/ };
105 # strip possible crlf from META
106 if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
107 local $ENV{PERLIO} = 'unix';
108 system( $^X, qw( -MExtUtils::Command -e dos2unix -- META.yml), );
111 # test that we really took things away (just in case, happened twice somehow)
112 if (! -f 'META.yml') {
113 warn "No META.yml generated?! aborting...\n";
117 my $meta = do { local @ARGV = 'META.yml'; local $/; <> };
119 $meta =~ /^\Qname: DBIx-Class\E$/m or do {
120 warn "Seemingly malformed META.yml...?\n";
125 # this is safe as there is a fatal check earlier in the main Makefile.PL
126 # to make sure there are no duplicates (i.e. $opt_testdeps does not contain
127 # any real dependencies)
128 my @illegal_leftovers = grep
129 { $meta =~ /^ \s+ \Q$_\E \: \s+ /mx }
130 ( sort keys %$opt_testdeps )
133 if (@illegal_leftovers) {
135 "\n\nFATAL FAIL! It looks like some author dependencies made it to the META.yml:\n",
136 map { "\t$_" } @illegal_leftovers
143 # keep the Makefile.PL eval happy