Diff DBD-mysql-4.50.0-r1 with a DBD-mysql-5.7.0

/usr/portage/dev-perl/DBD-mysql/DBD-mysql-5.7.0.ebuild 2025-02-03 17:39:32.854667013 +0300
1
# Copyright 1999-2022 Gentoo Authors
1
# Copyright 1999-2025 Gentoo Authors
2 2
# Distributed under the terms of the GNU General Public License v2
3 3

  
4
EAPI=7
4
EAPI=8
5 5

  
6 6
DIST_AUTHOR=DVEEDEN
7
DIST_VERSION=4.050
7
# Parallel testing is broken as 2 tests create the same table
8
# and mysql isn't acid compliant and can't limit visibility of tables
9
# to a transaction...
10
DIST_TEST="do"
11
DIST_WIKI=tests
12
DIST_VERSION=5.007
8 13
inherit perl-module
9 14

  
10 15
DESCRIPTION="MySQL driver for the Perl5 Database Interface (DBI)"
11 16

  
12 17
SLOT="0"
13
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-macos"
14

  
15
IUSE="mariadb +mysql test +ssl"
18
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc x86 ~x64-macos"
19
IUSE="mariadb +mysql test"
16 20
RESTRICT="!test? ( test )"
17
REQUIRED_USE="^^ ( mysql mariadb )"
21
# tests do not pass on MariaDB at this time; assumptions about version numbers and binary names
22
REQUIRED_USE="^^ ( mysql mariadb ) test? ( mysql )"
18 23

  
19 24
DB_DEPENDS="
20
	mysql? ( dev-db/mysql-connector-c:= )
21
	mariadb? ( dev-db/mariadb-connector-c:=[ssl(+)?] )
25
	mysql? ( >=dev-db/mysql-connector-c-8:= )
26
	mariadb? ( >=dev-db/mariadb-connector-c-3.1:=[ssl(+)] )
22 27
"
23 28
RDEPEND="
24 29
	>=dev-perl/DBI-1.609.0
......
28 33
DEPEND="
29 34
	${DB_DEPENDS}
30 35
"
31
BDEPEND="${RDEPEND}
36
BDEPEND="
37
	${RDEPEND}
32 38
	virtual/perl-ExtUtils-MakeMaker
33 39
	virtual/perl-Data-Dumper
34 40
	test? (
35 41
		dev-perl/Test-Deep
36 42
		>=virtual/perl-Test-Simple-0.900.0
37 43
		virtual/perl-Time-HiRes
44
		mariadb? ( dev-db/mariadb:* )
45
		mysql? ( >=dev-db/mysql-8:* )
38 46
	)
