[perl-Data-Dump-Streamer/epel7: 5/5] Fix build with JSON::XS >= 3

Lubomir Rintel lkundrak at fedoraproject.org
Wed Jan 29 10:49:53 UTC 2014


commit 3c3de5dd6ffe512bc052f6c23aae20937fd58b8c
Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Wed Jan 29 11:49:28 2014 +0100

    Fix build with JSON::XS >= 3

 perl-Data-Dump-Streamer-2.36-json-xs.patch |   88 ++++++++++++++++++++++++++++
 perl-Data-Dump-Streamer.spec               |    3 +
 2 files changed, 91 insertions(+), 0 deletions(-)
---
diff --git a/perl-Data-Dump-Streamer-2.36-json-xs.patch b/perl-Data-Dump-Streamer-2.36-json-xs.patch
new file mode 100644
index 0000000..54539ee
--- /dev/null
+++ b/perl-Data-Dump-Streamer-2.36-json-xs.patch
@@ -0,0 +1,88 @@
+From 5ca578adc164543fdb79914c931b1654d2655fef Mon Sep 17 00:00:00 2001
+From: Lubomir Rintel <lkundrak at v3.sk>
+Date: Wed, 29 Jan 2014 11:43:54 +0100
+Subject: [PATCH] t/madness_json.t: Use correct JSON true class
+
+The behavior changed with JSON::XS.
+---
+ t/madness_json.t | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/t/madness_json.t b/t/madness_json.t
+index 2272548..b7a7968 100644
+--- a/t/madness_json.t
++++ b/t/madness_json.t
+@@ -248,6 +248,11 @@ format STDOUT =
+         JSB => $jstrue,
+         );
+ 
++    # Versions of JSON::XS prior to 3.00 return obsolete JSON::XS::Boolean
++    # which will be removed in future.
++    my $jsbool_class = $JSON::XS::VERSION < 3.000_000 ?
++        'JSON::XS::Boolean' : 'JSON::PP::Boolean';
++
+     # Dumping differences per perl version:
+     # 5.12.0+:
+     #
+@@ -284,7 +289,7 @@ _EOF_FORMAT_
+            RV  => \do { my $v = expected_dot },
+            UND => undef
+          };
+-bless( $HASH1->{JSB}, 'JSON::XS::Boolean' );
++bless( $HASH1->{JSB}, 'jsbool_class' );
+ EXPECT
+         require B::Deparse;
+         if (new B::Deparse -> coderef2text (
+@@ -292,10 +297,10 @@ EXPECT
+            ) !~ 'refs') {
+             $expect =~ s/strict 'refs'/strict/;
+         }
+-        same( $dump= $o->Data(\%hash)->Out, template( $expect, expected_dot => $expected_dot ), "", $o);
++        same( $dump= $o->Data(\%hash)->Out, template( $expect, expected_dot => $expected_dot, jsbool_class => $jsbool_class ), "", $o);
+     }
+     elsif ( $] >= 5.008_008 ) {
+-        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot ), "", $o);
++        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot, jsbool_class => $jsbool_class ), "", $o);
+ $HASH1 = {
+            AR  => [
+                     1,
+@@ -325,11 +330,11 @@ _EOF_FORMAT_
+            RV  => \do { my $v = expected_dot },
+            UND => undef
+          };
+-bless( $HASH1->{JSB}, 'JSON::XS::Boolean' );
++bless( $HASH1->{JSB}, 'jsbool_class' );
+ EXPECT
+     }
+     elsif ( $] >= 5.008_000 ) {
+-        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot ), "", $o);
++        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot, jsbool_class => $jsbool_class ), "", $o);
+ $HASH1 = {
+            AR  => [
+                     1,
+@@ -359,11 +364,11 @@ _EOF_FORMAT_
+            RV  => \do { my $v = expected_dot },
+            UND => undef
+          };
+-bless( $HASH1->{JSB}, 'JSON::XS::Boolean' );
++bless( $HASH1->{JSB}, 'jsbool_class' );
+ EXPECT
+     }
+     else {
+-        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot ), "", $o);
++        same( $dump= $o->Data(\%hash)->Out, template( <<'EXPECT', expected_dot => $expected_dot, jsbool_class => $jsbool_class ), "", $o);
+ $HASH1 = {
+            AR  => [
+                     1,
+@@ -385,7 +390,7 @@ $HASH1 = {
+            RV  => \do { my $v = expected_dot },
+            UND => undef
+          };
+-bless( $HASH1->{JSB}, 'JSON::XS::Boolean' );
++bless( $HASH1->{JSB}, 'jsbool_class' );
+ EXPECT
+     }
+ }
+-- 
+1.8.3.1
+
diff --git a/perl-Data-Dump-Streamer.spec b/perl-Data-Dump-Streamer.spec
index 9d28b51..b7a5ad5 100644
--- a/perl-Data-Dump-Streamer.spec
+++ b/perl-Data-Dump-Streamer.spec
@@ -6,6 +6,7 @@ License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Data-Dump-Streamer/
 Source0:        http://search.cpan.org/CPAN/authors/id/Y/YV/YVES/Data-Dump-Streamer-%{version}.tar.gz
+Patch0:         perl-Data-Dump-Streamer-2.36-json-xs.patch
 BuildRequires:  perl(Algorithm::Diff)
 BuildRequires:  perl(B::Utils)
 BuildRequires:  perl(Compress::Zlib)
@@ -36,6 +37,7 @@ output correctly.
 
 %prep
 %setup -q -n Data-Dump-Streamer-%{version}
+%patch0 -p1 -b .json-xs
 find . -type f | xargs chmod -x
 
 %build
@@ -61,6 +63,7 @@ find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \;
 %changelog
 * Wed Jan 29 2014 Lubomir Rintel <lkundrak at v3.sk> 2.36-1
 - update to latest upstream version
+- Fix build with JSON::XS >= 3
 
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.34-6
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild


More information about the scm-commits mailing list