Gentoo Archives: gentoo-commits

From: Kent Fredric <kentnl@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-biology/bioperl-db/, sci-biology/bioperl-db/files/
Date: Tue, 18 Jul 2017 04:40:13
Message-Id: 1500352722.5ee7db5997fa620007d8d66a1a6dd0cead89a272.kentnl@gentoo
1 commit: 5ee7db5997fa620007d8d66a1a6dd0cead89a272
2 Author: Kent Fredric <kentnl <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jul 18 04:37:22 2017 +0000
4 Commit: Kent Fredric <kentnl <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 18 04:38:42 2017 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5ee7db59
7
8 sci-biology/bioperl-db: Restrict tests re bug #421701
9
10 I've tried an excessive amount to get tests working here. But they
11 still need a lot of love. The work I've done so far only gets
12 a mysql test instance up, ( and then, only tested with mariadb )
13
14 Somebody needs to work out what's missing to provision the databases
15 that the tests use.
16
17 Somebody needs to add support for initializing the other kinds of
18 database.
19
20 Any help here encouraged, but disabling non-functioning tests
21 is the best we can do for now.
22
23 Package-Manager: Portage-2.3.6, Repoman-2.3.2
24
25 sci-biology/bioperl-db/bioperl-db-1.6.9-r1.ebuild | 51 +++++++++++++++------
26 sci-biology/bioperl-db/bioperl-db-1.6.9.ebuild | 1 +
27 .../bioperl-db/files/bioperl-db-1.6.9-db.patch | 52 +++++++++-------------
28 3 files changed, 58 insertions(+), 46 deletions(-)
29
30 diff --git a/sci-biology/bioperl-db/bioperl-db-1.6.9-r1.ebuild b/sci-biology/bioperl-db/bioperl-db-1.6.9-r1.ebuild
31 index fd3a4280fa0..facab7d5ffb 100644
32 --- a/sci-biology/bioperl-db/bioperl-db-1.6.9-r1.ebuild
33 +++ b/sci-biology/bioperl-db/bioperl-db-1.6.9-r1.ebuild
34 @@ -15,10 +15,11 @@ HOMEPAGE="http://www.bioperl.org/"
35
36 SLOT="0"
37 KEYWORDS="~amd64 ~x86"
38 +RESTRICT="test"
39 IUSE="test"
40
41 DIST_TEST="do" # Parallelism probably bad
42 -
43 +PATCHES=( "${FILESDIR}/${PN}-1.6.9-db.patch" )
44 RDEPEND="
45 >=sci-biology/bioperl-${PV}
46 dev-perl/DBD-mysql
47 @@ -34,20 +35,8 @@ DEPEND="${RDEPEND}
48 virtual/perl-Test-Simple
49 )
50 "
51 -
52 src_prepare() {
53 - if use test; then
54 - eapply "${FILESDIR}/${PN}-1.6.9-db.patch"
55 - einfo "Using the following configuration details for test database:"
56 - einfo " GENTOO_DB_TEST_HOST : ${GENTOO_DB_TEST_HOST:=localhost}"
57 - einfo " GENTOO_DB_TEST_USER : ${GENTOO_DB_TEST_USER:=portage}"
58 - einfo " GENTOO_DB_TEST_PORT : ${GENTOO_DB_TEST_PORT:=3306}"
59 - einfo " GENTOO_DB_TEST_PASSWOWRD: ${GENTOO_DB_TEST_PASSWORD:=sekrit}"
60 - einfo " GENTOO_DB_TEST_DATABASE : ${GENTOO_DB_TEST_DB:=biosql_test}"
61 - einfo "Please ensure the relevant mysql database is configured and/or tweak"
62 - einfo "environment variables to suit"
63 - export GENTOO_DB_TEST_HOST GENTOO_DB_TEST_USER GENTOO_DB_TEST_PORT GENTOO_DB_TEST_PASSWORD GENTOO_DB_TEST_DB
64 - fi
65 + export GENTOO_DB_HOSTNAME=localhost
66 perl-module_src_prepare
67 }
68 src_install() {
69 @@ -57,5 +46,39 @@ src_install() {
70 src_test() {
71 einfo "Removing bundled test libraries t/lib"
72 rm -r "${S}/t/lib" || die "Cannot remove t/lib"
73 +
74 + ebegin "Setting up test database"
75 +
76 + local mysqld="${EPREFIX}/usr/sbin/mysqld"
77 + local socket="${T}/mysql.sock"
78 + local pidfile="${T}/mysql.pid"
79 + local datadir="${T}/mysql-data-dir"
80 + local mysql="${EPREFIX}/usr/bin/mysql"
81 +
82 + mkdir -p "${datadir}" || die "Can't make mysql database dir";
83 + chmod 755 "${datadir}" || die "Can't fix mysql database dir perms";
84 +
85 + if $mysqld --help | grep -q MariaDB ; then
86 + "${EPREFIX}"/usr/share/mysql/scripts/mysql_install_db \
87 + --basedir="${EPREFIX}/usr" \
88 + --datadir="${datadir}" \
89 + --user=$(whoami) || die "Can't initalize database"
90 + fi
91 +
92 + ${mysqld} --no-defaults --user=$(whoami) --skip-networking \
93 + --socket="${socket}" \
94 + --pid-file="${pidfile}" \
95 + --datadir="${datadir}" &
96 + maxtry=20
97 + while ! [[ -S "${socket}" || "${maxtry}" -lt 1 ]] ; do
98 + maxtry=$((${maxtry}-1))
99 + echo -n "."
100 + sleep 1
101 + done
102 + eend $?
103 + export MYSQL_UNIX_PORT="${socket}"
104 perl-module_src_test
105 + ebegin "Shutting down mysql test database"
106 + pkill -F "${pidfile}"
107 + eend $?
108 }
109
110 diff --git a/sci-biology/bioperl-db/bioperl-db-1.6.9.ebuild b/sci-biology/bioperl-db/bioperl-db-1.6.9.ebuild
111 index 7075ef24285..e6f0c45958a 100644
112 --- a/sci-biology/bioperl-db/bioperl-db-1.6.9.ebuild
113 +++ b/sci-biology/bioperl-db/bioperl-db-1.6.9.ebuild
114 @@ -16,6 +16,7 @@ HOMEPAGE="http://www.bioperl.org/"
115 SLOT="0"
116 KEYWORDS="amd64 x86"
117 IUSE="test"
118 +RESTRICT="test"
119 SRC_TEST="do"
120
121 CDEPEND="
122
123 diff --git a/sci-biology/bioperl-db/files/bioperl-db-1.6.9-db.patch b/sci-biology/bioperl-db/files/bioperl-db-1.6.9-db.patch
124 index 9a2d5e7bb0b..36698651c7d 100644
125 --- a/sci-biology/bioperl-db/files/bioperl-db-1.6.9-db.patch
126 +++ b/sci-biology/bioperl-db/files/bioperl-db-1.6.9-db.patch
127 @@ -1,57 +1,45 @@
128 -From a63725a70ab6d5cbf419d1896007b49609ac5cfa Mon Sep 17 00:00:00 2001
129 +From d689a1473977b0aa368590ba1f913521e4f466c7 Mon Sep 17 00:00:00 2001
130 From: Kent Fredric <kentfredric@×××××.com>
131 -Date: Tue, 18 Jul 2017 11:06:05 +1200
132 -Subject: [PATCH] Add env db test controls
133 +Date: Tue, 18 Jul 2017 16:02:26 +1200
134 +Subject: [PATCH] Allow custom host/port configurations
135
136 ---
137 - Build.PL | 10 +++++-----
138 - t/DBTestHarness.pm | 11 ++++++-----
139 - 2 files changed, 11 insertions(+), 10 deletions(-)
140 + Build.PL | 4 ++--
141 + t/DBTestHarness.pm | 4 ++--
142 + 2 files changed, 4 insertions(+), 4 deletions(-)
143
144 diff --git a/Build.PL b/Build.PL
145 -index ecc402e..4d55f3a 100755
146 +index ecc402e..a61190f 100755
147 --- a/Build.PL
148 +++ b/Build.PL
149 -@@ -97,11 +97,11 @@ sub biosql_conf {
150 +@@ -97,9 +97,9 @@ sub biosql_conf {
151 or die "Error: could not write to config file '$config_file'\n";
152
153 my %config = (driver => $drivers[0],
154 - host => '127.0.0.1',
155 -- user => 'root',
156 ++ host => $ENV{GENTOO_DB_HOSTNAME} || '127.0.0.1',
157 + user => 'root',
158 - port => 3306,
159 -- password => '',
160 -- dbname => 'bioseqdb',
161 -+ host => $ENV{GENTOO_DB_TEST_HOST},
162 -+ user => $ENV{GENTOO_DB_TEST_USER},
163 -+ port => $ENV{GENTOO_DB_TEST_PORT},
164 -+ password => $ENV{GENTOO_DB_TEST_PASSWORD},
165 -+ dbname => $ENV{GENTOO_DB_TEST_DB},
166 ++ port => $ENV{GENTOO_DB_PORT} || undef,
167 + password => '',
168 + dbname => 'bioseqdb',
169 database => 'biosql',
170 - schema_sql => '../biosql-schema/sql/biosqldb-mysql.sql');
171 -
172 diff --git a/t/DBTestHarness.pm b/t/DBTestHarness.pm
173 -index b660429..bd0b3b7 100755
174 +index b660429..91e0c54 100755
175 --- a/t/DBTestHarness.pm
176 +++ b/t/DBTestHarness.pm
177 -@@ -47,12 +47,13 @@ my $counter=0;
178 +@@ -47,9 +47,9 @@ my $counter=0;
179 # Default settings as a hash
180 my $dflt = {
181 'driver' => 'mysql',
182 - 'host' => 'localhost',
183 -- 'user' => 'root',
184 ++ 'host' => $ENV{GENTOO_DB_HOST} || 'localhost',
185 + 'user' => 'root',
186 - 'port' => undef,
187 -- 'password' => '',
188 -+ 'host' => $ENV{GENTOO_DB_HOST},
189 -+ 'user' => $ENV{GENTOO_DB_TEST_USER},
190 -+ 'port' => ( defined $ENV{GENTOO_DB_TEST_PORT} and length $ENV{GENTOO_DB_TEST_PORT} ) ?
191 -+ $ENV{GENTOO_DB_TEST_PORT} : undef,
192 -+ 'password' => $ENV{GENTOO_DB_TEST_PASSWORD},
193 ++ 'port' => $ENV{GENTOO_DB_PORT} || undef,
194 + 'password' => '',
195 'schema_sql' => ['../biosql-schema/sql/biosqldb-mysql.sql'],
196 -- 'database' => 'biosql',
197 -+ 'database' => $ENV{GENTOO_DB_TEST_DB},
198 - 'module' => 'Bio::DB::BioSQL::DBAdaptor'
199 - };
200 -
201 + 'database' => 'biosql',
202 --
203 2.13.1