Fix "use parent q{Encode::Encoding}"

This commit is contained in:
Petr Písař 2017-06-22 13:48:55 +02:00
parent c631c8f381
commit 5d99cdd393
2 changed files with 61 additions and 1 deletions

View File

@ -0,0 +1,54 @@
From 82aef7a207f7cccf21026a766968515e53fc1a18 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 22 Jun 2017 13:45:29 +0200
Subject: [PATCH] Fix importing from Encode::Encoding
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Ported to 2.90:
commit 208d094b8cf82da488495400ea9a518841fd007a
Author: Dan Kogai <dankogai+github@gmail.com>
Date: Thu Jun 22 17:05:01 2017 +0900
Addressed: https://rt.cpan.org/Ticket/Display.html?id=122167
commit a2f702b28b5d93a96b83aff283575b5b155b50ac
Author: Dan Kogai <dankogai+github@gmail.com>
Date: Thu Jun 22 18:13:47 2017 +0900
Stop directory tweaking $Encode::Encoding{utf8}
CPAN RT#122167
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Encode.pm | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/Encode.pm b/Encode.pm
index b0e9092..8813715 100644
--- a/Encode.pm
+++ b/Encode.pm
@@ -343,9 +343,14 @@ if ($ON_EBCDIC) {
{
package Encode::utf8;
use parent 'Encode::Encoding';
- __PACKAGE__->Define('utf8');
- my $strict_obj = bless { Name => "utf-8-strict", strict_utf8 => 1 } => "Encode::utf8";
- Encode::define_encoding($strict_obj, 'utf-8-strict');
+ my %obj = (
+ 'utf8' => { Name => 'utf8' },
+ 'utf-8-strict' => { Name => 'utf-8-strict', strict_utf8 => 1 }
+ );
+ for ( keys %obj ) {
+ bless $obj{$_} => __PACKAGE__;
+ Encode::define_encoding( $obj{$_} => $_ );
+ }
sub cat_decode {
# ($obj, $dst, $src, $pos, $trm, $chk)
# currently ignores $chk
--
2.9.4

View File

@ -8,7 +8,7 @@ Version: %{cpan_version}
# perl-encoding sub-package has independent version which does not change
# often and consecutive builds would clash on perl-encoding NEVRA. This is the
# same case as in perl.spec.
Release: 9%{?dist}
Release: 10%{?dist}
Summary: Character encodings in Perl
# ucm: UCD
# bin/encguess: Artistic 2.0
@ -16,6 +16,8 @@ Summary: Character encodings in Perl
License: (GPL+ or Artistic) and Artistic 2.0 and UCD
URL: http://search.cpan.org/dist/Encode/
Source0: http://www.cpan.org/authors/id/D/DA/DANKOGAI/Encode-%{cpan_version}.tar.gz
# Fix "use parent q{Encode::Encoding}", CPAN RT#122167, in upstream after 2.90
Patch0: Encode-2.90-Fix-importing-from-Encode-Encoding.patch
BuildRequires: findutils
BuildRequires: gcc
BuildRequires: make
@ -125,6 +127,7 @@ your own encoding to perl. No knowledge of XS is necessary.
%prep
%setup -q -n Encode-%{cpan_version}
%patch0 -p1
%build
# Additional scripts can be installed by appending MORE_SCRIPTS, UCM files by
@ -165,6 +168,9 @@ make test
%{perl_vendorarch}/Encode/encode.h
%changelog
* Thu Jun 22 2017 Petr Pisar <ppisar@redhat.com> - 4:2.90-10
- Fix "use parent q{Encode::Encoding}" (CPAN RT#122167)
* Mon Jun 12 2017 Petr Pisar <ppisar@redhat.com> - 4:2.90-9
- 2.90 bump