8
0

Accepting request 1102971 from devel:languages:perl

- Add 0001-Adjust-require-exception-to-perl-5.37.8-wording.patch:
  Fix build using Perl 5.38.

OBS-URL: https://build.opensuse.org/request/show/1102971
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/perl-Module-Reader?expand=0&rev=6
This commit is contained in:
2023-08-08 15:43:26 +00:00
committed by Git OBS Bridge
4 changed files with 108 additions and 13 deletions

View File

@@ -0,0 +1,90 @@
From 4a20f97741b04d609ab4265fc8c6c1bdfc620daa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 4 Aug 2023 16:58:23 +0200
Subject: [PATCH] Adjust require exception to perl 5.37.8 wording
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
With perl 5.38.0 t/memmory test fails on Regexp objects:
not ok 9 - regex fails the same as require
# Failed test 'regex fails the same as require'
# at t/memory.t line 99.
# got: 'Can't locate object method "INC" via package "Regexp"'
# expected: 'Can't locate object method "INC", nor "INCDIR" nor string overload via package "Regexp" in object hook in @INC'
not ok 10 - class without INC fails the same as require
# Failed test 'class without INC fails the same as require'
# at t/memory.t line 99.
# got: 'Can't locate object method "INC" via package "NonHook"'
# expected: 'Can't locate object method "INC", nor "INCDIR" nor string overload via package "NonHook" in object hook in @INC'
This is probably caused by this perl commit which also changed the exception
text:
commit 0d370d41c6e8fe1e36eb93a5561e6716ee3a7e3e
Author: Yves Orton <demerphq@gmail.com>
Date: Sun Dec 18 18:48:51 2022 +0100
pp_ctl.c - Check if refs have overloads in @INC
If an object in @INC doesnt have a hook method, and it isnt a CODE ref
then check if it has string overloading, if it does not then die with a
helpful message, otherwise call the overload
This uses the nice new amagic_find() function.
This patch adjustes Module::Reader::_open_ref() to emit a similar
exception text. Though it does implement the missing features like
handling INCDIR method or string overloading.
With the new perl it's impossible to get the same exception text in
a different way than by calling "require" function. Therefore
in the long term, I recommend stop insisting on error-to-error parity
and relaxing the tests instead.
CPAN RT#148979
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/Module/Reader.pm | 24 +++++++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
diff --git a/lib/Module/Reader.pm b/lib/Module/Reader.pm
index cbab239..976d4ad 100644
--- a/lib/Module/Reader.pm
+++ b/lib/Module/Reader.pm
@@ -218,9 +218,27 @@ sub _open_ref {
main;
no strict 'refs';
no warnings 'uninitialized';
- @cb = defined Scalar::Util::blessed $inc ? $inc->INC($file)
- : ref $inc eq 'ARRAY' ? $inc->[0]->($inc, $file)
- : $inc->($inc, $file);
+ if (defined(Scalar::Util::blessed $inc)) {
+ if ($^V < v5.37.8) {
+ @cb = $inc->INC($file);
+ } else {
+ if ($inc->can('INC')) {
+ @cb = $inc->INC($file);
+ }
+ # TODO: Handle INCDIR method
+ # TODO: Handle string overloading
+ else {
+ die "Can't locate object method \"INC\", nor" .
+ " \"INCDIR\" nor string overload via" .
+ " package \"" . ref($inc) . "\" in object hook" .
+ " in \@INC";
+ }
+ }
+ } elsif (ref $inc eq 'ARRAY') {
+ @cb = $inc->[0]->($inc, $file);
+ } else {
+ @cb = $inc->($inc, $file);
+ }
}
return
--
2.41.0

View File

@@ -7,7 +7,8 @@
#sources: #sources:
# - source1 # - source1
# - source2 # - source2
#patches: patches:
0001-Adjust-require-exception-to-perl-5.37.8-wording.patch: -p1
# foo.patch: -p1 # foo.patch: -p1
# bar.patch: # bar.patch:
#preamble: |- #preamble: |-

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Aug 8 15:07:21 UTC 2023 - Dominique Leuenberger <dimstar@opensuse.org>
- Add 0001-Adjust-require-exception-to-perl-5.37.8-wording.patch:
Fix build using Perl 5.38.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jun 22 05:53:38 UTC 2017 - coolo@suse.com Thu Jun 22 05:53:38 UTC 2017 - coolo@suse.com

View File

@@ -1,7 +1,7 @@
# #
# spec file for package perl-Module-Reader # spec file for package perl-Module-Reader
# #
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2023 SUSE LLC
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@@ -12,22 +12,21 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
%define cpan_name Module-Reader
Name: perl-Module-Reader Name: perl-Module-Reader
Version: 0.003003 Version: 0.003003
Release: 0 Release: 0
%define cpan_name Module-Reader License: Artistic-1.0 OR GPL-1.0-or-later
Summary: Find and read perl modules like perl does Summary: Find and read perl modules like perl does
License: Artistic-1.0 or GPL-1.0+ URL: https://metacpan.org/release/%{cpan_name}
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Module-Reader/
Source0: https://cpan.metacpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz Source0: https://cpan.metacpan.org/authors/id/H/HA/HAARG/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml Source1: cpanspec.yml
Patch0: 0001-Adjust-require-exception-to-perl-5.37.8-wording.patch
BuildArch: noarch BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: perl BuildRequires: perl
BuildRequires: perl-macros BuildRequires: perl-macros
BuildRequires: perl(Test::More) >= 0.88 BuildRequires: perl(Test::More) >= 0.88
@@ -41,14 +40,14 @@ on the same internal rules that perl uses for _require|perlfunc/require_
and _do|perlfunc/do_. and _do|perlfunc/do_.
%prep %prep
%setup -q -n %{cpan_name}-%{version} %autosetup -n %{cpan_name}-%{version} -p1
%build %build
%{__perl} Makefile.PL INSTALLDIRS=vendor perl Makefile.PL INSTALLDIRS=vendor
%{__make} %{?_smp_mflags} %make_build
%check %check
%{__make} test make test
%install %install
%perl_make_install %perl_make_install
@@ -56,7 +55,6 @@ and _do|perlfunc/do_.
%perl_gen_filelist %perl_gen_filelist
%files -f %{name}.files %files -f %{name}.files
%defattr(-,root,root,755)
%doc Changes README %doc Changes README
%changelog %changelog