commit f18e8da4d6fcbf13e5b9960ac5e28a5f2fedf0e1 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 11:11:56 2019 -0400 Package init diff --git a/0000-perl-DBD-SQLite-bz543982.patch b/0000-perl-DBD-SQLite-bz543982.patch new file mode 100644 index 0000000..1d85380 --- /dev/null +++ b/0000-perl-DBD-SQLite-bz543982.patch @@ -0,0 +1,12 @@ +diff -up DBD-SQLite-1.27/Makefile.PL.old DBD-SQLite-1.27/Makefile.PL +--- DBD-SQLite-1.27/Makefile.PL.old 2009-11-23 12:08:05.000000000 +0100 ++++ DBD-SQLite-1.27/Makefile.PL 2010-01-11 15:40:56.456399143 +0100 +@@ -129,7 +129,7 @@ if ( $@ or DBI->VERSION < $DBI_required + # a system sqlite is also sophisticated enough to have a patching system + # that can change the if ( 0 ) to if ( 1 ) + my ($sqlite_local, $sqlite_base, $sqlite_lib, $sqlite_inc); +-if ( 0 ) { ++if ( 1 ) { + require File::Spec; + if ( $sqlite_base = (grep(/SQLITE_LOCATION=.*/, @ARGV))[0] ) { + $sqlite_base =~ /=(.*)/; diff --git a/0001-DBD-SQLite-1.50-Remove-bundled-source-extentions.patch b/0001-DBD-SQLite-1.50-Remove-bundled-source-extentions.patch new file mode 100644 index 0000000..878663b --- /dev/null +++ b/0001-DBD-SQLite-1.50-Remove-bundled-source-extentions.patch @@ -0,0 +1,100 @@ +From 8973008e7e50b14e266dd3ff6b4728289910ba5f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 18 Feb 2016 14:16:06 +0100 +Subject: [PATCH] Remove bundled source extentions +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + README | 30 ------------------------------ + lib/DBD/SQLite.pm | 31 ------------------------------- + 2 files changed, 61 deletions(-) + +diff --git a/README b/README +index c1577c2..bf7503c 100644 +--- a/README ++++ b/README +@@ -1222,36 +1222,6 @@ R* TREE SUPPORT + using callbacks, as mentioned in the prior link, have not been + implemented yet. + +-FOR DBD::SQLITE EXTENSION AUTHORS +- Since 1.30_01, you can retrieve the bundled sqlite C source and/or +- header like this: +- +- use File::ShareDir 'dist_dir'; +- use File::Spec::Functions 'catfile'; +- +- # the whole sqlite3.h header +- my $sqlite3_h = catfile(dist_dir('DBD-SQLite'), 'sqlite3.h'); +- +- # or only a particular header, amalgamated in sqlite3.c +- my $what_i_want = 'parse.h'; +- my $sqlite3_c = catfile(dist_dir('DBD-SQLite'), 'sqlite3.c'); +- open my $fh, '<', $sqlite3_c or die $!; +- my $code = do { local $/; <$fh> }; +- my ($parse_h) = $code =~ m{( +- /\*+[ ]Begin[ ]file[ ]$what_i_want[ ]\*+ +- .+? +- /\*+[ ]End[ ]of[ ]$what_i_want[ ]\*+/ +- )}sx; +- open my $out, '>', $what_i_want or die $!; +- print $out $parse_h; +- close $out; +- +- You usually want to use this in your extension's "Makefile.PL", and you +- may want to add DBD::SQLite to your extension's "CONFIGURE_REQUIRES" to +- ensure your extension users use the same C source/header they use to +- build DBD::SQLite itself (instead of the ones installed in their +- system). +- + TO DO + The following items remain to be done. + +diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm +index d03aeb5..60b74a7 100644 +--- a/lib/DBD/SQLite.pm ++++ b/lib/DBD/SQLite.pm +@@ -2494,37 +2494,6 @@ sources, etc. + + Other Perl virtual tables may also be published separately on CPAN. + +-=head1 FOR DBD::SQLITE EXTENSION AUTHORS +- +-Since 1.30_01, you can retrieve the bundled SQLite C source and/or +-header like this: +- +- use File::ShareDir 'dist_dir'; +- use File::Spec::Functions 'catfile'; +- +- # the whole sqlite3.h header +- my $sqlite3_h = catfile(dist_dir('DBD-SQLite'), 'sqlite3.h'); +- +- # or only a particular header, amalgamated in sqlite3.c +- my $what_i_want = 'parse.h'; +- my $sqlite3_c = catfile(dist_dir('DBD-SQLite'), 'sqlite3.c'); +- open my $fh, '<', $sqlite3_c or die $!; +- my $code = do { local $/; <$fh> }; +- my ($parse_h) = $code =~ m{( +- /\*+[ ]Begin[ ]file[ ]$what_i_want[ ]\*+ +- .+? +- /\*+[ ]End[ ]of[ ]$what_i_want[ ]\*+/ +- )}sx; +- open my $out, '>', $what_i_want or die $!; +- print $out $parse_h; +- close $out; +- +-You usually want to use this in your extension's C, +-and you may want to add DBD::SQLite to your extension's C +-to ensure your extension users use the same C source/header they use +-to build DBD::SQLite itself (instead of the ones installed in their +-system). +- + =head1 TO DO + + The following items remain to be done. +-- +2.5.0 + diff --git a/0002-DBD-SQLite-1.58-Unbundle-Test-NoWarnings.patch b/0002-DBD-SQLite-1.58-Unbundle-Test-NoWarnings.patch new file mode 100644 index 0000000..2c883e7 --- /dev/null +++ b/0002-DBD-SQLite-1.58-Unbundle-Test-NoWarnings.patch @@ -0,0 +1,65 @@ +From 1944bbf4f29181690097e61f1410d30d43343b02 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Thu, 29 Mar 2018 10:40:17 +0200 +Subject: [PATCH] Unbundle Test::NoWarnings +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Petr Písař +--- + Makefile.PL | 6 ++---- + t/virtual_table/11_filecontent_fulltext.t | 7 ++----- + +diff --git a/Makefile.PL b/Makefile.PL +index fcdf771..3860eda 100644 +--- a/Makefile.PL ++++ b/Makefile.PL +@@ -330,8 +330,7 @@ WriteMakefile( + 'Tie::Hash' => 0, + 'File::Spec' => (WINLIKE ? '3.27' : '0.82'), + 'DBI' => $DBI_required, +- 'Test::More' => '0.47', # Test::NoWarnings +- 'Test::Builder' => '0.86', # Test::NoWarnings ++ 'Test::More' => 0, + ( WINLIKE ? ( + 'Win32' => '0.30', + ) : () ), +@@ -363,8 +362,7 @@ WriteMakefile( + build_requires => { + 'File::Spec' => (WINLIKE ? '3.27' : '0.82'), + 'Test::More' => '0.42', +- # Bundled in /inc +- # 'Test::NoWarnings' => '0.081', ++ 'Test::NoWarnings' => '0.081', + }, + requires => { + 'Tie::Hash' => 0, +diff --git a/t/virtual_table/11_filecontent_fulltext.t b/t/virtual_table/11_filecontent_fulltext.t +index b95b115..7e805f1 100644 +--- a/t/virtual_table/11_filecontent_fulltext.t ++++ b/t/virtual_table/11_filecontent_fulltext.t +@@ -27,9 +27,7 @@ my @tests = ( + lib/DBD/SQLite/VirtualTable/FileContent.pm + lib/DBD/SQLite/VirtualTable/PerlData.pm]], + ["install_method" => qw[lib/DBD/SQLite.pm]], +- ['"use strict"' => qw[inc/Test/NoWarnings.pm +- inc/Test/NoWarnings/Warning.pm +- lib/DBD/SQLite.pm ++ ['"use strict"' => qw[lib/DBD/SQLite.pm + lib/DBD/SQLite/Constants.pm + lib/DBD/SQLite/VirtualTable.pm + lib/DBD/SQLite/VirtualTable/FileContent.pm +@@ -42,8 +40,7 @@ my @tests = ( + # literally. + if (grep /ENABLE_FTS3_PARENTHESIS/, DBD::SQLite::compile_options()) { + push @tests, ( +- ['"use strict" AND "use warnings"' => qw[inc/Test/NoWarnings.pm +- lib/DBD/SQLite/Constants.pm ++ ['"use strict" AND "use warnings"' => qw[lib/DBD/SQLite/Constants.pm + lib/DBD/SQLite/VirtualTable.pm + lib/DBD/SQLite/VirtualTable/FileContent.pm + lib/DBD/SQLite/VirtualTable/PerlData.pm +-- +2.14.3 + diff --git a/6000-Handle-unknown-op-in-DBD-SQLite-VirtualTable-PerlDat.patch b/6000-Handle-unknown-op-in-DBD-SQLite-VirtualTable-PerlDat.patch new file mode 100644 index 0000000..681a910 --- /dev/null +++ b/6000-Handle-unknown-op-in-DBD-SQLite-VirtualTable-PerlDat.patch @@ -0,0 +1,155 @@ +From 1fd1a0d15f2be081391710c5035f2ba69d5a51a0 Mon Sep 17 00:00:00 2001 +From: Max Maischein +Date: Fri, 25 Jan 2019 19:05:07 +0100 +Subject: [PATCH 089/102] Handle 'unknown' op in + DBD::SQLite::VirtualTable::PerlData + +This patch adds code and a test when SQLite generates an 'unknown' +op for a table join in the BEST_INDEX() callback. The Perl code crashed +when such an op was generated for a JOIN criterion by the SQLite engine. + +The SQLite engine creates an 'unknown' op on the following SQL +for example: + + select r.nodepath + from temp.scan_results r + left join temp.scan_results m + on r.nodepath = m.nodepath+1 + where m.nodepath is null + +The important part is that the right side of the left join must be +checked for IS NULL. +--- + MANIFEST | 1 + + lib/DBD/SQLite/VirtualTable/PerlData.pm | 2 +- + t/virtual_table/unknown_op.t | 93 +++++++++++++++++++++++++ + 3 files changed, 95 insertions(+), 1 deletion(-) + create mode 100644 t/virtual_table/unknown_op.t + +diff --git a/MANIFEST b/MANIFEST +index 96e1192..c53f269 100644 +--- a/MANIFEST ++++ b/MANIFEST +@@ -138,5 +138,6 @@ t/virtual_table/20_perldata.t + t/virtual_table/21_perldata_charinfo.t + t/virtual_table/rt_99748.t ++t/virtual_table/unknown_op.t + typemap + xt/cpp_comments.t + xt/meta.t +diff --git a/lib/DBD/SQLite/VirtualTable/PerlData.pm b/lib/DBD/SQLite/VirtualTable/PerlData.pm +index 39ca09b..0e58d7d 100644 +--- a/lib/DBD/SQLite/VirtualTable/PerlData.pm ++++ b/lib/DBD/SQLite/VirtualTable/PerlData.pm +@@ -88,7 +88,7 @@ sub BEST_INDEX { + # in FILTER() for deciding which rows match the constraints. + my @conditions; + my $ix = 0; +- foreach my $constraint (grep {$_->{usable}} @$constraints) { ++ foreach my $constraint (grep {$_->{usable} and exists $SQLOP2PERLOP{ $_->{op} } } @$constraints) { + my $col = $constraint->{col}; + my ($member, $optype); + +diff --git a/t/virtual_table/unknown_op.t b/t/virtual_table/unknown_op.t +new file mode 100644 +index 0000000..e8fe04b +--- /dev/null ++++ b/t/virtual_table/unknown_op.t +@@ -0,0 +1,93 @@ ++#!perl -w ++ ++use strict; ++use Test::More tests => 4; ++ ++our $scan_results = [ ++ { nodepath => 1 }, ++ { nodepath => 2 }, ++ { nodepath => 3 }, ++]; ++ ++my $dbh = DBI->connect("dbi:SQLite:dbname=:memory:", '', '', ++ {RaiseError => 1, AutoCommit => 1}); ++ ++# register the module ++$dbh->sqlite_create_module(perl => "DBD::SQLite::VirtualTable::PerlData"); ++$dbh->do(<<'SQL'); ++ CREATE VIRTUAL TABLE temp.scan_results ++ USING perl(file varchar, ++ value varchar, ++ selector varchar, ++ nodepath varchar, ++ expected integer, ++ preference integer, ++ complexity integer, ++ location varchar, ++ type varchar, ++ hashrefs="main::scan_results") ++SQL ++ ++my $ok = eval { ++ my $sth = $dbh->prepare(<<'SQL'); ++ select distinct r.selector ++ from temp.scan_results r ++ left join temp.scan_results m ++ on r.nodepath = m.nodepath+1 ++ where m.nodepath = 1 ++SQL ++$sth->execute; ++ #use DBIx::RunSQL; print DBIx::RunSQL->format_results( sth => $sth ); ++ 1; ++}; ++is $ok, 1, "We survive a numeric comparison"; ++undef $ok; ++ ++$ok = eval { ++ my $sth = $dbh->prepare(<<'SQL'); ++ select distinct r.selector ++ from temp.scan_results r ++ left join temp.scan_results m ++ on r.nodepath = m.nodepath+1 ++ where m.nodepath is not null ++SQL ++ $sth->execute; ++ 1; ++ #use DBIx::RunSQL; print DBIx::RunSQL->format_results( sth => $sth ); ++}; ++is $ok, 1, "We survive an isnull comparison"; ++undef $ok; ++ ++$ok = eval { ++ my $sth = $dbh->prepare(<<'SQL'); ++ select r.nodepath ++ from temp.scan_results r ++ left join temp.scan_results m ++ on r.nodepath = m.nodepath+1 ++ where r.nodepath is null ++SQL ++ $sth->execute; ++ 1; ++ #use DBIx::RunSQL; print DBIx::RunSQL->format_results( sth => $sth ); ++}; ++is $ok, 1, "We survive an isnull comparison on the left side"; ++undef $ok; ++ ++my $sth; ++$ok = eval { ++ $sth = $dbh->prepare(<<'SQL'); ++ select r.nodepath ++ from temp.scan_results r ++ left join temp.scan_results m ++ on r.nodepath = m.nodepath+1 ++ where m.nodepath is null ++SQL ++ $sth->execute; ++ 1; ++ #use DBIx::RunSQL; print DBIx::RunSQL->format_results( sth => $sth ); ++}; ++is $ok, 1, "We survive an isnull comparison on the right side"; ++undef $ok; ++#my $rows = $sth->fetchall_arrayref; ++#use Data::Dumper; ++#warn Dumper $rows; +\ No newline at end of file +-- +2.19.1 + diff --git a/6001-added-a-boilerplace-for-test.patch b/6001-added-a-boilerplace-for-test.patch new file mode 100644 index 0000000..7d3226d --- /dev/null +++ b/6001-added-a-boilerplace-for-test.patch @@ -0,0 +1,48 @@ +From 90ec098f1ccd5e253799a656de630bfab7badd3b Mon Sep 17 00:00:00 2001 +From: Kenichi Ishigaki +Date: Sat, 26 Jan 2019 06:56:16 +0900 +Subject: [PATCH 091/102] added a boilerplace for test + +--- + t/virtual_table/unknown_op.t | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/t/virtual_table/unknown_op.t b/t/virtual_table/unknown_op.t +index e8fe04b..885c1d2 100644 +--- a/t/virtual_table/unknown_op.t ++++ b/t/virtual_table/unknown_op.t +@@ -1,7 +1,9 @@ +-#!perl -w +- + use strict; +-use Test::More tests => 4; ++use warnings; ++use lib "t/lib"; ++use SQLiteTest; ++use Test::More; ++use if -d ".git", "Test::FailWarnings"; + + our $scan_results = [ + { nodepath => 1 }, +@@ -9,8 +11,7 @@ our $scan_results = [ + { nodepath => 3 }, + ]; + +-my $dbh = DBI->connect("dbi:SQLite:dbname=:memory:", '', '', +- {RaiseError => 1, AutoCommit => 1}); ++my $dbh = connect_ok(RaiseError => 1, AutoCommit => 1); + + # register the module + $dbh->sqlite_create_module(perl => "DBD::SQLite::VirtualTable::PerlData"); +@@ -90,4 +91,6 @@ is $ok, 1, "We survive an isnull comparison on the right side"; + undef $ok; + #my $rows = $sth->fetchall_arrayref; + #use Data::Dumper; +-#warn Dumper $rows; +\ No newline at end of file ++#warn Dumper $rows; ++ ++done_testing; +-- +2.19.1 + diff --git a/6002-fixed-for-older-DBI.patch b/6002-fixed-for-older-DBI.patch new file mode 100644 index 0000000..24280b7 --- /dev/null +++ b/6002-fixed-for-older-DBI.patch @@ -0,0 +1,25 @@ +From b0fad50e4c17edaffd0a0627232b5c50aa17bc64 Mon Sep 17 00:00:00 2001 +From: Kenichi Ishigaki +Date: Sat, 26 Jan 2019 07:12:40 +0900 +Subject: [PATCH 093/102] fixed for older DBI + +--- + t/virtual_table/unknown_op.t | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/t/virtual_table/unknown_op.t b/t/virtual_table/unknown_op.t +index 885c1d2..c9f9952 100644 +--- a/t/virtual_table/unknown_op.t ++++ b/t/virtual_table/unknown_op.t +@@ -14,7 +14,7 @@ our $scan_results = [ + my $dbh = connect_ok(RaiseError => 1, AutoCommit => 1); + + # register the module +-$dbh->sqlite_create_module(perl => "DBD::SQLite::VirtualTable::PerlData"); ++$dbh->$sqlite_call(create_module => perl => "DBD::SQLite::VirtualTable::PerlData"); + $dbh->do(<<'SQL'); + CREATE VIRTUAL TABLE temp.scan_results + USING perl(file varchar, +-- +2.19.1 + diff --git a/DBD-SQLite-1.58.tar.gz b/DBD-SQLite-1.58.tar.gz new file mode 100644 index 0000000..51b6e7e Binary files /dev/null and b/DBD-SQLite-1.58.tar.gz differ diff --git a/perl-DBD-SQLite.spec b/perl-DBD-SQLite.spec new file mode 100644 index 0000000..3478349 --- /dev/null +++ b/perl-DBD-SQLite.spec @@ -0,0 +1,101 @@ +Name: perl-DBD-SQLite +Version: 1.58 +Release: 4 +Summary: DBD::SQLite embeds SQLite database engine into a DBD driver +License: (GPL+ or Artistic) and Public Domain +URL: https://metacpan.org/release/DBD-SQLite +Source0: https://cpan.metacpan.org/authors/id/I/IS/ISHIGAKI/DBD-SQLite-%{version}.tar.gz + +Patch0: 0000-perl-DBD-SQLite-bz543982.patch +Patch1: 0001-DBD-SQLite-1.50-Remove-bundled-source-extentions.patch +Patch2: 0002-DBD-SQLite-1.58-Unbundle-Test-NoWarnings.patch + +Patch6000: 6000-Handle-unknown-op-in-DBD-SQLite-VirtualTable-PerlDat.patch +Patch6001: 6001-added-a-boilerplace-for-test.patch +Patch6002: 6002-fixed-for-older-DBI.patch + +BuildRequires: sqlite-devel coreutils findutils +BuildRequires: gcc make perl-devel +BuildRequires: perl-generators perl-interpreter perl(:VERSION) >= 5.6 +BuildRequires: perl(base) perl(Config) perl(constant) +BuildRequires: perl(DBI) >= 1.607 perl(DBI::DBD) perl(ExtUtils::MakeMaker) >= 6.76 +BuildRequires: perl(File::Spec) >= 0.82 perl(strict) + +BuildRequires: perl(DynaLoader) perl(locale) perl(Scalar::Util) +BuildRequires: perl(Tie::Hash) perl(warnings) sed + +BuildRequires: perl(bytes) perl(Carp) perl(Data::Dumper) +BuildRequires: perl(Encode) perl(Exporter) perl(File::Spec::Functions) +BuildRequires: perl(File::Temp) perl(FindBin) perl(lib) + +BuildRequires: perl(Test::More) perl(Test::NoWarnings) >= 0.081 +BuildRequires: perl(Unicode::UCD) + +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) + +%{?perl_default_filter} + +%description +SQLite is a software library that implements a self-sufficient, serverless, +zero-configuration, transactional SQL database engine. + +SQLite can be integrated with Perl using the Perl DBI module. +The Perl DBI module is the database access module for the Perl programming language. + +%package help +Summary: Including man files for perl-DBD-SQLite +Requires: man + +%description help +This contains man files for the using of perl-DBD-SQLite. + + +%prep +%autosetup -n DBD-SQLite-%{version} -p1 + +rm sqlite* +sed -i -e '/^sqlite/ d' MANIFEST +rm -rf inc +sed -i -e '/^inc\// d' MANIFEST + +%build +CFLAGS="%{optflags}" perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 +%make_build OPTIMIZE="%{optflags}" + +%install +make pure_install DESTDIR=%{buildroot} +find %{buildroot} -name '*.bs' -type f -delete +%{_fixperms} %{buildroot}/* + +%check +make test + +%files +%doc Changes README +%{perl_vendorarch}/auto/* +%{perl_vendorarch}/DBD/ + +%files help +%{_mandir}/man3/*.3pm* + +%changelog +* Sat Aug 31 2019 zhangsaisai - 1.58-4 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:openEuler Debranding. + +* Wed Aug 21 2019 guiyao - 1.58-3.h2 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:change patchs' name + +* Tue Apr 16 2019 wangxiao - 1.58-3.h1 +- Type:bugfix +- ID:NA +- SUG:restart +- DESC:Handle unknown op in DBD SQLite VirtualTable PerlData + added a boilerplace for test + fixed for older DBI +- Package init