Make some travis confs smoke latest -dev offerings from CPAN
[dbsrgits/DBIx-Class.git] / maint / travis-ci_scripts / 30_before_script.bash
CommitLineData
b58ecb01 1#!/bin/bash
2
3source maint/travis-ci_scripts/common.bash
4if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
5
eed5492f 6# poison the environment - basically look through lib, find all mentioned
7# ENVvars and set them to true and see if anything explodes
8if [[ "$POISON_ENV" = "true" ]] ; then
9 for var in $(grep -P '\$ENV\{' -r lib/ | grep -oP 'DBIC_\w+' | sort -u | grep -v DBIC_TRACE) ; do
10 export $var=1
11 done
fb88ca2c 12
13 export DBICTEST_SQLITE_REVERSE_DEFAULT_ORDER=1
925a38ce 14elif [[ "$CLEANTEST" != "true" ]] && ( [[ -z "$BREWVER" ]] || [[ "$BREWVER" = "blead" ]] ) ; then
15 # try CPAN's latest offering on a stock perl and a threaded blead
16 # can't do this with CLEANTEST=true yet because a lot of our deps fail
17 # tests left and right under T::B 1.5
18 PERL_CPANM_OPT="$PERL_CPANM_OPT --dev"
992a24f6 19fi
20
21
b58ecb01 22if [[ "$CLEANTEST" = "true" ]]; then
23 # get the last inc/ off cpan - we will get rid of MI
24 # soon enough, but till then this will do
25 # the point is to have a *really* clean perl (the ones
26 # we build are guaranteed to be clean, without side
27 # effects from travis preinstalls)
28
29 # trick cpanm into executing true as shell - we just need the find+unpack
30 run_or_err "Downloading DBIC inc/ from CPAN" \
31 "SHELL=/bin/true cpanm --look DBIx::Class"
32
33 mv ~/.cpanm/latest-build/DBIx-Class-*/inc .
34
35 # older perls do not have a CPAN which understands configure_requires
36 # properly and what is worse a `cpan Foo` run exits with 0 even if some
37 # modules failed to install
38 # The first CPAN which is somewhat sane is around 1.94_56 (perl 5.12)
39 # The problem is that the first sane version also brings a *lot* of
40 # deps with it, notably things like YAML and HTTP::Tiny
41 # The goal of CLEANTEST is to have as little extra stuff installed as
42 # possible, mainly to catch "but X is perl core" mistakes
43 # So instead we still use our stock (possibly old) CPAN, and add some
44 # handholding
45 CPAN_is_sane || \
46 run_or_err "Pre-installing ExtUtils::MakeMaker and Module::Build" \
47 "cpan ExtUtils::MakeMaker Module::Build"
48
49 if ! perl -MModule::Build -e 1 &> /dev/null ; then
50 echo_err -e "Module::Build installation failed\n$LASTOUT"
51 exit 1
52 fi
53
54 # DBI has by far the longest test runtime - run less tests
55 # FIXME horrible horrible hack, need to implement in DBI itself
56 run_or_err "Downloading latest DBI distdir from CPAN" \
57 "SHELL=/bin/true cpanm --look DBI"
58 cd ~/.cpanm/latest-build/DBI-*/
59 perl -p -i -e 's/(create_.+?_tests) => 1/$1 => 0/' Makefile.PL
60 run_or_err "Pre-installing DBI, but running less tests" "perl Makefile.PL && make && make test && make install"
61 cd - &>/dev/null
62
63else
64 # we will be running all dbic tests - preinstall lots of stuff, run basic tests
65 # using SQLT and set up whatever databases necessary
66 export DBICTEST_SQLT_DEPLOY=1
67
68 # do the preinstall in several passes to minimize amount of cross-deps installing
69 # multiple times, and to avoid module re-architecture breaking another install
91d48c58 70 # (e.g. once Carp is upgraded there's no more Carp::Heavy,
71 # while a File::Path upgrade may cause a parallel EUMM run to fail)
b58ecb01 72 #
73 parallel_installdeps_notest ExtUtils::MakeMaker
91d48c58 74 parallel_installdeps_notest File::Path
b58ecb01 75 parallel_installdeps_notest Carp
435f9f82 76 parallel_installdeps_notest Module::Build ExtUtils::Depends
77 parallel_installdeps_notest Module::Runtime File::Spec Data::Dumper
5f7ad019 78 parallel_installdeps_notest Test::Exception Encode::Locale Test::Fatal
79 parallel_installdeps_notest Test::Warn bareword::filehandles B::Hooks::EndOfScope Test::Differences HTTP::Status
f5616614 80 parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities
2cf93a3d 81 parallel_installdeps_notest YAML LWP Class::Trigger JSON::XS DBI DateTime::Format::Builder Class::Accessor::Grouped Package::Variant
82 parallel_installdeps_notest Moose Module::Install JSON SQL::Translator
b58ecb01 83
f5616614 84 if [[ -n "DBICTEST_FIREBIRD_DSN" ]] ; then
b58ecb01 85 # the official version is full of 5.10-isms, but works perfectly fine on 5.8
86 # pull in our patched copy
87 run_or_err "Fetching patched DBD::Firebird" \
88 "git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird"
89
90 # the official version is very much outdated and does not compile on 5.14+
91 # use this rather updated source tree (needs to go to PAUSE):
92 # https://github.com/pilcrow/perl-dbd-interbase
93 run_or_err "Fetching patched DBD::InterBase" \
94 "git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase"
95
96 parallel_installdeps_notest ~/dbd-interbase/ ~/dbd-firebird/
97 fi
98
99fi
100
101# generate the makefile which will have different deps depending on
102# the runmode and envvars set above
103run_or_err "Configure on current branch" "perl Makefile.PL"
104
105# install (remaining) dependencies, sometimes with a gentle push
106if [[ "$CLEANTEST" = "true" ]]; then
107 # we may need to prepend some stuff to that list
108 HARD_DEPS="$(echo $(make listdeps))"
109
110 # this is a fucked CPAN - won't understand configure_requires of
111 # various pieces we may run into
112 CPAN_is_sane || HARD_DEPS="ExtUtils::Depends B::Hooks::OP::Check $HARD_DEPS"
113
114##### TEMPORARY WORKAROUNDS
115
71dd2ecc 116 # The unicode-in-yaml bug on older cpan clients
117 # FIXME there got to be a saner way to fix this...
b58ecb01 118 perl -M5.008008 -e 1 &> /dev/null || \
71dd2ecc 119 run_or_err "Installing multidimensional and bareword::filehandles via cpanm" \
120 "cpanm multidimensional bareword::filehandles"
b58ecb01 121
122 # work around Params::Validate not having a Makefile.PL so really old
123 # toolchains can not figure out what the prereqs are ;(
124 # Need to do more research before filing a bug requesting Makefile inclusion
125 perl -M5.008008 -e 1 &> /dev/null || \
126 HARD_DEPS="$(extract_prereqs Params::Validate) $HARD_DEPS"
127
128##### END TEMPORARY WORKAROUNDS
129
5cbe5b12 130 run_or_err "Installing/testing dependencies (may take up to 3 minutes): $HARD_DEPS" "cpan $HARD_DEPS"
b58ecb01 131
132 # this is a fucked CPAN - save the log as we may need it
133 CPAN_is_sane || INSTALLDEPS_OUT="$LASTOUT"
134
135else
136 # listalldeps is deliberate - will upgrade everything it can find
137 parallel_installdeps_notest $(make listalldeps)
992a24f6 138
139 if [[ -n "$TEST_BUILDER_BETA_CPAN_TARBALL" ]] ; then
140 parallel_installdeps_notest $TEST_BUILDER_BETA_CPAN_TARBALL
141 fi
b58ecb01 142fi
143
144echo_err "$(tstamp) Dependency configuration finished"
145# this will display list of available versions
146perl Makefile.PL
147
148# make sure we got everything we need
149if [[ -n "$(make listdeps)" ]] ; then
150 echo_err "$(tstamp) Not all deps installed - something went wrong :("
151 sleep 1 # without this the echo below confuses the console listener >.<
152 CPAN_is_sane || echo_err -e "Outdated CPAN.pm used - full logs follows\n$INSTALLDEPS_OUT\n\nSearch for 'NOT OK' in the text above\n\nDeps still missing:"
153 sleep 3 # without this the above echo confuses the console listener >.<
154 make listdeps
155 exit 1
156fi
157
158# announce what are we running
159echo_err "
160===================== DEPENDENCY CONFIGURATION COMPLETE =====================
161$(tstamp) Configuration phase seems to have taken $(date -ud "@$SECONDS" '+%H:%M:%S') (@$SECONDS)
162
163= CPUinfo
164$(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
165
166= Meminfo
167$(free -m -t)
168
169= Environment
170$(env | grep -P 'TEST|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
171
172= Perl in use
173$(perl -V)
174============================================================================="