summaryrefslogtreecommitdiff
blob: facab7d5ffbe7ab49418a2c849404949f61f932a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=6

BIOPERL_RELEASE=1.6.9

DIST_NAME=BioPerl-DB
DIST_AUTHOR=CJFIELDS
DIST_VERSION=1.006900
inherit perl-module

DESCRIPTION="Perl tools for bioinformatics - Perl API that accesses the BioSQL schema"
HOMEPAGE="http://www.bioperl.org/"

SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="test"
IUSE="test"

DIST_TEST="do" # Parallelism probably bad
PATCHES=( "${FILESDIR}/${PN}-1.6.9-db.patch" )
RDEPEND="
	>=sci-biology/bioperl-${PV}
	dev-perl/DBD-mysql
	dev-perl/DBI
	sci-biology/biosql"
DEPEND="${RDEPEND}
	dev-perl/Module-Build
	test? (
		dev-perl/Data-Stag
		dev-perl/Sub-Uplevel
		dev-perl/Test-Warn
		dev-perl/Test-Exception
		virtual/perl-Test-Simple
	)
"
src_prepare() {
	export GENTOO_DB_HOSTNAME=localhost
	perl-module_src_prepare
}
src_install() {
	mydoc="AUTHORS BUGS FAQ"
	perl-module_src_install
}
src_test() {
	einfo "Removing bundled test libraries t/lib"
	rm -r "${S}/t/lib" || die "Cannot remove t/lib"

	ebegin "Setting up test database"

	local mysqld="${EPREFIX}/usr/sbin/mysqld"
	local socket="${T}/mysql.sock"
	local pidfile="${T}/mysql.pid"
	local datadir="${T}/mysql-data-dir"
	local mysql="${EPREFIX}/usr/bin/mysql"

	mkdir -p "${datadir}" || die "Can't make mysql database dir";
	chmod 755 "${datadir}" || die "Can't fix mysql database dir perms";

	if $mysqld --help | grep -q MariaDB ; then
		"${EPREFIX}"/usr/share/mysql/scripts/mysql_install_db \
			--basedir="${EPREFIX}/usr" \
			--datadir="${datadir}" \
			--user=$(whoami) || die "Can't initalize database"
	fi

	${mysqld} --no-defaults	--user=$(whoami) --skip-networking \
							--socket="${socket}" \
							--pid-file="${pidfile}" \
							--datadir="${datadir}" &
	maxtry=20
	while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
		maxtry=$((${maxtry}-1))
		echo -n "."
		sleep 1
	done
	eend $?
	export MYSQL_UNIX_PORT="${socket}"
	perl-module_src_test
	ebegin "Shutting down mysql test database"
	pkill -F "${pidfile}"
	eend $?
}