[slic3r] Added some Perl 5.18 compatibility patches for F20+

Miro Hrončok churchyard at fedoraproject.org
Fri Oct 18 16:46:35 UTC 2013


commit d3fc7e9f5ea5e91e9fea3d0d8fbb262c27aa3c29
Author: Miro Hrončok <miro at hroncok.cz>
Date:   Fri Oct 18 18:45:59 2013 +0200

    Added some Perl 5.18 compatibility patches for F20+

 slic3r-perl518.patch |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++
 slic3r.spec          |    7 +++++
 2 files changed, 79 insertions(+), 0 deletions(-)
---
diff --git a/slic3r-perl518.patch b/slic3r-perl518.patch
new file mode 100644
index 0000000..3177849
--- /dev/null
+++ b/slic3r-perl518.patch
@@ -0,0 +1,72 @@
+From 43814e99f6c8bfc1a2d8cc0eae4a44d01a08b2af Mon Sep 17 00:00:00 2001
+From: Alessandro Ranellucci <aar at cpan.org>
+Date: Thu, 6 Jun 2013 10:46:58 +0200
+Subject: [PATCH] Remove smart match and lexical $_ for compatibility with perl
+ 5.18. #1216
+
+---
+ lib/Slic3r/Config.pm     | 4 ++--
+ lib/Slic3r/Format/OBJ.pm | 2 +-
+ lib/Slic3r/Format/STL.pm | 4 ++--
+ 3 files changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/lib/Slic3r/Config.pm b/lib/Slic3r/Config.pm
+index 22edd0f..8b9fb1c 100644
+--- a/lib/Slic3r/Config.pm
++++ b/lib/Slic3r/Config.pm
+@@ -1141,7 +1141,7 @@ sub set {
+     my ($opt_key, $value, $deserialize) = @_;
+     
+     # handle legacy options
+-    return if $opt_key ~~ @Ignore;
++    return if first { $_ eq $opt_key } @Ignore;
+     if ($opt_key =~ /^(extrusion_width|bottom_layer_speed|first_layer_height)_ratio$/) {
+         $opt_key = $1;
+         $opt_key =~ s/^bottom_layer_speed$/first_layer_speed/;
+@@ -1413,7 +1413,7 @@ sub read_ini {
+     
+     my $ini = { _ => {} };
+     my $category = '_';
+-    while (my $_ = <$fh>) {
++    while (<$fh>) {
+         s/\R+$//;
+         next if /^\s+/;
+         next if /^$/;
+diff --git a/lib/Slic3r/Format/OBJ.pm b/lib/Slic3r/Format/OBJ.pm
+index c5cc085..05a141d 100644
+--- a/lib/Slic3r/Format/OBJ.pm
++++ b/lib/Slic3r/Format/OBJ.pm
+@@ -8,7 +8,7 @@ sub read_file {
+     Slic3r::open(\my $fh, '<', $file) or die "Failed to open $file\n";
+     my $vertices = [];
+     my $facets = [];
+-    while (my $_ = <$fh>) {
++    while (<$fh>) {
+         if (/^v ([^ ]+)\s+([^ ]+)\s+([^ ]+)/) {
+             push @$vertices, [$1, $2, $3];
+         } elsif (/^f (\d+).*? (\d+).*? (\d+).*?/) {
+diff --git a/lib/Slic3r/Format/STL.pm b/lib/Slic3r/Format/STL.pm
+index 0d0331c..cf07b1c 100644
+--- a/lib/Slic3r/Format/STL.pm
++++ b/lib/Slic3r/Format/STL.pm
+@@ -53,7 +53,7 @@ sub _read_ascii {
+     my $facet;
+     my %vertices_map = ();
+     seek $fh, 0, 0;
+-    while (my $_ = <$fh>) {
++    while (<$fh>) {
+         if (!$facet) {
+             /^\s*facet\s+normal\s+/ or next;
+             $facet = [];  # ignore normal
+@@ -88,7 +88,7 @@ sub _read_binary {
+     my %vertices_map = ();
+     binmode $fh;
+     seek $fh, 80 + 4, 0;
+-    while (read $fh, my $_, 4*4*3+2) {
++    while (read $fh, $_, 4*4*3+2) {
+         push @$facets, my $facet = [];
+         for (unpack 'x[f3](a[f3])3') {  # ignore normal
+             my $vertex_idx;
+-- 
+1.8.4
+
diff --git a/slic3r.spec b/slic3r.spec
index 4b3d811..6f4ca55 100644
--- a/slic3r.spec
+++ b/slic3r.spec
@@ -20,6 +20,9 @@ Patch1:         %{name}-english-locale.patch
 # Fix crash when loading a config file
 Patch2:         %{name}-load-config-fix.patch
 
+# Perl 5.18 compatibility
+Patch2:         %{name}-perl518.patch
+
 Source1:        %{name}.desktop
 BuildArch:      noarch
 BuildRequires:  perl(Boost::Geometry::Utils) >= 0.12
@@ -67,6 +70,9 @@ for more information.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%if 0%{?fedora} > 19
+%patch3 -p1
+%endif
 
 %build
 SLIC3R_NO_AUTO=1 perl Build.PL installdirs=vendor optimize="$RPM_OPT_FLAGS"
@@ -101,6 +107,7 @@ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE1}
 %changelog
 * Fri Oct 18 2013 Miro Hrončok <mhroncok at redhat.com> - 0.9.10b-5
 - For F20+, require Moo >= 1.003001
+- Added some Perl 5.18 compatibility patches for F20+
 
 * Fri Oct 18 2013 Miro Hrončok <mhroncok at redhat.com> - 0.9.10b-4
 - Remove all filtering from provides, it is not needed anymore


More information about the scm-commits mailing list