39 47
"
40 48

  
41 49
PATCHES=(
42 50
	"${FILESDIR}/${PN}-4.050-no-dot-inc.patch"
43
	"${FILESDIR}/${PN}-4.050-fix-float-type-conversion.patch"
44
	"${FILESDIR}/${PN}-4.050-fix-for-MariaDB-10.3.13-with-zerofil.patch"
45 51
)
46 52

  
47 53
PERL_RM_FILES=(
48 54
	t/pod.t
49 55
	t/manifest.t
56

  
57
	#   Failed test 'USE is not supported with mysql_server_prepare_disable_fallback=1'
58
	#   at t/40server_prepare.t line 93.
59
	t/40server_prepare.t
50 60
)
61

  
51 62
src_configure() {
52
	local impl
53
	impl=$(usex mariadb mariadb mysql)
63
	local impl=$(usex mariadb mariadb mysql)
64
	local myconf=()
65

  
54 66
	if use test; then
55
		myconf="${myconf} --testdb=test \
56
			--testhost=localhost \
57
			--testuser=test \
58
			--testpassword=test"
67
		myconf+=(
68
			--testdb=test
69
			--testhost=localhost
70
			--testsocket="${T}"/mysqld.sock
71
			--testuser=root
72
		)
59 73
	fi
60
	myconf="${myconf} --$(usex ssl ssl nossl) --mysql_config=${EPREFIX}/usr/bin/${impl}_config"
74

  
75
	myconf+=( --mysql_config="${EPREFIX}"/usr/bin/${impl}_config )
76

  
61 77
	perl-module_src_configure
62 78
}
63 79

  
64
src_compile() {
65
	mymake=(
66
		"OPTIMIZE=${CFLAGS}"
67
	)
68
	perl-module_src_compile
69
}
70 80
src_test() {
71
	ewarn "Comprehensive testing requires additional manual steps. For details"
72
	ewarn "see:"
73
	ewarn " https://wiki.gentoo.org/wiki/Project:Perl/maint-notes/${CATEGORY}/${PN}#Testing"
74

  
75
	einfo
76
	einfo "If tests fail, you have to configure your MySQL instance to create"
77
	einfo "and grant some privileges to the test user."
78
	einfo "You can run the following commands at the MySQL prompt: "
79
	einfo "> CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';"
80
	einfo "> CREATE DATABASE test;"
81
	einfo "> GRANT ALL PRIVILEGES ON test.* TO 'test'@'localhost';"
82
	einfo
83
	sleep 5
81
	local -x USER=$(whoami)
82

  
83
	einfo "Creating mysql test instance ..."
84
	mkdir -p "${T}"/mysql || die
85
	if use mariadb ; then
86
		local -x PATH="${BROOT}/usr/share/mariadb/scripts:${PATH}"
87

  
88
		mysql_install_db \
89
			--no-defaults \
90
			--auth-root-authentication-method=normal \
91
			--basedir="${EPREFIX}/usr" \
92
			--datadir="${T}"/mysql 1>"${T}"/mysqld_install.log || die
93
	else
94
		mysqld \
95
			--no-defaults \
96
			--initialize-insecure \
97
			--user ${USER} \
98
			--basedir="${EPREFIX}/usr" \
99
			--datadir="${T}"/mysql 1>"${T}"/mysqld_install.log || die
100
	fi
101

  
102
	einfo "Starting mysql test instance ..."
103
	mysqld \
104
		--no-defaults \
105
		--character-set-server=utf8 \
106
		--bind-address=127.0.0.1 \
107
		--pid-file="${T}"/mysqld.pid \
108
		--socket="${T}"/mysqld.sock \
109
		--datadir="${T}"/mysql 1>"${T}"/mysqld.log 2>&1 &
110

  
111
	# Wait for it to start
112
	local i
113
	for (( i = 0; i < 10; i++ )); do
114
		[[ -S ${T}/mysqld.sock ]] && break
115
		sleep 1
116
	done
117
	[[ ! -S ${T}/mysqld.sock ]] && die "mysqld failed to start"
118

  
119
	einfo "Configuring test mysql instance ..."
120
	mysql -u root \
121
		-e 'CREATE DATABASE /*M!50701 IF NOT EXISTS */ test' \
122
		-S "${T}"/mysqld.sock || die "Failed to create test database"
123

  
84 124
	# Don't be a hero and try to do EXTENDED_TESTING=1 unless you can figure
85 125
	# out why 60leaks.t fails
126
	nonfatal perl-module_src_test
127
	ret=$?
128

  
129
	einfo "Stopping mysql test instance ..."
130
	pkill -F "${T}"/mysqld.pid || die
131
	# wait for it to stop
132
	local i
133
	for (( i = 0; i < 10; i++ )); do
134
		[[ -S ${T}/mysqld.sock ]] || break
135
		sleep 1
136
	done
137

  
138
	rm -rf "${T}"/mysql || die
86 139

  
87
	# Parallel testing is broken as 2 tests create the same table
88
	# and mysql isn't acid compliant and can't limit visibility of tables
89
	# to a transaction...
90
	DIST_TEST="do" perl-module_src_test
140
	[[ ${ret} -ne 0 ]] && die
91 141
}
Thank you!