import UBI perl-DBD-MySQL-5.007-4.el10

This commit is contained in:
eabdullin 2025-05-14 17:27:25 +00:00
parent 5921a9d364
commit f26a99dab8
9 changed files with 337 additions and 98 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/DBD-mysql-4.046.tar.gz DBD-mysql-5.007.tar.gz

View File

@ -1 +0,0 @@
cf9dad5cee866fb2d48ce11ce9814f4af993736d SOURCES/DBD-mysql-4.046.tar.gz

View File

@ -1,71 +0,0 @@
From 051748825e77172677d9e3b319b870c3c0a70a38 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jplesnik@redhat.com>
Date: Fri, 14 Jul 2017 14:13:50 +0200
Subject: [PATCH] Fix build failures for MariaDB 10.2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
<mariadb_version.h> does not exist in mariadb-5.5.26. Do not include
it explicitly. Instead rely on including <mysql.h> that transitively
includes <mariadb_version.h> or <mysql_version.h>. This makes this
patch more portable.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
dbdimp.c | 7 +++++++
mysql.xs | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
# Fixed in 4.045
#diff --git a/dbdimp.c b/dbdimp.c
#index 71251da..97fa9c4 100644
#--- a/dbdimp.c
#+++ b/dbdimp.c
#@@ -2104,6 +2104,9 @@ MYSQL *mysql_dr_connect(
#
# if (result)
# {
#+#if MYSQL_VERSION_ID >= 50013
#+ my_bool reconnect= 1;
#+#endif
# #if MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION
# /* connection succeeded. */
# /* imp_dbh == NULL when mysql_dr_connect() is called from mysql.xs
#@@ -2122,7 +2125,11 @@ MYSQL *mysql_dr_connect(
# we turn off Mysql's auto reconnect and handle re-connecting ourselves
# so that we can keep track of when this happens.
# */
#+#if MYSQL_VERSION_ID >= 50013
#+ mysql_options(result, MYSQL_OPT_RECONNECT, &reconnect);
#+#else
# result->reconnect=0;
#+#endif
# }
# else {
# /*
diff --git a/mysql.xs b/mysql.xs
index 60cf9c6..750c763 100644
--- a/mysql.xs
+++ b/mysql.xs
@@ -787,7 +787,7 @@ dbd_mysql_get_info(dbh, sql_info_type)
D_imp_dbh(dbh);
IV type = 0;
SV* retsv=NULL;
-#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50709
+#if MYSQL_VERSION_ID >= 50709
/* MariaDB 10 is not MySQL source level compatible so this only applies to MySQL*/
IV buffer_len;
#endif
@@ -819,7 +819,7 @@ dbd_mysql_get_info(dbh, sql_info_type)
retsv = newSVpvn("`", 1);
break;
case SQL_MAXIMUM_STATEMENT_LENGTH:
-#if !defined(MARIADB_BASE_VERSION) && MYSQL_VERSION_ID >= 50709
+#if MYSQL_VERSION_ID >= 50709
/* MariaDB 10 is not MySQL source level compatible so this
only applies to MySQL*/
/* mysql_get_option() was added in mysql 5.7.3 */
--
2.13.6

View File

