3 source maint/travis-ci_scripts/common.bash
4 if [[ -n "$SHORT_CIRCUIT_SMOKE" ]] ; then return ; fi
6 if [[ "$CLEANTEST" = "true" ]]; then
7 # get the last inc/ off cpan - we will get rid of MI
8 # soon enough, but till then this will do
9 # the point is to have a *really* clean perl (the ones
10 # we build are guaranteed to be clean, without side
11 # effects from travis preinstalls)
13 # trick cpanm into executing true as shell - we just need the find+unpack
14 run_or_err "Downloading DBIC inc/ from CPAN" \
15 "SHELL=/bin/true cpanm --look DBIx::Class"
17 mv ~/.cpanm/latest-build/DBIx-Class-*/inc .
19 # older perls do not have a CPAN which understands configure_requires
20 # properly and what is worse a `cpan Foo` run exits with 0 even if some
21 # modules failed to install
22 # The first CPAN which is somewhat sane is around 1.94_56 (perl 5.12)
23 # The problem is that the first sane version also brings a *lot* of
24 # deps with it, notably things like YAML and HTTP::Tiny
25 # The goal of CLEANTEST is to have as little extra stuff installed as
26 # possible, mainly to catch "but X is perl core" mistakes
27 # So instead we still use our stock (possibly old) CPAN, and add some
30 run_or_err "Pre-installing ExtUtils::MakeMaker and Module::Build" \
31 "cpan ExtUtils::MakeMaker Module::Build"
33 if ! perl -MModule::Build -e 1 &> /dev/null ; then
34 echo_err -e "Module::Build installation failed\n$LASTOUT"
38 # DBI has by far the longest test runtime - run less tests
39 # FIXME horrible horrible hack, need to implement in DBI itself
40 run_or_err "Downloading latest DBI distdir from CPAN" \
41 "SHELL=/bin/true cpanm --look DBI"
42 cd ~/.cpanm/latest-build/DBI-*/
43 perl -p -i -e 's/(create_.+?_tests) => 1/$1 => 0/' Makefile.PL
44 run_or_err "Pre-installing DBI, but running less tests" "perl Makefile.PL && make && make test && make install"
48 # we will be running all dbic tests - preinstall lots of stuff, run basic tests
49 # using SQLT and set up whatever databases necessary
50 export DBICTEST_SQLT_DEPLOY=1
52 # do the preinstall in several passes to minimize amount of cross-deps installing
53 # multiple times, and to avoid module re-architecture breaking another install
54 # (e.g. once Carp is upgraded there's no more Carp::Heavy)
56 parallel_installdeps_notest ExtUtils::MakeMaker
57 parallel_installdeps_notest Carp
58 parallel_installdeps_notest Module::Build
59 parallel_installdeps_notest Module::Runtime ExtUtils::Depends File::Spec Data::Dumper
60 parallel_installdeps_notest Test::Exception LWP
61 parallel_installdeps_notest Test::Fatal Test::Warn bareword::filehandles
62 parallel_installdeps_notest namespace::clean Class::XSAccessor MRO::Compat
63 parallel_installdeps_notest DBD::SQLite Moo Class::Accessor::Grouped
64 parallel_installdeps_notest Module::Install DateTime::Format::Strptime
65 parallel_installdeps_notest JSON::DWIW JSON JSON::XS Test::Pod::Coverage Test::EOL
66 parallel_installdeps_notest MooseX::Types JSON::Any Class::DBI
68 if [[ -n "DBICTEST_FIREBIRD_DSN" ]] ; then
69 # the official version is full of 5.10-isms, but works perfectly fine on 5.8
70 # pull in our patched copy
71 run_or_err "Fetching patched DBD::Firebird" \
72 "git clone https://github.com/dbsrgits/perl-dbd-firebird-5.8.git ~/dbd-firebird"
74 # the official version is very much outdated and does not compile on 5.14+
75 # use this rather updated source tree (needs to go to PAUSE):
76 # https://github.com/pilcrow/perl-dbd-interbase
77 run_or_err "Fetching patched DBD::InterBase" \
78 "git clone https://github.com/dbsrgits/perl-dbd-interbase ~/dbd-interbase"
80 parallel_installdeps_notest ~/dbd-interbase/ ~/dbd-firebird/
85 # generate the makefile which will have different deps depending on
86 # the runmode and envvars set above
87 run_or_err "Configure on current branch" "perl Makefile.PL"
89 # install (remaining) dependencies, sometimes with a gentle push
90 if [[ "$CLEANTEST" = "true" ]]; then
91 # we may need to prepend some stuff to that list
92 HARD_DEPS="$(echo $(make listdeps))"
94 # this is a fucked CPAN - won't understand configure_requires of
95 # various pieces we may run into
96 CPAN_is_sane || HARD_DEPS="ExtUtils::Depends B::Hooks::OP::Check $HARD_DEPS"
98 ##### TEMPORARY WORKAROUNDS
100 # The unicode-in-yaml bug on older cpan clients
101 # FIXME there got to be a saner way to fix this...
102 perl -M5.008008 -e 1 &> /dev/null || \
103 run_or_err "Installing multidimensional and bareword::filehandles via cpanm" \
104 "cpanm multidimensional bareword::filehandles"
106 # work around Params::Validate not having a Makefile.PL so really old
107 # toolchains can not figure out what the prereqs are ;(
108 # Need to do more research before filing a bug requesting Makefile inclusion
109 perl -M5.008008 -e 1 &> /dev/null || \
110 HARD_DEPS="$(extract_prereqs Params::Validate) $HARD_DEPS"
112 ##### END TEMPORARY WORKAROUNDS
114 run_or_err "Installing/testing dependencies (may take up to 3 minutes): $HARD_DEPS" "cpan $HARD_DEPS"
116 # this is a fucked CPAN - save the log as we may need it
117 CPAN_is_sane || INSTALLDEPS_OUT="$LASTOUT"
120 # listalldeps is deliberate - will upgrade everything it can find
121 parallel_installdeps_notest $(make listalldeps)
124 echo_err "$(tstamp) Dependency configuration finished"
125 # this will display list of available versions
128 # make sure we got everything we need
129 if [[ -n "$(make listdeps)" ]] ; then
130 echo_err "$(tstamp) Not all deps installed - something went wrong :("
131 sleep 1 # without this the echo below confuses the console listener >.<
132 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:"
133 sleep 3 # without this the above echo confuses the console listener >.<
138 # announce what are we running
140 ===================== DEPENDENCY CONFIGURATION COMPLETE =====================
141 $(tstamp) Configuration phase seems to have taken $(date -ud "@$SECONDS" '+%H:%M:%S') (@$SECONDS)
144 $(perl -0777 -p -e 's/.+\n\n(?!\z)//s' < /proc/cpuinfo)
150 $(env | grep -P 'TEST|TRAVIS|PERL|DBIC' | LC_ALL=C sort | cat -v)
154 ============================================================================="