basebuilder_pel7x64builder0
6 years ago
2 changed files with 193 additions and 0 deletions
@ -0,0 +1,110 @@ |
|||||||
|
From 28c286718f7d2c46b9ff310bb4178b7f2258bb25 Mon Sep 17 00:00:00 2001 |
||||||
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com> |
||||||
|
Date: Wed, 20 Nov 2013 12:49:57 +0100 |
||||||
|
Subject: [PATCH] EU::ParseXS: Attempt to canonicalize C++ types in tidy_type |
||||||
|
MIME-Version: 1.0 |
||||||
|
Content-Type: text/plain; charset=UTF-8 |
||||||
|
Content-Transfer-Encoding: 8bit |
||||||
|
|
||||||
|
This is a 3.18 port of perl commit: |
||||||
|
|
||||||
|
Author: Steffen Mueller <smueller@cpan.org> |
||||||
|
Date: Wed May 22 21:49:06 2013 +0200 |
||||||
|
|
||||||
|
EU::ParseXS: Attempt to canonicalize C++ types in tidy_type |
||||||
|
|
||||||
|
Includes moving tidy_type to ExtUtils::Typemaps where it seems to |
||||||
|
belong. It's a pretty poor canonicalizer, but better than nothing! |
||||||
|
|
||||||
|
<https://rt.cpan.org/Public/Bug/Display.html?id=86367> |
||||||
|
<https://bugzilla.redhat.com/show_bug.cgi?id=1032181> |
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com> |
||||||
|
--- |
||||||
|
lib/ExtUtils/ParseXS/Utilities.pm | 7 +++++++ |
||||||
|
lib/ExtUtils/Typemaps.pm | 7 +++++++ |
||||||
|
t/103-tidy_type.t | 27 +++++++++++++++------------ |
||||||
|
3 files changed, 29 insertions(+), 12 deletions(-) |
||||||
|
|
||||||
|
diff --git a/lib/ExtUtils/ParseXS/Utilities.pm b/lib/ExtUtils/ParseXS/Utilities.pm |
||||||
|
index d0089f8..f64af35 100644 |
||||||
|
--- a/lib/ExtUtils/ParseXS/Utilities.pm |
||||||
|
+++ b/lib/ExtUtils/ParseXS/Utilities.pm |
||||||
|
@@ -201,6 +201,13 @@ String cleaned up. |
||||||
|
sub tidy_type { |
||||||
|
local ($_) = @_; |
||||||
|
|
||||||
|
+ # for templated C++ types, do some bit of flawed canonicalization |
||||||
|
+ # wrt. templates at least |
||||||
|
+ if (/[<>]/) { |
||||||
|
+ s/\s*([<>])\s*/$1/g; |
||||||
|
+ s/>>/> >/g; |
||||||
|
+ } |
||||||
|
+ |
||||||
|
# rationalise any '*' by joining them into bunches and removing whitespace |
||||||
|
s#\s*(\*+)\s*#$1#g; |
||||||
|
s#(\*+)# $1 #g; |
||||||
|
diff --git a/lib/ExtUtils/Typemaps.pm b/lib/ExtUtils/Typemaps.pm |
||||||
|
index 2768ef0..fc4e413 100644 |
||||||
|
--- a/lib/ExtUtils/Typemaps.pm |
||||||
|
+++ b/lib/ExtUtils/Typemaps.pm |
||||||
|
@@ -973,6 +973,13 @@ sub _parse { |
||||||
|
sub _tidy_type { |
||||||
|
local $_ = shift; |
||||||
|
|
||||||
|
+ # for templated C++ types, do some bit of flawed canonicalization |
||||||
|
+ # wrt. templates at least |
||||||
|
+ if (/[<>]/) { |
||||||
|
+ s/\s*([<>])\s*/$1/g; |
||||||
|
+ s/>>/> >/g; |
||||||
|
+ } |
||||||
|
+ |
||||||
|
# rationalise any '*' by joining them into bunches and removing whitespace |
||||||
|
s#\s*(\*+)\s*#$1#g; |
||||||
|
s#(\*+)# $1 #g ; |
||||||
|
diff --git a/t/103-tidy_type.t b/t/103-tidy_type.t |
||||||
|
index a043383..fb44aa9 100644 |
||||||
|
--- a/t/103-tidy_type.t |
||||||
|
+++ b/t/103-tidy_type.t |
||||||
|
@@ -1,23 +1,26 @@ |
||||||
|
#!/usr/bin/perl |
||||||
|
use strict; |
||||||
|
use warnings; |
||||||
|
-use Test::More tests => 3; |
||||||
|
+use Test::More; |
||||||
|
use lib qw( lib ); |
||||||
|
use ExtUtils::ParseXS::Utilities qw( |
||||||
|
tidy_type |
||||||
|
); |
||||||
|
|
||||||
|
-my $input; |
||||||
|
- |
||||||
|
-$input = ' * ** '; |
||||||
|
-is( tidy_type($input), '***', |
||||||
|
- "Got expected value for '$input'" ); |
||||||
|
+my @tests = ( |
||||||
|
+ [' * ** ', '***'], |
||||||
|
+ [' * ** ', '***'], |
||||||
|
+ [' * ** foobar * ', '*** foobar *'], |
||||||
|
+ ['unsigned int', 'unsigned int'], |
||||||
|
+ ['std::vector<int>', 'std::vector<int>'], |
||||||
|
+ ['std::vector< unsigned int >', 'std::vector<unsigned int>'], |
||||||
|
+ ['std::vector< vector<unsigned int> >', 'std::vector<vector<unsigned int> >'], |
||||||
|
+ ['std::map< map <unsigned int, int>, int>', 'std::map<map<unsigned int, int>, int>'], |
||||||
|
+); |
||||||
|
|
||||||
|
-$input = ' * ** '; |
||||||
|
-is( tidy_type($input), '***', |
||||||
|
- "Got expected value for '$input'" ); |
||||||
|
+plan tests => scalar(@tests); |
||||||
|
|
||||||
|
-$input = ' * ** foobar * '; |
||||||
|
-is( tidy_type($input), '*** foobar *', |
||||||
|
- "Got expected value for '$input'" ); |
||||||
|
+foreach my $test (@tests) { |
||||||
|
+ is(tidy_type($test->[0]), $test->[1], "Tidying '$test->[0]'"); |
||||||
|
+} |
||||||
|
|
||||||
|
-- |
||||||
|
1.8.3.1 |
||||||
|
|
@ -0,0 +1,83 @@ |
|||||||
|
Name: perl-ExtUtils-ParseXS |
||||||
|
# Epoch to compete with perl.spec |
||||||
|
Epoch: 1 |
||||||
|
Version: 3.18 |
||||||
|
Release: 3%{?dist} |
||||||
|
Summary: Module and a script for converting Perl XS code into C code |
||||||
|
License: GPL+ or Artistic |
||||||
|
Group: Development/Libraries |
||||||
|
URL: http://search.cpan.org/dist/ExtUtils-ParseXS/ |
||||||
|
Source0: http://www.cpan.org/authors/id/S/SM/SMUELLER/ExtUtils-ParseXS-%{version}.tar.gz |
||||||
|
# Improve compatibility with C++, CPAN RT#86367, bug #1078438, |
||||||
|
# in upstream 3.18_03 |
||||||
|
Patch0: ExtUtils-ParseXS-3.18-EU-ParseXS-Attempt-to-canonicalize-C-types-in-tidy_t.patch |
||||||
|
BuildArch: noarch |
||||||
|
BuildRequires: perl |
||||||
|
BuildRequires: perl(Config) |
||||||
|
BuildRequires: perl(ExtUtils::MakeMaker) >= 6.46 |
||||||
|
BuildRequires: perl(File::Spec) |
||||||
|
BuildRequires: perl(strict) |
||||||
|
BuildRequires: perl(warnings) |
||||||
|
# Run-time: |
||||||
|
BuildRequires: perl(Cwd) |
||||||
|
BuildRequires: perl(Exporter) |
||||||
|
# ExtUtils::XSSymSet not needed |
||||||
|
BuildRequires: perl(File::Basename) |
||||||
|
# Getopt::Long not tested |
||||||
|
BuildRequires: perl(lib) |
||||||
|
BuildRequires: perl(re) |
||||||
|
BuildRequires: perl(Symbol) |
||||||
|
# Tests: |
||||||
|
BuildRequires: perl-devel |
||||||
|
BuildRequires: perl(attributes) |
||||||
|
BuildRequires: perl(Carp) |
||||||
|
BuildRequires: perl(DynaLoader) |
||||||
|
BuildRequires: perl(ExtUtils::CBuilder) |
||||||
|
BuildRequires: perl(File::Temp) |
||||||
|
BuildRequires: perl(overload) |
||||||
|
BuildRequires: perl(Test::More) >= 0.47 |
||||||
|
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) |
||||||
|
Requires: perl-devel |
||||||
|
# perl-ExtUtils-Typemaps has been merged into perl-ExtUtils-ParseXS, bug #891952 |
||||||
|
Obsoletes: perl-ExtUtils-Typemaps |
||||||
|
|
||||||
|
%description |
||||||
|
ExtUtils::ParseXS will compile XS code into C code by embedding the |
||||||
|
constructs necessary to let C functions manipulate Perl values and creates |
||||||
|
the glue necessary to let Perl access those functions. |
||||||
|
|
||||||
|
%prep |
||||||
|
%setup -q -n ExtUtils-ParseXS-%{version} |
||||||
|
%patch0 -p1 |
||||||
|
|
||||||
|
%build |
||||||
|
perl Makefile.PL INSTALLDIRS=vendor |
||||||
|
make %{?_smp_mflags} |
||||||
|
|
||||||
|
%install |
||||||
|
make pure_install DESTDIR=$RPM_BUILD_ROOT |
||||||
|
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \; |
||||||
|
%{_fixperms} $RPM_BUILD_ROOT/* |
||||||
|
# Do not install xsubpp twice, RT#117289 |
||||||
|
rm $RPM_BUILD_ROOT%{perl_vendorlib}/ExtUtils/xsubpp |
||||||
|
ln -s ../../../../bin/xsubpp $RPM_BUILD_ROOT%{perl_vendorlib}/ExtUtils/ |
||||||
|
|
||||||
|
%check |
||||||
|
make test |
||||||
|
|
||||||
|
%files |
||||||
|
%doc Changes README |
||||||
|
%{_bindir}/* |
||||||
|
%{perl_vendorlib}/* |
||||||
|
%{_mandir}/man1/* |
||||||
|
%{_mandir}/man3/* |
||||||
|
|
||||||
|
%changelog |
||||||
|
* Thu Mar 20 2014 Petr Pisar <ppisar@redhat.com> - 1:3.18-3 |
||||||
|
- Improve compatibility with C++ (bug #1078438) |
||||||
|
|
||||||
|
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 1:3.18-2 |
||||||
|
- Mass rebuild 2013-12-27 |
||||||
|
|
||||||
|
* Fri Mar 22 2013 Petr Pisar <ppisar@redhat.com> 1:3.18-1 |
||||||
|
- Specfile autogenerated by cpanspec 1.78. |
Loading…
Reference in new issue