From 79c5777e153fa2cf529f92900cec151a09e342aa Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: May 17 2022 09:55:34 +0000 Subject: import perl-DBD-MariaDB-1.21-16.el9_0 --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..547fabf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/DBD-MariaDB-1.21.tar.gz diff --git a/.perl-DBD-MariaDB.metadata b/.perl-DBD-MariaDB.metadata new file mode 100644 index 0000000..dad6515 --- /dev/null +++ b/.perl-DBD-MariaDB.metadata @@ -0,0 +1 @@ +fe2b6703d1340d82d219b056bf9a6feadf8904bd SOURCES/DBD-MariaDB-1.21.tar.gz diff --git a/SOURCES/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch b/SOURCES/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch new file mode 100644 index 0000000..f07a6cb --- /dev/null +++ b/SOURCES/DBD-MariaDB-1.21-Run-test-setup-and-clean.patch @@ -0,0 +1,14 @@ +diff -up DBD-MariaDB-1.21/t/testrules.yml.orig DBD-MariaDB-1.21/t/testrules.yml +--- DBD-MariaDB-1.21/t/testrules.yml.orig 2019-07-03 11:38:30.204870398 +0200 ++++ DBD-MariaDB-1.21/t/testrules.yml 2019-07-03 11:38:41.334062976 +0200 +@@ -1,4 +1,5 @@ + seq: ++ - seq: t/test-setup.t + - seq: t/00base.t + - seq: t/05dbcreate.t + - seq: t/10connect.t +@@ -8,3 +9,4 @@ seq: + - seq: t/rt75353-innodb-lock-timeout.t + - seq: t/rt85919-fetch-lost-connection.t + - par: ** ++ - seq: t/test-clean.t diff --git a/SOURCES/DBD-MariaDB-fix-mariadb-connector-c-32x-test.patch b/SOURCES/DBD-MariaDB-fix-mariadb-connector-c-32x-test.patch new file mode 100644 index 0000000..3adea2f --- /dev/null +++ b/SOURCES/DBD-MariaDB-fix-mariadb-connector-c-32x-test.patch @@ -0,0 +1,13 @@ +diff -up DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t.orig DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t +--- DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t.orig 2022-02-17 14:00:30.765461191 +0100 ++++ DBD-MariaDB-1.21/t/45bind_no_backslash_escapes.t 2022-02-17 14:01:54.388057993 +0100 +@@ -19,7 +19,8 @@ if ($dbh->{mariadb_serverversion} < 5000 + plan skip_all => "Servers < 5.0.1 do not support sql_mode NO_BACKSLASH_ESCAPES"; + } + +-if ($dbh->{mariadb_clientversion} < 50001) { ++# As from mariadb-connect-c 3.2.x version number for mariadb_clientversion is 3020x ++if ($dbh->{mariadb_clientversion} < 50001 && $dbh->{mariadb_serverversion} < 50001) { + $id2_quoted_no_backslash = q(X'737472696E675C737472696E6722737472696E6727737472696E67'); + } + diff --git a/SOURCES/test-clean.t b/SOURCES/test-clean.t new file mode 100755 index 0000000..a8c52df --- /dev/null +++ b/SOURCES/test-clean.t @@ -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); + diff --git a/SOURCES/test-env.sh b/SOURCES/test-env.sh new file mode 100755 index 0000000..c95a494 --- /dev/null +++ b/SOURCES/test-env.sh @@ -0,0 +1,15 @@ +#!/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 +export MYSQL_USER=`whoami` + +# DBD::MariaDB test setup +export DBD_MARIADB_TESTDB=testdb +export DBD_MARIADB_TESTHOST=localhost +export DBD_MARIADB_TESTSOCKET=$MYSQL_UNIX_PORT +export DBD_MARIADB_TESTUSER=testuser +export DBD_MARIADB_TESTPASSWORD=testpassword + diff --git a/SOURCES/test-setup.t b/SOURCES/test-setup.t new file mode 100755 index 0000000..c52f3e1 --- /dev/null +++ b/SOURCES/test-setup.t @@ -0,0 +1,55 @@ +#!/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'}; +my $MYSQL_USER = $ENV{'MYSQL_USER'}; +chomp($MYSQL_USER); + +# DBD::MariaDB test setup +my $DBD_MARIADB_TESTDB = $ENV{'DBD_MARIADB_TESTDB'}; +my $DBD_MARIADB_TESTHOST = $ENV{'DBD_MARIADB_TESTHOST'}; +my $DBD_MARIADB_TESTSOCKET = $ENV{'DBD_MARIADB_TESTSOCKET'}; +my $DBD_MARIADB_TESTUSER = $ENV{'DBD_MARIADB_TESTUSER'}; +my $DBD_MARIADB_TESTPASSWORD = $ENV{'DBD_MARIADB_TESTPASSWORD'}; + +my $MYSQLD = ''; +my $mysql_version = readpipe("mysql --version"); +if ($mysql_version =~ /MariaDB/) { + system("mysql_install_db --no-defaults --datadir=$MYSQL_DIR --force --skip-name-resolve --explicit_defaults_for_timestamp >/dev/null 2>&1"); + is($?, 0); + $MYSQLD = '/usr/libexec/mysqld'; +} else { + $MYSQLD = '/usr/sbin/mysqld'; + system("$MYSQLD --no-defaults --initialize-insecure --datadir=$MYSQL_DIR --explicit_defaults_for_timestamp --user=$MYSQL_USER >/dev/null 2>&1"); + is($?, 0); +} + +my $cmd = "$MYSQLD --no-defaults --user=$MYSQL_USER --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 --user=root --socket=$MYSQL_UNIX_PORT ping >/dev/null 2>&1") != 0) { + sleep 3; + $attempts++; + if ($attempts > 10) { + fail("skipping test, mariadb/mysql server could not be contacted after 30 seconds\n"); + } +} +ok(1); + +system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE USER '$DBD_MARIADB_TESTUSER\@localhost';\" 2>&1"); +is($?, 0); +system("mysql --socket=$MYSQL_UNIX_PORT --execute \"CREATE DATABASE IF NOT EXISTS $DBD_MARIADB_TESTDB CHARACTER SET='utf8mb4';\" 2>&1"); +is($?, 0); +system("mysql --socket=$MYSQL_UNIX_PORT --execute \"GRANT ALL PRIVILEGES ON $DBD_MARIADB_TESTDB.* TO '$DBD_MARIADB_TESTUSER\@localhost' IDENTIFIED BY '$DBD_MARIADB_TESTPASSWORD';\" 2>&1"); +is($?, 0); +system("/usr/bin/mysqladmin --user=$DBD_MARIADB_TESTUSER --password=$DBD_MARIADB_TESTPASSWORD --socket=$DBD_MARIADB_TESTSOCKET ping >/dev/null 2>&1"); +is($?, 0); diff --git a/SPECS/perl-DBD-MariaDB.spec b/SPECS/perl-DBD-MariaDB.spec new file mode 100644 index 0000000..dfd6bf7 --- /dev/null +++ b/SPECS/perl-DBD-MariaDB.spec @@ -0,0 +1,225 @@ +# Disable leak tests +%bcond_with perl_DBD_MariaDB_enables_leak_test +# Perform optional net_ssleay tests +%if 0%{?rhel} +%bcond_with perl_DBD_MariaDB_enables_net_ssleay_test +%else +%bcond_without perl_DBD_MariaDB_enables_net_ssleay_test +%endif + +Name: perl-DBD-MariaDB +Version: 1.21 +Release: 16%{?dist} +Summary: MariaDB and MySQL driver for the Perl5 Database Interface (DBI) +License: GPL+ or Artistic +URL: https://metacpan.org/release/DBD-MariaDB/ +Source0: https://cpan.metacpan.org/authors/id/P/PA/PALI/DBD-MariaDB-%{version}.tar.gz +Source1: test-setup.t +Source2: test-clean.t +Source3: test-env.sh +Patch0: DBD-MariaDB-1.21-Run-test-setup-and-clean.patch +# Fix test for changed value of mariadb_clientversion +# mariadb-connector-c 3.2.x version number changed mariadb_clientversion to 3020x +Patch1: DBD-MariaDB-fix-mariadb-connector-c-32x-test.patch +BuildRequires: findutils +BuildRequires: gcc +BuildRequires: make +BuildRequires: mariadb-connector-c +BuildRequires: mariadb-connector-c-devel +BuildRequires: openssl-devel +BuildRequires: perl-devel +BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: perl(:VERSION) >= 5.8.1 +BuildRequires: perl(Config) +BuildRequires: perl(Data::Dumper) +BuildRequires: perl(DBI) >= 1.608 +BuildRequires: perl(DBI::DBD) +BuildRequires: perl(Devel::CheckLib) >= 1.12 +BuildRequires: perl(DynaLoader) +BuildRequires: perl(ExtUtils::MakeMaker) >= 6.76 +BuildRequires: perl(File::Spec) +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(strict) +BuildRequires: perl(utf8) +BuildRequires: perl(warnings) +# Tests +BuildRequires: hostname +BuildRequires: mariadb +BuildRequires: mariadb-server +BuildRequires: perl(B) +BuildRequires: perl(bigint) +BuildRequires: perl(constant) +# Required to process t/testrules.yml +BuildRequires: perl(CPAN::Meta::YAML) +BuildRequires: perl(DBI::Const::GetInfoType) +BuildRequires: perl(Encode) +BuildRequires: perl(File::Path) +BuildRequires: perl(File::Temp) +BuildRequires: perl(FindBin) +BuildRequires: perl(lib) +BuildRequires: perl(Test::Deep) +BuildRequires: perl(Test::More) >= 0.90 +BuildRequires: perl(Time::HiRes) +BuildRequires: perl(vars) +# Optional tests +%if %{with perl_DBD_MariaDB_enables_net_ssleay_test} +BuildRequires: perl(Net::SSLeay) +%endif +%if %{with perl_DBD_MariaDB_enables_leak_test} +BuildRequires: perl(Proc::ProcessTable) +BuildRequires: perl(Storable) +%endif + +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) + +# Filter private modules for tests +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(lib.pl\\) + +%description +DBD::MariaDB is the Perl5 Database Interface driver for MariaDB and MySQL +databases. In other words: DBD::MariaDB is an interface between the Perl +programming language and the MariaDB/MySQL programming API that comes with +the MariaDB/MySQL relational database management system. Most functions +provided by this programming API are supported. Some rarely used functions +are missing, mainly because no-one ever requested them. + +%package tests +Summary: Tests for %{name} +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: perl-Test-Harness +Requires: hostname +Requires: mariadb +Requires: mariadb-server +# Required to process t/testrules.yml +Requires: perl(CPAN::Meta::YAML) +# Optional tests +%if %{with perl_DBD_MariaDB_enables_net_ssleay_test} +Requires: perl(Net::SSLeay) +%endif +%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 +%setup -q -n DBD-MariaDB-%{version} +%patch0 -p1 +%patch1 -p1 +cp %{SOURCE1} %{SOURCE2} t/ + +# 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 + +# Remove release tests +for F in t/pod.t t/manifest.t; do + rm "$F" + perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST + perl -i -ne 'print $_ unless m{\Q'"$F"'\E}' t/testrules.yml +done + +%if %{without perl_DBD_MariaDB_enables_leak_test} +# Remove unused tests +for F in t/60leaks.t t/rt86153-reconnect-fail-memory.t; do + rm "$F" + perl -i -ne 'print $_ unless m{^\Q'"$F"'\E}' MANIFEST + perl -i -ne 'print $_ unless m{\Q'"$F"'\E}' t/testrules.yml +done +%endif + +%build +perl Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1 NO_PERLLOCAL=1 +%{make_build} + +%install +%{make_install} +find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -delete + +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +cp %{SOURCE3} %{buildroot}%{_libexecdir}/%{name} +cat > %{buildroot}%{_libexecdir}/%{name}/test << EOF +#!/bin/sh +unset RELEASE_TESTING +. %{_libexecdir}/%{name}/$(basename %{SOURCE3}) +cd %{_libexecdir}/%{name} && exec prove -I . +EOF +chmod +x %{buildroot}%{_libexecdir}/%{name}/test + +%{_fixperms} $RPM_BUILD_ROOT/* + +%check +# Set MariaDB and DBD::MariaDB test environment +. %{SOURCE3} + +unset RELEASE_TESTING +make test %{?with_perl_DBD_MariaDB_enables_leak_test:EXTENDED_TESTING=1} + +%files +%license LICENSE +%doc Changes Changes.historic +%{perl_vendorarch}/auto/* +%{perl_vendorarch}/DBD* +%{_mandir}/man3/* + +%files tests +%{_libexecdir}/%{name} + +%changelog +* Thu Feb 17 2022 Jitka Plesnikova - 1.21-16 +- Fix test for mariadb-connector-c 3.2.x + +* Tue Aug 17 2021 Jitka Plesnikova - 1.21-15 +- Related: rhbz#1960259 - Enable gating + +* Mon Aug 09 2021 Mohan Boddu - 1.21-14 +- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags + Related: rhbz#1991688 + +* Tue Jun 22 2021 Mohan Boddu - 1.21-13 +- Rebuilt for RHEL 9 BETA for openssl 3.0 + Related: rhbz#1971065 + +* Tue May 04 2021 Jitka Plesnikova - 1.21-12 +- Update tests + +* Fri Mar 12 2021 Jitka Plesnikova - 1.21-11 +- Package tests + +* Wed Jan 27 2021 Fedora Release Engineering - 1.21-10 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild + +* Tue Jul 28 2020 Fedora Release Engineering - 1.21-9 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild + +* Tue Jun 23 2020 Jitka Plesnikova - 1.21-8 +- Perl 5.32 rebuild + +* Fri Apr 17 2020 Jitka Plesnikova - 1.21-7 +- Update setup script due to Pali's comments + +* Tue Feb 04 2020 Jitka Plesnikova - 1.21-6 +- Update setup script to work with MariaDB 10.4 + +* Wed Jan 29 2020 Fedora Release Engineering - 1.21-5 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild + +* Fri Jul 26 2019 Fedora Release Engineering - 1.21-4 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild + +* Wed Jul 10 2019 Jitka Plesnikova - 1.21-3 +- Run setup as part of tests + +* Wed Jun 26 2019 Jitka Plesnikova - 1.21-2 +- Enable tests + +* Thu Jun 13 2019 Jitka Plesnikova - 1.21-1 +- Specfile autogenerated by cpanspec 1.78.