Commit | Line | Data |
737416a4 |
1 | use inc::Module::Install 0.67; |
fe650234 |
2 | use strict; |
3 | use warnings; |
76607ac8 |
4 | use POSIX (); |
fe650234 |
5 | |
6 | use 5.006001; # delete this line if you want to send patches for earlier. |
ce4c07df |
7 | |
8 | name 'DBIx-Class'; |
ce4c07df |
9 | perl_version '5.006001'; |
8e0f16f1 |
10 | all_from 'lib/DBIx/Class.pm'; |
ce4c07df |
11 | |
f9dc732b |
12 | requires 'DBD::SQLite' => 1.23; |
82fae370 |
13 | requires 'Data::Page' => 2.00; |
14 | requires 'Scalar::Util' => 0; |
2d60be4d |
15 | requires 'SQL::Abstract' => 1.51; |
82fae370 |
16 | requires 'SQL::Abstract::Limit' => 0.13; |
624764ae |
17 | requires 'Class::C3::Componentised' => 1.0005; |
82fae370 |
18 | requires 'Storable' => 0; |
19 | requires 'Carp::Clan' => 0; |
20 | requires 'DBI' => 1.40; |
21 | requires 'Module::Find' => 0; |
22 | requires 'Class::Inspector' => 0; |
2d60be4d |
23 | requires 'Class::Accessor::Grouped' => 0.08003; |
82fae370 |
24 | requires 'JSON::Any' => 1.17; |
25 | requires 'Scope::Guard' => 0.03; |
26 | requires 'Path::Class' => 0; |
27 | requires 'List::Util' => 1.19; |
28 | requires 'Sub::Name' => 0.04; |
0fdb7298 |
29 | requires 'MRO::Compat' => 0.09; |
ce4c07df |
30 | |
31 | # Perl 5.8.0 doesn't have utf8::is_utf8() |
82fae370 |
32 | requires 'Encode' => 0 if ($] <= 5.008000); |
ce4c07df |
33 | |
9ac2c0f8 |
34 | # configure_requires so the sanity check below can run |
f9dc732b |
35 | configure_requires 'DBD::SQLite'; |
d9a898ca |
36 | |
f947585b |
37 | test_requires 'Test::Builder' => 0.33; |
97aca715 |
38 | test_requires 'Test::Warn' => 0.11; |
f947585b |
39 | test_requires 'Test::Exception' => 0; |
ce3b4eb9 |
40 | test_requires 'Test::Deep' => 0; |
ce4c07df |
41 | |
82fae370 |
42 | recommends 'SQL::Translator' => 0.09004; |
43 | |
ce4c07df |
44 | install_script 'script/dbicadmin'; |
45 | |
50891152 |
46 | tests_recursive 't'; |
ce4c07df |
47 | |
c96454c3 |
48 | # re-build README and require extra modules for testing if we're in a checkout |
fe650234 |
49 | |
82fae370 |
50 | my %force_requires_if_author = ( |
c96454c3 |
51 | 'Test::Pod::Coverage' => 1.04, |
9ac2c0f8 |
52 | 'SQL::Translator' => 0.09004, |
53 | |
54 | # CDBI-compat related |
82fae370 |
55 | 'DBIx::ContextualFetch' => 0, |
602fd807 |
56 | 'Class::DBI::Plugin::DeepAbstractSearch' => 0, |
82fae370 |
57 | 'Class::Trigger' => 0, |
58 | 'Time::Piece' => 0, |
59 | 'Clone' => 0, |
9ac2c0f8 |
60 | |
61 | # t/52cycle.t |
82fae370 |
62 | 'Test::Memory::Cycle' => 0, |
9ac2c0f8 |
63 | |
c96454c3 |
64 | # t/60core.t |
65 | 'DateTime::Format::MySQL' => 0, |
66 | |
9d2b098e |
67 | # t/72pg.t |
68 | $ENV{DBICTEST_PG_DSN} |
69 | ? ('Sys::SigAction'=> 0) |
70 | : () |
71 | , |
72 | |
9ac2c0f8 |
73 | # t/93storage_replication.t |
74 | 'Moose', => 0, |
75 | 'MooseX::AttributeHelpers' => 0.12, |
c96454c3 |
76 | |
77 | # t/96_is_deteministic_value.t |
78 | 'DateTime::Format::Strptime' => 0, |
fe650234 |
79 | ); |
80 | |
81 | if ($Module::Install::AUTHOR) { |
82 | |
82fae370 |
83 | foreach my $module (keys %force_requires_if_author) { |
6882de2b |
84 | build_requires ($module => $force_requires_if_author{$module}); |
fe650234 |
85 | } |
09d46657 |
86 | |
1543db24 |
87 | system('pod2text lib/DBIx/Class.pm > README'); |
ff132c6f |
88 | } |
89 | |
90 | auto_provides; |
91 | |
d7fda552 |
92 | if ($Module::Install::AUTHOR) { |
93 | warn <<'EOW'; |
94 | ****************************************************************************** |
95 | ****************************************************************************** |
96 | *** *** |
97 | *** AUTHOR MODE: all optional test dependencies converted to hard requires *** |
98 | *** *** |
99 | ****************************************************************************** |
100 | ****************************************************************************** |
101 | |
102 | EOW |
103 | } |
3e110410 |
104 | auto_install; |
105 | |
e0b438fb |
106 | # Have all prerequisites, check DBD::SQLite sanity |
269228af |
107 | if (! $ENV{DBICTEST_NO_SQLITE_CHECK} ) { |
108 | |
e0b438fb |
109 | my $pid = fork(); |
110 | if (not defined $pid) { |
111 | die "Unable to fork(): $!"; |
112 | } |
113 | elsif (! $pid) { |
269228af |
114 | |
115 | # Win32 does not have real fork()s so a segfault will bring |
116 | # everything down. Warn about it. |
117 | if ($^O eq 'MSWin32') { |
118 | print <<'EOW'; |
119 | |
120 | ###################################################################### |
121 | # # |
122 | # A short stress-testing of DBD::SQLite will follow. If you have a # |
123 | # buggy library this might very well be the last text you will see # |
124 | # before the installation silently terminates. If this happens it # |
125 | # would mean that you are running a buggy version of DBD::SQLite # |
126 | # known to randomly segfault on errors. Even if you have the latest # |
3951a291 |
127 | # CPAN module version, the system sqlite3 dynamic library might have # |
128 | # been compiled against an older buggy sqlite3 dev library (oddly # |
129 | # DBD::SQLite will prefer the system library against the one bundled # |
130 | # with it). You are strongly advised to resolve this issue before # |
131 | # proceeding. # |
269228af |
132 | # # |
133 | # If this happens to you (this text is the last thing you see), and # |
134 | # you just want to install this module without worrying about the # |
135 | # tests (which will almost certainly fail) - set the environment # |
136 | # variable DBICTEST_NO_SQLITE_CHECK to a true value and try again. # |
137 | # # |
138 | ###################################################################### |
139 | |
140 | EOW |
141 | } |
142 | |
e0b438fb |
143 | require DBI; |
269228af |
144 | for (1 .. 100) { |
e0b438fb |
145 | my $dbh; |
146 | $dbh = DBI->connect ('dbi:SQLite::memory:', undef, undef, { |
147 | AutoCommit => 1, |
148 | RaiseError => 0, |
149 | PrintError => 0, |
150 | }) |
151 | or die "Unable to connect to database: $@"; |
152 | $dbh->do ('CREATE TABLE name_with_no_columns'); # a subtle syntax error |
153 | $dbh->do ('COMMIT'); # followed by commit |
154 | $dbh->disconnect; |
155 | } |
156 | |
157 | exit 0; |
158 | } |
159 | else { |
76607ac8 |
160 | eval { |
161 | local $SIG{ALRM} = sub { die "timeout\n" }; |
162 | alarm 5; |
163 | wait(); |
164 | alarm 0; |
165 | }; |
7a0e56cb |
166 | my $exception = $@; |
167 | |
e0b438fb |
168 | my $sig = $? & 127; |
7a0e56cb |
169 | |
170 | # make sure process actually dies |
171 | $exception && kill POSIX::SIGKILL(), $pid; |
172 | |
173 | if ($exception || $sig == POSIX::SIGSEGV() || $sig == POSIX::SIGABRT() |
3c086319 |
174 | || $sig == 7) { # 7 == SIGBUS, haven't seen it but just in case |
e0b438fb |
175 | warn (<<EOE); |
176 | |
3951a291 |
177 | ############################### WARNING ################################# |
178 | # # |
179 | # You are running a buggy version of DBD::SQLite known to randomly # |
180 | # segfault on errors. Even if you have the latest CPAN module version, # |
181 | # the sqlite3 dynamic library on this system might have been compiled # |
182 | # against an older buggy sqlite3 dev library (oddly DBD::SQLite will # |
183 | # prefer the system library against the one bundled with it). You are # |
184 | # strongly advised to resolve this issue before proceeding. # |
185 | # # |
186 | ######################################################################### |
e0b438fb |
187 | |
188 | EOE |
189 | my $ans = prompt ( |
190 | "The test suite of this module is almost certain to fail.\n" |
191 | . 'Do you really want to continue?', |
192 | 'no', |
193 | ); |
194 | exit 0 unless ($ans =~ /^y(es)?$/i); |
195 | } |
196 | } |
197 | } |
198 | |
199 | |
43944e47 |
200 | WriteAll(); |
09d46657 |
201 | |
202 | |
203 | if ($Module::Install::AUTHOR) { |
e22999bf |
204 | # Need to do this _after_ WriteAll else it loses track of them |
09d46657 |
205 | Meta->{values}{build_requires} = [ grep { |
fe650234 |
206 | my $ok = 1; |
82fae370 |
207 | foreach my $module (keys %force_requires_if_author) { |
fe650234 |
208 | if ($_->[0] =~ /$module/) { |
209 | $ok = 0; |
210 | last; |
211 | } |
212 | } |
213 | $ok; |
09d46657 |
214 | } @{Meta->{values}{build_requires}} ]; |
215 | |
216 | my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys(); |
fe650234 |
217 | my $cr = Module::Install::Metadata->can("Meta_TupleKeys"); |
218 | { |
219 | no warnings 'redefine'; |
220 | *Module::Install::Metadata::Meta_TupleKeys = sub { |
221 | return $cr->(@_), 'resources'; |
222 | }; |
09d46657 |
223 | } |
224 | Meta->{values}{resources} = [ |
225 | [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ], |
226 | [ 'IRC', 'irc://irc.perl.org/#dbix-class' ], |
100dd0a8 |
227 | [ 'license', 'http://dev.perl.org/licenses/' ], |
228 | [ 'repository', 'http://dev.catalyst.perl.org/svnweb/bast/browse/DBIx-Class/' ], |
09d46657 |
229 | ]; |
230 | Meta->write; |
231 | } |
9a3219ee |
232 | |