@ -1,28 +1,36 @@
%global cpan_name DBD-mysql
# Disable leak tests
%bcond_with perl_DBD_MySQL_enables_leak_test
%global mysqlname mysql8.4
Name: perl-DBD-MySQL Name: perl-DBD-MySQL
Version: 4.046 Version: 5.007
Release: 3%{?dist} Release: 4%{?dist}
Summary: A MySQL interface for Perl Summary: A MySQL interface for Perl
Group: Development/Libraries License: GPL-1.0-or-later OR Artistic-1.0-Perl
License: GPL+ or Artistic URL: https://metacpan.org/release/%{cpan_name}
URL: http://search.cpan.org/dist/DBD-mysql/ Source0: https://cpan.metacpan.org/authors/id/D/DV/DVEEDEN/%{cpan_name}-%{version}.tar.gz
Source0: http://www.cpan.org/authors/id/C/CA/CAPTTOFU/DBD-mysql-%{version}.tar.gz Source1: test-setup.t
# Fix for new version of MariaDB 10.2 Source2: test-clean.t
Patch0: DBD-mysql-4.043-Fix-build-failures-for-MariaDB-10.2.patch Source3: testrules.yml
Source4: test-env.sh
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: findutils BuildRequires: findutils
BuildRequires: gcc BuildRequires: gcc
BuildRequires: mariadb-connector-c BuildRequires: make
BuildRequires: mariadb-connector-c-devel # DBD::mysql v5.x requires MySQL 8.x client libraries for building
BuildRequires: %{mysqlname}-devel
BuildRequires: openssl-devel BuildRequires: openssl-devel
BuildRequires: perl-devel BuildRequires: perl-devel
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: perl-interpreter BuildRequires: perl-interpreter
BuildRequires: perl(Carp)
BuildRequires: perl(Config) BuildRequires: perl(Config)
BuildRequires: perl(Data::Dumper) BuildRequires: perl(Data::Dumper)
BuildRequires: perl(DBI) >= 1.609
BuildRequires: perl(DBI::DBD) BuildRequires: perl(DBI::DBD)
BuildRequires: perl(DynaLoader) BuildRequires: perl(Devel::CheckLib) >= 1.09
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76
BuildRequires: perl(File::Basename) BuildRequires: perl(File::Basename)
BuildRequires: perl(File::Copy) BuildRequires: perl(File::Copy)
@ -33,48 +41,258 @@ BuildRequires: perl(strict)
BuildRequires: perl(utf8) BuildRequires: perl(utf8)
BuildRequires: perl(warnings) BuildRequires: perl(warnings)
BuildRequires: zlib-devel BuildRequires: zlib-devel
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) # Run-time
BuildRequires: perl(Carp)
BuildRequires: perl(DBI) >= 1.609
BuildRequires: perl(DBI::Const::GetInfoType)
BuildRequires: perl(DynaLoader)
# Tests
BuildRequires: %{mysqlname}
BuildRequires: %{mysqlname}-server
BuildRequires: perl(B)
BuildRequires: perl(bigint)
# Required to process t/testrules.yml
BuildRequires: perl(CPAN::Meta::YAML)
BuildRequires: perl(Encode)
BuildRequires: perl(lib)
BuildRequires: perl(Test::Deep)
BuildRequires: perl(Test::More)
BuildRequires: perl(Time::HiRes)
BuildRequires: perl(vars)
# Optional tests
%if %{with perl_DBD_MySQL_enables_leak_test}
BuildRequires: perl(Proc::ProcessTable)
BuildRequires: perl(Storable)
%endif
Provides: perl-DBD-mysql = %{version}-%{release} Provides: perl-DBD-mysql = %{version}-%{release}
%{?perl_default_filter} %{?perl_default_filter}
# Filter modules bundled for tests
%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}^%{_libexecdir}
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(.*lib.pl\\)
%description %description
DBD::mysql is the Perl5 Database Interface driver for the MySQL database. In DBD::mysql is the Perl5 Database Interface driver for the MySQL database. In
other words: DBD::mysql is an interface between the Perl programming language other words: DBD::mysql is an interface between the Perl programming language
and the MySQL programming API that comes with the MySQL relational database and the MySQL programming API that comes with the MySQL relational database
management system. management system.
%package tests
Summary: Tests for %{name}
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: coreutils
Requires: shadow-utils
Requires: %{mysqlname}
Requires: %{mysqlname}-server
# Required to process t/testrules.yml
Requires: perl(CPAN::Meta::YAML)
# Optional tests
%if %{with perl_DBD_MariaDB_enables_leak_test}
Requires: perl(Proc::ProcessTable)
Requires: perl(Storable)
%endif
%description tests
Tests from %{name}. Execute them
with "%{_libexecdir}/%{name}/test".
%prep %prep
%setup -q -n DBD-mysql-%{version} %autosetup -p1 -n %{cpan_name}-%{version}
%patch0 -p1
# Correct file permissions # Correct file permissions
find . -type f | xargs chmod -x find . -type f | xargs chmod -x
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} t/
cp %{SOURCE4} .
# Help file to recognise the Perl scripts and normalize shebangs
for F in t/*.t t/*.pl; do
perl -i -MConfig -ple 'print $Config{startperl} if $. == 1 && !s{\A#!.*perl\b}{$Config{startperl}}' "$F"
chmod +x "$F"
done
%build %build
perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" NO_PACKLIST=1 . %{SOURCE4}
make %{?_smp_mflags} perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="%{optflags}" \
NO_PACKLIST=1 NO_PERLLOCAL=1 \
--testdb=$DBD_MYSQL_TESTDB \
--testuser=$DBD_MYSQL_TESTUSER \
--testpassword=$DBD_MYSQL_TESTPASSWORD \
--testhost=$DBD_MYSQL_TESTHOST \
--testsocket=$DBD_MYSQL_TESTSOCKET
%{make_build}
%install %install
make pure_install DESTDIR=%{buildroot} %{make_install}
find %{buildroot} -type f -name '*.bs' -empty -delete find %{buildroot} -type f -name '*.bs' -empty -delete
%{_fixperms} %{buildroot}/* %{_fixperms} %{buildroot}/*
# Install tests
mkdir -p %{buildroot}%{_libexecdir}/%{name}
cp -a t %{buildroot}%{_libexecdir}/%{name}
cp %{SOURCE4} %{buildroot}%{_libexecdir}/%{name}
# Replace build dir by template
perl -i -pe 's{%{_builddir}/.*mysql.sock}{_TEST_SOCKET_}' %{buildroot}%{_libexecdir}/%{name}/t/mysql.mtest
# Remove release tests
rm %{buildroot}%{_libexecdir}/%{name}/t/manifest.t
rm %{buildroot}%{_libexecdir}/%{name}/t/pod.t
cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF'
#!/usr/bin/bash
set -e
# The tests write to temporary database which is placed in $DIR/t/testdb
DIR=$(mktemp -d)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
. $DIR/$(basename %{SOURCE4})
%{!?with_perl_DBD_MySQL_enables_leak_test:unset EXTENDED_TESTING}
perl -i -pe "s{_TEST_SOCKET_}{$DBD_MYSQL_TESTSOCKET}" $DIR/t/mysql.mtest
# Test setup and tests have to be executed by non-root user
if [ `id -u` -ne 0 ]; then
prove -I . -j "$(getconf _NPROCESSORS_ONLN)"
else
getent group $DBD_MYSQL_TESTUSER >/dev/null || \
groupadd -r $DBD_MYSQL_TESTUSER
getent passwd $DBD_MYSQL_TESTUSER >/dev/null || \
useradd -g $DBD_MYSQL_TESTUSER $DBD_MYSQL_TESTUSER
chown -hR $DBD_MYSQL_TESTUSER:$DBD_MYSQL_TESTUSER $DIR
su $DBD_MYSQL_TESTUSER -c "prove -I . -j \"$(getconf _NPROCESSORS_ONLN)\""
chown -hR root:root $DIR
getent passwd $DBD_MYSQL_TESTUSER &>/dev/null && userdel -r $DBD_MYSQL_TESTUSER
getent group $DBD_MYSQL_TESTUSER &>/dev/null && groupdel $DBD_MYSQL_TESTUSER
fi
popd
rm -rf "$DIR"
EOF
chmod +x %{buildroot}%{_libexecdir}/%{name}/test
%check %check
# Full test coverage requires a live MySQL database # Set MySQL and DBD::mysql test environment
#make test . %{SOURCE4}
unset RELEASE_TESTING
make test %{?with_perl_DBD_MySQL_enables_leak_test:EXTENDED_TESTING=1}
%files %files
%license LICENSE %license LICENSE
%doc Changes README.md %doc Changes README.md
%{perl_vendorarch}/Bundle/
%{perl_vendorarch}/DBD/ %{perl_vendorarch}/DBD/
%{perl_vendorarch}/auto/DBD/ %{perl_vendorarch}/auto/DBD/
%{_mandir}/man3/*.3* %{_mandir}/man3/DBD::mysql*.3*
%files tests
%{_libexecdir}/%{name}
%changelog %changelog
* Fri Mar 29 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4.046-3 * Wed Jan 22 2025 Michal Schorm <mschorm@redhat.com> - 5.007-4
- Rebuild with enable hardening (bug #1636329) - Fix FTBFS caused by planned change RHEL-68750
Resolves: RHEL-75748
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 5.007-3
- Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Thu Aug 08 2024 Troy Dawson <tdawson@redhat.com> - 5.007-2
- Bump release for Aug 2024 java mass rebuild
* Tue Jul 16 2024 Jitka Plesnikova <jplesnik@redhat.com> - 5.007-1
- 5.007 bump
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 5.003-4
- Bump release for June 2024 mass rebuild
* Thu Jan 25 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.003-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 5.003-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Dec 01 2023 Jitka Plesnikova <jplesnik@redhat.com> - 5.003-1
- 5.003 bump (rhbz#2252375)
* Tue Oct 24 2023 Jitka Plesnikova <jplesnik@redhat.com> - 5.002-1
- 5.002 bump (rhbz#2245834)
* Thu Oct 19 2023 Jitka Plesnikova <jplesnik@redhat.com> - 5.001-2
- Use community-mysql also for ELN
* Wed Oct 04 2023 Jitka Plesnikova <jplesnik@redhat.com> - 5.001-1
- 5.001 bump (rhbz#2242077)
Since this version, MySQL 8.x has to be used for build
- Package tests
* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Tue Jul 11 2023 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-17
- Perl 5.38 rebuild
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Tue May 31 2022 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-14
- Perl 5.36 rebuild
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri May 21 2021 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-11
- Perl 5.34 rebuild
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue Jun 23 2020 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-8
- Perl 5.32 rebuild
* Fri Mar 13 2020 Petr Pisar <ppisar@redhat.com> - 4.050-7
- Remove a useless shebang (bug #1813195)
* Tue Feb 04 2020 Tom Stellard <tstellar@redhat.com> - 4.050-6
- Use make_build/make_install macros
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Fri May 31 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-3
- Perl 5.30 rebuild
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.050-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Thu Jan 10 2019 Jitka Plesnikova <jplesnik@redhat.com> - 4.050-1
- 4.050 bump
* Mon Nov 19 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.049-1
- 4.049 bump
* Mon Sep 17 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.048-1
- 4.048 bump
* Mon Sep 10 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.047-1
- 4.047 bump
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.046-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Thu Jun 28 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.046-3
- Perl 5.28 rebuild
* Mon Feb 19 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.046-2 * Mon Feb 19 2018 Jitka Plesnikova <jplesnik@redhat.com> - 4.046-2
- Add build-require gcc - Add build-require gcc

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (DBD-mysql-5.007.tar.gz) = 8fed785478953477b3d8c87614ef2c5c3407ee2164cefa56cd19ad00afe3ccdae7cdc2b59b555f1984a41789b140c6f00397ad56c86a985182f7157e2ac34b75

16
test-clean.t Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/perl
use strict;
use warnings;
use File::Path;
use Test::More tests => 2;
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
ok(system("/usr/bin/mysqladmin --user=root --socket=$MYSQL_UNIX_PORT shutdown 2>&1 || [ ! -s \"$MYSQL_PIDFILE\" ] || /bin/kill `cat \"$MYSQL_PIDFILE\"`") == 0);
my $removed_count = rmtree($MYSQL_DIR, 1, 1);
ok($removed_count > 0);

14
test-env.sh Executable file
View File

@ -0,0 +1,14 @@
#!/usr/bin/bash
# MariaDB setup
export MYSQL_DIR=$PWD/t/testdb
export MYSQL_UNIX_PORT=$MYSQL_DIR/mysql.sock
export MYSQL_PIDFILE=$MYSQL_DIR/mysql.pid
# DBD::mysql test setup
export DBD_MYSQL_TESTDB=test
export DBD_MYSQL_TESTHOST=localhost
export DBD_MYSQL_TESTSOCKET=$MYSQL_UNIX_PORT
export DBD_MYSQL_TESTUSER=testuserdbd
export DBD_MYSQL_TESTPASSWORD=testpasswordDBD

51
test-setup.t Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/perl
use strict;
use warnings;
use Test::More tests => 7;
# MySQL setup
my $MYSQL_DIR = $ENV{'MYSQL_DIR'};
my $MYSQL_UNIX_PORT = $ENV{'MYSQL_UNIX_PORT'};
my $MYSQL_PIDFILE = $ENV{'MYSQL_PIDFILE'};
# DBD::MariaDB test setup
my $DBD_MYSQL_TESTDB = $ENV{'DBD_MYSQL_TESTDB'};
my $DBD_MYSQL_TESTHOST = $ENV{'DBD_MYSQL_TESTHOST'};
my $DBD_MYSQL_TESTSOCKET = $ENV{'DBD_MYSQL_TESTSOCKET'};
my $DBD_MYSQL_TESTUSER = $ENV{'DBD_MYSQL_TESTUSER'};
my $DBD_MYSQL_TESTPASSWORD = $ENV{'DBD_MYSQL_TESTPASSWORD'};
my $MYSQLD = '/usr/sbin/mysqld';
# Initialize MySQL data directory
system("$MYSQLD --no-defaults --initialize-insecure --user=mysql --datadir=$MYSQL_DIR >/dev/null 2>&1");
is($?, 0);
# Starting the server
my $cmd = "$MYSQLD --no-defaults --socket=$MYSQL_UNIX_PORT --datadir=$MYSQL_DIR --pid-file=$MYSQL_PIDFILE --explicit_defaults_for_timestamp --skip-networking >/dev/null 2>&1 &";
system($cmd);
is($?, 0);
my $attempts = 0;
while (system("/usr/bin/mysqladmin --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) {
sleep 3;
$attempts++;
if ($attempts > 10) {
fail("skipping test, mysql server could not be contacted after 30 seconds\n");
}
}
ok(1);
# Create database
system("mysql -u root --skip-password --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MYSQL_TESTDB CHARACTER SET='utf8mb4';\" 2>&1");
is($?, 0);
# The test user has to have the proper privileges that these tests require
system("mysql -u root --skip-password --execute \"CREATE USER '$DBD_MYSQL_TESTUSER'\@'localhost' IDENTIFIED BY '$DBD_MYSQL_TESTPASSWORD'; \" 2>&1");
is($?, 0);
system("mysql -u root --skip-password --execute \"GRANT ALL PRIVILEGES ON $DBD_MYSQL_TESTDB.* TO '$DBD_MYSQL_TESTUSER'\@'localhost';\" 2>&1");
is($?, 0);
system("/usr/bin/mysqladmin --user=$DBD_MYSQL_TESTUSER --password=$DBD_MYSQL_TESTPASSWORD --socket=$DBD_MYSQL_TESTSOCKET ping >/dev/null 2>&1");
is($?, 0);

11
testrules.yml Normal file
View File

@ -0,0 +1,11 @@
seq:
- seq: t/test-setup.t
- seq: t/00base.t
- seq: t/05dbcreate.t
- seq: t/10connect.t
- seq: t/87async.t
- seq: t/rt75353-innodb-lock-timeout.t
- seq: t/rt85919-fetch-lost-connection.t
- par:
- par: **
- seq: t/test-clean.t