From e63579732fa9d34ecdd7eaa11aae2935427933a8 Mon Sep 17 00:00:00 2001
From: Jitka Plesnikova <jples...@redhat.com>
Date: Wed, 3 Jun 2015 15:25:32 +0200
Subject: Fixed bundled B::Utils to build with Perl 5.22


diff --git a/Module-Info-0.35-Rename-parent-if-native-B-OP-parent-exist.patch 
b/Module-Info-0.35-Rename-parent-if-native-B-OP-parent-exist.patch
new file mode 100644
index 0000000..6cac7bc
--- /dev/null
+++ b/Module-Info-0.35-Rename-parent-if-native-B-OP-parent-exist.patch
@@ -0,0 +1,78 @@
+diff -up Module-Info-0.35/lib/B/BUtils.pm.orig Module-Info-0.35/lib/B/BUtils.pm
+--- Module-Info-0.35/lib/B/BUtils.pm.orig      2015-05-07 14:06:49.010018343 
+0200
++++ Module-Info-0.35/lib/B/BUtils.pm   2015-05-07 15:12:50.820650940 +0200
+@@ -212,8 +212,17 @@ In the future, it may be possible to sea
+ C<next> pointers in place, but it'll take me a while to figure out how to do
+ that.
+ 
++Warning: Since 5.21.2 B comes with it's own version of B::OP::parent
++which returns either B::NULL or the real parent when ccflags contains
++-DPERL_OP_PARENT.
++In this case rather use $op->_parent.
++
+ =cut
+ 
++
++BEGIN {
++  unless ($] >= 5.021002 and exists &B::OP::parent) {
++    eval q[
+ sub B::OP::parent {
+     my $target = shift;
+     printf( "parent %s %s=(0x%07x)\n",
+@@ -254,6 +263,56 @@ sub B::OP::parent {
+    my $start = $target;
+    $result = $search->($start) and return $result while $start = $start->next;
+    return $search->($start);
++}];
++  } else {
++    eval q[
++sub B::OP::_parent {
++    my $target = shift;
++    printf( "parent %s %s=(0x%07x)\n",
++          B::class( $target),
++          $target->oldname,
++          $$target )
++      if $DEBUG;
++
++    die "I'm not sure how to do this yet. I'm sure there is a way. If you 
know, please email me."
++        if (!$target->seq);
++
++    my (%deadend, $search_kids);
++    $search_kids = sub {
++        my $node = shift || return undef;
++      
++      printf( "Searching from %s %s=(0x%07x)\n",
++              class($node)||'?',
++              $node->oldname,
++              $$node )
++          if $DEBUG;
++              
++        # Go up a level if we've got stuck, and search (for the same
++        # $target) from a higher vantage point.
++        return $search->($node->parent) if exists $deadend{$node};
++
++        # Test the immediate children
++        return $node if scalar grep {$_ == $target} $node->kids;
++
++        # Recurse
++        my $x;
++        defined($x = $search->($_)) and return $x for $node->kids;
++
++        # Not in this subtree.
++        $deadend{$node}++;
++        return undef;
++   };
++   my $result;
++   my $start = $target;
++   $result = $search->($start) and return $result while $start = $start->next;
++   return $search->($start);
++}];
++  }
++  if ($] >= 5.021002) {
++    eval q[
++sub B::NULL::kids { }
++    ];
++  }
+ }
+ 
+ =item C<< $op->previous >>
diff --git a/perl-Module-Info.spec b/perl-Module-Info.spec
index 6f965d6..86aa911 100644
--- a/perl-Module-Info.spec
+++ b/perl-Module-Info.spec
@@ -3,13 +3,16 @@
 
 Name:           perl-Module-Info
 Version:        0.35
-Release:        4%{?dist}
+Release:        5%{?dist}
 Summary:        Information about Perl modules
 License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/Module-Info/
 Source0:        
http://www.cpan.org/authors/id/M/MB/MBARBON/Module-Info-%{version}.tar.gz
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu)
+# Support native B::OP::parent with 5.21.2 -DPERL_OP_PARENT (CPAN RT#97105)
+# Inspired by B-Utils patches (CPAN RT#100251)
+Patch0:         
Module-Info-0.35-Rename-parent-if-native-B-OP-parent-exist.patch
 BuildArch:      noarch
 BuildRequires:  perl(Carp)
 BuildRequires:  perl(Class::Struct)
@@ -35,6 +38,9 @@ code.
 
 %prep
 %setup -q -n Module-Info-%{version}
+%if 0%(perl -e 'print $] >= 5.022')
+%patch0 -p1
+%endif
 
 # We don't really provide perl(B::Utils) [filter for rpm < 4.9]
 %if ! %{rpm49}
@@ -65,6 +71,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man3/*
 
 %changelog
+* Wed Jun 03 2015 Jitka Plesnikova <jples...@redhat.com> - 0.35-5
+- Fixed bundled B::Utils to build with Perl 5.22
+
 * Wed Aug 27 2014 Jitka Plesnikova <jples...@redhat.com> - 0.35-4
 - Perl 5.20 rebuild
 
-- 
cgit v0.10.2


        
http://pkgs.fedoraproject.org/cgit/perl-Module-Info.git/commit/?h=master&id=e63579732fa9d34ecdd7eaa11aae2935427933a8
--
Fedora Extras Perl SIG
http://www.fedoraproject.org/wiki/Extras/SIGs/Perl
perl-devel mailing list
perl-devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/perl-devel

Reply via email to