[perl-Perl-Critic] Fix breakage with Perl::Tidy ≥ 20120619 (CPAN RT#77977)

Paul Howarth pghmcfc at fedoraproject.org
Tue Jul 10 14:59:34 UTC 2012


commit 7ebd378dc372d774519584051607ccaee7367d92
Author: Paul Howarth <paul at city-fan.org>
Date:   Tue Jul 10 15:52:45 2012 +0100

    Fix breakage with Perl::Tidy ≥ 20120619 (CPAN RT#77977)

 Perl-Critic-1.117-tidy.patch |   41 +++++++++++++++++++++++++++++++++++++++++
 perl-Perl-Critic.spec        |   14 +++++++++++---
 2 files changed, 52 insertions(+), 3 deletions(-)
---
diff --git a/Perl-Critic-1.117-tidy.patch b/Perl-Critic-1.117-tidy.patch
new file mode 100644
index 0000000..d8cef24
--- /dev/null
+++ b/Perl-Critic-1.117-tidy.patch
@@ -0,0 +1,41 @@
+See https://rt.cpan.org/Public/Bug/Display.html?id=77977
+
+--- lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm	(revision 4123)
++++ lib/Perl/Critic/Policy/CodeLayout/RequireTidyCode.pm	(working copy)
+@@ -12,6 +12,7 @@
+ use warnings;
+ 
+ use English qw(-no_match_vars);
++use IO::String qw< >;
+ use Readonly;
+ 
+ use Perl::Tidy qw< >;
+@@ -49,7 +50,8 @@
+ 
+     # Set configuration if defined
+     if (defined $self->{_perltidyrc} && $self->{_perltidyrc} eq $EMPTY) {
+-        $self->{_perltidyrc} = \$EMPTY;
++        my $rc = $EMPTY;
++        $self->{_perltidyrc} = \$rc;
+     }
+ 
+     return $TRUE;
+@@ -92,10 +94,16 @@
+ 
+     # Trap Perl::Tidy errors, just in case it dies
+     my $eval_worked = eval {
++        # Perl::Tidy 20120619 no longer accepts a scalar reference for stdio.
++        my $handle = IO::String->new( $stderr );
++        # Since Perl::Tidy 20120619 modifies $source, we make a copy so
++        # we can get a good comparison. Doing an s/// on $source after the
++        # fact appears not to work with the previous Perl::Tidy.
++        my $source_copy = $source;
+         Perl::Tidy::perltidy(
+-            source      => \$source,
++            source      => \$source_copy,
+             destination => \$dest,
+-            stderr      => \$stderr,
++            stderr      => $handle,
+             defined $self->{_perltidyrc} ? (perltidyrc => $self->{_perltidyrc}) : (),
+        );
+        1;
diff --git a/perl-Perl-Critic.spec b/perl-Perl-Critic.spec
index d87db68..9f054b0 100644
--- a/perl-Perl-Critic.spec
+++ b/perl-Perl-Critic.spec
@@ -1,11 +1,12 @@
 Name:		perl-Perl-Critic
 Version:	1.117
-Release:	7%{?dist}
+Release:	8%{?dist}
 Summary:	Critique Perl source code for best-practices
 Group:		Development/Libraries
 License:	GPL+ or Artistic
 URL:		http://search.cpan.org/dist/Perl-Critic/
 Source0:	http://search.cpan.org/CPAN/authors/id/T/TH/THALJEF/Perl-Critic-%{version}.tar.gz
+Patch2:		Perl-Critic-1.117-tidy.patch
 BuildArch:	noarch
 
 # Build process
@@ -116,8 +117,12 @@ of Perl code were mixed directly in the test script. That sucked.
 
 %prep
 %setup -q -n Perl-Critic-%{version}
+
+# Fix breakage with Perl::Tidy ≥ 20120619 (CPAN RT#77977)
+%patch2
+
+# Drop Test::Kwalitee tests in RHEL ≥ 7
 %if 0%{?rhel} >= 7
-# Drop Test::Kwalitee tests in RHEL >= 7
 rm xt/author/95_kwalitee.t
 sed -i -e '/^xt\/author\/95_kwalitee.t$/ d' MANIFEST
 %endif
@@ -148,6 +153,9 @@ LC_ALL=en_US ./Build %{!?perl_bootstrap:author}test
 %{_mandir}/man3/Test::Perl::Critic::Policy.3pm*
 
 %changelog
+* Tue Jul 10 2012 Paul Howarth <paul at city-fan.org> - 1.117-8
+- fix breakage with Perl::Tidy ≥ 20120619 (CPAN RT#77977)
+
 * Tue Jul 10 2012 Petr Pisar <ppisar at redhat.com> - 1.117-7
 - Perl 5.16 re-rebuild of bootstrapped packages
 
@@ -158,7 +166,7 @@ LC_ALL=en_US ./Build %{!?perl_bootstrap:author}test
 - conditionalize aspell
 
 * Tue Apr 24 2012 Petr Pisar <ppisar at redhat.com> - 1.117-4
-- Do not use Test::Kwalitee on RHEL >= 7
+- do not use Test::Kwalitee on RHEL ≥ 7
 
 * Tue Feb 28 2012 Paul Howarth <paul at city-fan.org> - 1.117-3
 - spec clean-up


More information about the scm-commits mailing list