dev-perl/DBD-Pg: arm stable wrt bug #657210
[gentoo.git] / dev-perl / DBD-Pg / DBD-Pg-3.7.0.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 DIST_AUTHOR=TURNSTEP
7 inherit perl-module
8
9 DESCRIPTION="PostgreSQL database driver for the DBI module"
10
11 SLOT="0"
12 KEYWORDS="alpha amd64 arm ~hppa ia64 ~mips ppc ppc64 ~s390 ~sh ~sparc x86 ~ppc-aix ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
13 IUSE=""
14
15 RDEPEND="
16         virtual/perl-version
17         >=dev-perl/DBI-1.614.0
18         dev-db/postgresql:*
19 "
20 DEPEND="${RDEPEND}
21         virtual/perl-ExtUtils-MakeMaker
22 "
23 src_prepare() {
24         postgres_include="$(readlink -f "${EPREFIX}"/usr/include/postgresql)"
25         postgres_lib="${postgres_include//include/lib}"
26         # Fall-through case is the non-split postgresql
27         # The active cases instead get us the matching libdir for the includedir.
28         for i in lib lib64 ; do
29                 if [ -d "${postgres_lib}/${i}" ]; then
30                         postgres_lib="${postgres_lib}/${i}"
31                         break
32                 fi
33         done
34
35         # env variables for compilation:
36         export POSTGRES_INCLUDE="${postgres_include}"
37         export POSTGRES_LIB="${postgres_lib}"
38         perl-module_src_prepare
39 }
40
41 src_test() {
42         local MODULES=(
43                 # Compile failure: https://rt.cpan.org/Ticket/Display.html?id=123218
44                 # "Bundle::DBD::Pg v${PV}"
45                 "DBD::Pg v${PV}"
46         )
47         local failed=()
48         for dep in "${MODULES[@]}"; do
49                 ebegin "Compile testing ${dep}"
50                         perl -Mblib="${S}" -M"${dep} ()" -e1 #||
51                         #die "Could not load ${dep}"
52                 eend $? || failed+=( "$dep" )
53         done
54         if [[ ${failed[@]} ]]; then
55                 echo
56                 eerror "One or more modules failed compile:";
57                 for dep in "${failed[@]}"; do
58                         eerror "  ${dep}"
59                 done
60                 die "Failing due to module compilation errors";
61         fi
62
63         local LIVEDB_TESTS=(
64                 "t/01connect.t"
65                 "t/02attribs.t"
66                 "t/03dbmethod.t"
67                 "t/03smethod.t"
68                 "t/04misc.t"
69                 "t/06bytea.t"
70                 "t/07copy.t"
71                 "t/08async.t"
72                 "t/09arrays.t"
73                 "t/12placeholders.t"
74                 "t/20savepoints.t"
75                 "t/30unicode.t"
76         )
77         local SKIP_TESTS=(
78                 "t/00_signature.t"
79         );
80         if [[ ! -v DBI_DSN ]]; then
81                 ewarn "Functional database tests disabled due to lack of configuration."
82                 ewarn "Please set the following environment variables values pertaining to a"
83                 ewarn "pre-configured Postgres installation in order for tests to work:"
84                 ewarn "  DBI_DSN  - A DBI-compatible connection string for a Postgres Database"
85                 ewarn "             ( eg: dbi:Pg:dbname=testdb )"
86                 ewarn "  DBI_USER - A Postgres Database Username"
87                 ewarn "  DBI_PASS - A Postgres Database Password"
88                 ewarn ""
89                 ewarn "For details, visit:"
90                 ewarn "https://wiki.gentoo.org/wiki/Project:Perl/maint-notes/dev-perl/DBD-Pg"
91                 SKIP_TESTS+=( "${LIVEDB_TESTS[@]}" )
92         fi
93         perl_rm_files "${SKIP_TESTS[@]}"
94         # Parallel testing breaks database access
95         DBDPG_TEST_ALWAYS_ENV=1 DIST_TEST="do" perl-module_src_test
96
97 }