From 43ca1248e7de5e62dfebea5f6436b6e5b9972983 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
Date: Fri, 27 May 2016 12:40:34 +0200
Subject: Fix loading optional database backends

If some backends were not installed, the code was aborted by
Module::Load::Conditional loading the RDF::Trine::Store::DBI.
---
 ...ine-1.014-Make-database-backends-optional.patch | 27 ++++++++++++++--------
 perl-RDF-Trine.spec                                |  7 ++++--
 2 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/RDF-Trine-1.014-Make-database-backends-optional.patch 
b/RDF-Trine-1.014-Make-database-backends-optional.patch
index d1e3c39..f096d2e 100644
--- a/RDF-Trine-1.014-Make-database-backends-optional.patch
+++ b/RDF-Trine-1.014-Make-database-backends-optional.patch
@@ -1,6 +1,6 @@
-From 2b139e2b6d7b872edb1bc4341e54d10c01607453 Mon Sep 17 00:00:00 2001
+From a7aa7c801bcbccdbd054c77b2a886342e115a926 Mon Sep 17 00:00:00 2001
 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppi...@redhat.com>
-Date: Thu, 24 Mar 2016 14:44:28 +0100
+Date: Fri, 27 May 2016 12:38:45 +0200
 Subject: [PATCH] Make database backends optional
 MIME-Version: 1.0
 Content-Type: text/plain; charset=UTF-8
@@ -8,23 +8,32 @@ Content-Transfer-Encoding: 8bit
 
 Signed-off-by: Petr Písař <ppi...@redhat.com>
 ---
- lib/RDF/Trine/Store/DBI.pm | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
+ lib/RDF/Trine/Store/DBI.pm | 15 ++++++++++++---
+ 1 file changed, 12 insertions(+), 3 deletions(-)
 
 diff --git a/lib/RDF/Trine/Store/DBI.pm b/lib/RDF/Trine/Store/DBI.pm
-index bd59ccb..33cfe74 100644
+index bd59ccb..877a3e4 100644
 --- a/lib/RDF/Trine/Store/DBI.pm
 +++ b/lib/RDF/Trine/Store/DBI.pm
-@@ -57,9 +57,9 @@ use RDF::Trine::Iterator;
+@@ -57,9 +57,18 @@ use RDF::Trine::Iterator;
  use Log::Log4perl;
  
  use RDF::Trine::Error;
 -use RDF::Trine::Store::DBI::mysql;
 -use RDF::Trine::Store::DBI::SQLite;
 -use RDF::Trine::Store::DBI::Pg;
-+eval { use RDF::Trine::Store::DBI::mysql };
-+eval { use RDF::Trine::Store::DBI::SQLite };
-+eval { use RDF::Trine::Store::DBI::Pg };
++BEGIN {
++      # Make database backends optional.
++      # Plain "eval {use Foo}" does not work because this code is itself
++      # loaded by Module::Load::Conditional.
++      for my $store (qw(mysql SQLite Pg)) {
++              Module::Load::Conditional::can_load(autoload => 1,
++                      modules => {
++                              "RDF::Trine::Store::DBI::$store" => undef
++                      }
++              );
++      }
++}
  
  ######################################################################
  
diff --git a/perl-RDF-Trine.spec b/perl-RDF-Trine.spec
index 0773785..41255bd 100644
--- a/perl-RDF-Trine.spec
+++ b/perl-RDF-Trine.spec
@@ -1,6 +1,6 @@
 Name:           perl-RDF-Trine
 Version:        1.014
-Release:        2%{?dist}
+Release:        3%{?dist}
 Summary:        RDF Framework for Perl
 # README:           GPLv+ or Artistic
 # lib/RDF/Trine.pm: GPLv+ or Artistic
@@ -18,7 +18,7 @@ Patch0:         RDF-Trine-1.014-Disable-release-code.patch
 Patch1:         RDF-Trine-1.014-Make-database-backends-optional.patch
 # Avoid TryCatch that does not work with perl-5.24 (bug #1339244),
 # <https://github.com/kasei/perlrdf/issues/138>
-Patch2:        RDF-Trine-1.014-Use-Error-instead-of-TryCatch.patch
+Patch2:         RDF-Trine-1.014-Use-Error-instead-of-TryCatch.patch
 BuildArch:      noarch
 BuildRequires:  coreutils
 BuildRequires:  findutils
@@ -249,6 +249,9 @@ make test
 %{_mandir}/man3/Test::RDF::Trine::Store.*
 
 %changelog
+* Fri May 27 2016 Petr Pisar <ppi...@redhat.com> - 1.014-3
+- Fix loading optional database backends
+
 * Wed May 25 2016 Petr Pisar <ppi...@redhat.com> - 1.014-2
 - Avoid TryCatch that does not work with perl-5.24 (bug #1339244)
 - Perl 5.24 rebuild
-- 
cgit v0.12


        
http://pkgs.fedoraproject.org/cgit/perl-RDF-Trine.git/commit/?h=master&id=43ca1248e7de5e62dfebea5f6436b6e5b9972983
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
https://lists.fedoraproject.org/admin/lists/perl-devel@lists.fedoraproject.org

Reply via email to