3 source maint/travis-ci_scripts/common.bash
4 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
6 # try Schwern's latest offering on a stock perl and a threaded blead
7 # can't do this with CLEANTEST=true yet because a lot of our deps fail
8 # tests left and right under T::B 1.5
9 if [[ "$CLEANTEST" != "true" ]] && ( [[ -z "$BREWVER" ]] || [[ "$BREWVER" = "blead" ]] ) ; then
10 # FIXME - there got to be a way to ask metacpan for this dynamically
11 TEST_BUILDER_BETA_CPAN_TARBALL="M/MS/MSCHWERN/Test-Simple-1.005000_005.tar.gz"
15 if [[ "$CLEANTEST" = "true" ]]; then
16 # get the last inc/ off cpan - we will get rid of MI
17 # soon enough, but till then this will do
18 # the point is to have a *really* clean perl (the ones
19 # we build are guaranteed to be clean, without side
20 # effects from travis preinstalls)
22 # trick cpanm into executing true as shell - we just need the find+unpack
23 run_or_err "Downloading DBIC inc/ from CPAN" \
24 "SHELL=/bin/true cpanm --look DBIx::Class"
26 mv ~/.cpanm/latest-build/DBIx-Class-*/inc .
28 # this should be installable anywhere, regardles of prereqs
29 if [[ -n "$TEST_BUILDER_BETA_CPAN_TARBALL" ]] ; then
30 run_or_err "Pre-installing dev-beta of Test::Builder ($TEST_BUILDER_BETA_CPAN_TARBALL)" \
31 "cpan $TEST_BUILDER_BETA_CPAN_TARBALL"
34 # older perls do not have a CPAN which understands configure_requires
35 # properly and what is worse a `cpan Foo` run exits with 0 even if some
36 # modules failed to install
37 # The first CPAN which is somewhat sane is around 1.94_56 (perl 5.12)
38 # The problem is that the first sane version also brings a *lot* of
39 # deps with it, notably things like YAML and HTTP::Tiny
40 # The goal of CLEANTEST is to have as little extra stuff installed as
41 # possible, mainly to catch "but X is perl core" mistakes
42 # So instead we still use our stock (possibly old) CPAN, and add some
45 run_or_err "Pre-installing ExtUtils::MakeMaker and Module::Build" \
46 "cpan ExtUtils::MakeMaker Module::Build"
48 if ! perl -MModule::Build -e 1 &> /dev/null ; then
49 echo_err -e "Module::Build installation failed\n$LASTOUT"
53 # DBI has by far the longest test runtime - run less tests
54 # FIXME horrible horrible hack, need to implement in DBI itself
55 run_or_err "Downloading latest DBI distdir from CPAN" \
56 "SHELL=/bin/true cpanm --look DBI"
57 cd ~/.cpanm/latest-build/DBI-*/
58 perl -p -i -e 's/(create_.+?_tests) => 1/$1 => 0/' Makefile.PL
59 run_or_err "Pre-installing DBI, but running less tests" "perl Makefile.PL && make && make test && make install"
63 # we will be running all dbic tests - preinstall lots of stuff, run basic tests
64 # using SQLT and set up whatever databases necessary
65 export DBICTEST_SQLT_DEPLOY=1
67 # do the preinstall in several passes to minimize amount of cross-deps installing
68 # multiple times, and to avoid module re-architecture breaking another install
69 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
71 parallel_installdeps_notest ExtUtils::MakeMaker
72 parallel_installdeps_notest Carp
73 parallel_installdeps_notest Module::Build ExtUtils::Depends
74 parallel_installdeps_notest Module::Runtime File::Spec Data::Dumper
75 parallel_installdeps_notest Test::Exception Encode::Locale Test::Fatal
76 parallel_installdeps_notest Test::Warn bareword::filehandles B::Hooks::EndOfScope Test::Differences HTTP::Status
77 parallel_installdeps_notest Test::Pod::Coverage Test::EOL Devel::GlobalDestruction Sub::Name MRO::Compat Class::XSAccessor URI::Escape HTML::Entities
78 parallel_installdeps_notest YAML LWP Moose Class::Trigger JSON::XS DBI
79 parallel_installdeps_notest Moo Class::Accessor::Grouped Module::Install JSON DateTime
81 if [[ -n "DBICTEST_FIREBIRD_DSN" ]] ; then
82 # the official version is full of 5.10-isms, but works perfectly fine on 5.8
83 # pull in our patched copy
84 run_or_err "Fetching patched DBD::Firebird" \
85 "git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird"
87 # the official version is very much outdated and does not compile on 5.14+
88 # use this rather updated source tree (needs to go to PAUSE):
89 # https://github.com/pilcrow/perl-dbd-interbase
90 run_or_err "Fetching patched DBD::InterBase" \
91 "git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase"
93 parallel_installdeps_notest ~/dbd-interbase/ ~/dbd-firebird/
98 # generate the makefile which will have different deps depending on
99 # the runmode and envvars set above
100 run_or_err "Configure on current branch" "perl Makefile.PL"
102 # install (remaining) dependencies, sometimes with a gentle push
103 if [[ "$CLEANTEST" = "true" ]]; then
104 # we may need to prepend some stuff to that list
105 HARD_DEPS="$(echo $(make listdeps))"
107 # this is a fucked CPAN - won't understand configure_requires of
108 # various pieces we may run into
109 CPAN_is_sane || HARD_DEPS="ExtUtils::Depends B::Hooks::OP::Check $HARD_DEPS"
111 ##### TEMPORARY WORKAROUNDS
113 # The unicode-in-yaml bug on older cpan clients
114 # FIXME there got to be a saner way to fix this...
115 perl -M5.008008 -e 1 &> /dev/null || \
116 run_or_err "Installing multidimensional and bareword::filehandles via cpanm" \
117 "cpanm multidimensional bareword::filehandles"
119 # work around Params::Validate not having a Makefile.PL so really old
120 # toolchains can not figure out what the prereqs are ;(
121 # Need to do more research before filing a bug requesting Makefile inclusion
122 perl -M5.008008 -e 1 &> /dev/null || \
123 HARD_DEPS="$(extract_prereqs Params::Validate) $HARD_DEPS"
125 ##### END TEMPORARY WORKAROUNDS
127 run_or_err "Installing/testing dependencies (may take up to 3 minutes): $HARD_DEPS" "cpan $HARD_DEPS"
129 # this is a fucked CPAN - save the log as we may need it
130 CPAN_is_sane || INSTALLDEPS_OUT="$LASTOUT"
133 # listalldeps is deliberate - will upgrade everything it can find
134 parallel_installdeps_notest $(make listalldeps)
136 if [[ -n "$TEST_BUILDER_BETA_CPAN_TARBALL" ]] ; then
137 parallel_installdeps_notest $TEST_BUILDER_BETA_CPAN_TARBALL
141 echo_err "$(tstamp) Dependency configuration finished"
142 # this will display list of available versions
145 # make sure we got everything we need
146 if [[ -n "$(make listdeps)" ]] ; then
147 echo_err "$(tstamp) Not all deps installed - something went wrong :("
148 sleep 1 # without this the echo below confuses the console listener >.<
149 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:"
150 sleep 3 # without this the above echo confuses the console listener >.<
155 # announce what are we running
157 ===================== DEPENDENCY CONFIGURATION COMPLETE =====================
158 $(tstamp) Configuration phase seems to have taken $(date -ud "@$SECONDS" '+%H:%M:%S') (@$SECONDS)
161 $(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
167 $(env | grep -P 'TEST|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
171 ============================================================================="