[packages/perl-Test-Block] - added patch from rt.cpan for perl 5.24 (>= 5.23.8) compatibility - updated BRs - release 2

qboosh qboosh at pld-linux.org
Thu Nov 10 18:42:19 CET 2016


commit b9f2a8b006749726c414638744457aac8eb750a9
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Thu Nov 10 18:42:18 2016 +0100

    - added patch from rt.cpan for perl 5.24 (>= 5.23.8) compatibility
    - updated BRs
    - release 2

 perl-Test-Block-perl5.24.patch | 91 ++++++++++++++++++++++++++++++++++++++++++
 perl-Test-Block.spec           | 14 +++++--
 2 files changed, 101 insertions(+), 4 deletions(-)
---
diff --git a/perl-Test-Block.spec b/perl-Test-Block.spec
index 14e2092..ce5ba01 100644
--- a/perl-Test-Block.spec
+++ b/perl-Test-Block.spec
@@ -9,18 +9,23 @@ Summary:	Test::Block - Specify fine granularity test plans
 Summary(pl.UTF-8):	Test::Block - określanie szczegółowych planów testów
 Name:		perl-Test-Block
 Version:	0.13
-Release:	1
+Release:	2
 # same as perl
 License:	GPL v1+ or Artistic
 Group:		Development/Languages/Perl
 Source0:	http://www.cpan.org/modules/by-module/Test/%{pdir}-%{pnam}-%{version}.tar.gz
 # Source0-md5:	f4e289f7f2a333983f1e4d578d82f5a3
+# https://rt.cpan.org/Ticket/Attachment/1600903/856113/0001-Make-Test-Block-work-with-perl-5.23.8.patch
+Patch0:		%{name}-perl5.24.patch
 URL:		http://search.cpan.org/dist/Test-Block/
+BuildRequires:	perl-Module-Build >= 0.38
 BuildRequires:	perl-devel >= 1:5.8.0
 BuildRequires:	rpm-perlprov >= 4.1-13
 %if %{with tests}
-BuildRequires:	perl(Test::Builder::Tester) >= 1.01
+BuildRequires:	perl(Test::Builder) >= 0.17
+BuildRequires:	perl-Test-Builder-Tester >= 1.01
 BuildRequires:	perl-Test-Exception >= 0.15
+BuildRequires:	perl-Test-Simple >= 0.47
 %endif
 Requires:	perl-base
 BuildArch:	noarch
@@ -40,6 +45,7 @@ Test::Builder i dobrze współpracuje z Test::More oraz podobnymi.
 
 %prep
 %setup -q -n %{pdir}-%{pnam}-%{version}
+%patch0 -p2
 
 %build
 %{__perl} Build.PL \
@@ -60,5 +66,5 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(644,root,root,755)
 %doc Changes README
-%{perl_vendorlib}/Test/*.pm
-%{_mandir}/man3/*
+%{perl_vendorlib}/Test/Block.pm
+%{_mandir}/man3/Test::Block.3pm*
diff --git a/perl-Test-Block-perl5.24.patch b/perl-Test-Block-perl5.24.patch
new file mode 100644
index 0000000..1cdf5f7
--- /dev/null
+++ b/perl-Test-Block-perl5.24.patch
@@ -0,0 +1,91 @@
+From cb65aada4214c7ba701e2ea46ba4a17dc12a4025 Mon Sep 17 00:00:00 2001
+From: David Mitchell <davem at iabyn.com>
+Date: Fri, 26 Feb 2016 16:40:30 +0000
+Subject: [PATCH] Make Test-Block work with perl 5.23.8+
+
+In 5.23.8, the order of steps that perl takes when leaving a scope has
+changed. In particular, destructors are now called *before* PL_curcop
+is restored and before the context is popped from the stack.
+
+The net effect of this is that caller() called from a destructor called
+while exiting a scope will see the last line of the exiting scope rather
+than its first line, and may see STOREs still in the call stack that
+were triggered by undoing a locations of a tied variable, that themselves
+trigger destructors.
+---
+ Test-Block-0.13/lib/Test/Block.pm | 16 ++++++++++++++++
+ Test-Block-0.13/t/block.t         | 10 +++++++---
+ 2 files changed, 23 insertions(+), 3 deletions(-)
+
+diff --git a/Test-Block-0.13/lib/Test/Block.pm b/Test-Block-0.13/lib/Test/Block.pm
+index 1598ea7..3e1b029 100644
+--- a/Test-Block-0.13/lib/Test/Block.pm
++++ b/Test-Block-0.13/lib/Test/Block.pm
+@@ -59,6 +59,22 @@ sub DESTROY {
+     my $name = $self->{name};
+     my $tests_ran = _tests_run_in_block($self);
+     $name = "'$name'" unless looks_like_number( $name );
++
++    # In perl 5.23.7 and earlier, the call stack at this point looks like:
++    #
++    #     Test::Block::DESTROY(...)     called at test_script line NNN
++    #     eval {...}                    called at test_script line NNN
++    #
++    # in perl 5.23.8 and later, like:
++    #
++    #     Test::Block::DESTROY(...)     called at Tie/Scalar.pm line 157
++    #     eval {...}                    called at Tie/Scalar.pm line 157
++    #     Tie::StdScalar::STORE(...)    called at Test/Block.pm line 96
++    #     Test::Block::Plan::STORE(...) called at test_script line NNN
++    #
++    local $Test::Builder::Level =
++        $Test::Builder::Level + ($] >= 5.023008 ? 3 : 0);
++
+     $Test_builder->ok(
+         0, 
+         "block $name expected $expected test(s) and ran $tests_ran"
+diff --git a/Test-Block-0.13/t/block.t b/Test-Block-0.13/t/block.t
+index fbf8469..4a9f814 100644
+--- a/Test-Block-0.13/t/block.t
++++ b/Test-Block-0.13/t/block.t
+@@ -4,6 +4,10 @@ use Test::Builder::Tester tests => 6;
+ use Test::More;
+ use Test::Block;
+ 
++# in perl 5.23.8 and later, caller() in a destructor called while
++# exiting a block shows the last line of the block, not the first
++my $lastl = $] >= 5.023008;
++
+ test_out('ok 1');
+ {
+ 	my $block = Test::Block->plan(1);
+@@ -14,7 +18,7 @@ test_test("count okay");
+ 
+ test_out('ok 1');
+ test_out('not ok 2 - block 2 expected 2 test(s) and ran 1');
+-test_fail(+2);
++test_fail($lastl ? +3 : +2);
+ {
+ 	my $block = Test::Block->plan(2);
+ 	ok(1);
+@@ -25,7 +29,7 @@ test_test("too few tests");
+ test_out('ok 1');
+ test_out('ok 2');
+ test_out('not ok 3 - block 3 expected 1 test(s) and ran 2');
+-test_fail(+2);
++test_fail($lastl ? +4 : +2);
+ {
+ 	my $block = Test::Block->plan(1);
+ 	ok(1);
+@@ -57,7 +61,7 @@ test_test("nested blocks");
+ 
+ test_out('ok 1');
+ test_out("not ok 2 - block 'foo' expected 2 test(s) and ran 1");
+-test_fail(+2);
++test_fail($lastl ? +3 : +2);
+ {
+ 	my $block = Test::Block->plan(foo => 2);
+ 	ok(1);
+-- 
+2.4.3
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/perl-Test-Block.git/commitdiff/b9f2a8b006749726c414638744457aac8eb750a9



More information about the pld-cvs-commit mailing list