[packages/ruby-chunky_png] Up to 1.4.0
arekm
arekm at pld-linux.org
Wed Mar 18 16:07:36 CET 2026
commit b4e7e74ee42adbdd9545706713d9f01d2c4696f5
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Wed Mar 18 16:07:16 2026 +0100
Up to 1.4.0
chunky_png-bundler.patch | 11 +++++++
chunky_png-vector.patch | 26 +++++++++++++++
ruby-2.0.0.patch | 83 ------------------------------------------------
ruby-chunky_png.spec | 19 ++++++-----
4 files changed, 46 insertions(+), 93 deletions(-)
---
diff --git a/ruby-chunky_png.spec b/ruby-chunky_png.spec
index 1731199..54b4b9f 100644
--- a/ruby-chunky_png.spec
+++ b/ruby-chunky_png.spec
@@ -6,14 +6,15 @@
%define pkgname chunky_png
Summary: Pure ruby library for read/write, chunk-level access to PNG files
Name: ruby-%{pkgname}
-Version: 1.2.7
-Release: 2
+Version: 1.4.0
+Release: 1
License: MIT
Group: Development/Languages
-Source0: http://rubygems.org/gems/%{pkgname}-%{version}.gem
-# Source0-md5: 3b872b1054bd3f586413d9169237432f
-Patch0: ruby-2.0.0.patch
-URL: http://wiki.github.com/wvanbergen/chunky_png
+Source0: https://rubygems.org/gems/%{pkgname}-%{version}.gem
+# Source0-md5: 23208f5527c2950aaf9c0090e89c1481
+Patch0: chunky_png-bundler.patch
+Patch1: chunky_png-vector.patch
+URL: https://github.com/wvanbergen/chunky_png/wiki
BuildRequires: rpm-rubyprov
BuildRequires: rpmbuild(macros) >= 1.665
BuildRequires: sed >= 4.0
@@ -41,15 +42,13 @@ interoperability.
%prep
%setup -q -n %{pkgname}-%{version}
%patch -P0 -p1
+%patch -P1 -p1
%build
# write .gemspec
%__gem_helper spec
%if %{with tests}
-# Don't use Bundler.
-sed -i "/require 'bundler\/setup'/ s/^/#/" spec/spec_helper.rb
-
rspec spec
%endif
@@ -64,7 +63,7 @@ rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc README.rdoc LICENSE BENCHMARKS.rdoc benchmarks
+%doc README.md LICENSE BENCHMARKING.rdoc CONTRIBUTING.rdoc CHANGELOG.rdoc benchmarks
%{ruby_vendorlibdir}/chunky_png.rb
%{ruby_vendorlibdir}/chunky_png
%{ruby_specdir}/%{pkgname}-%{version}.gemspec
diff --git a/chunky_png-bundler.patch b/chunky_png-bundler.patch
new file mode 100644
index 0000000..76e4863
--- /dev/null
+++ b/chunky_png-bundler.patch
@@ -0,0 +1,11 @@
+Comment out Bundler setup in the spec helper so the test suite does not
+require the development-only Gemfile dependencies during packaging.
+
+diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
+--- a/spec/spec_helper.rb
++++ b/spec/spec_helper.rb
+@@ -1,4 +1,4 @@
+ require "rubygems"
+-require "bundler/setup"
++# require "bundler/setup"
+ require "chunky_png"
diff --git a/chunky_png-vector.patch b/chunky_png-vector.patch
new file mode 100644
index 0000000..6b62711
--- /dev/null
+++ b/chunky_png-vector.patch
@@ -0,0 +1,26 @@
+Fix the Vector parser for Ruby 3.4.
+
+The upstream code assumes the first element of an array input is either a
+Numeric or a String. When the parser is handed nested point arrays, the first
+element is itself an Array, so the old regexp check raised NoMethodError on
+Ruby 3.4. This keeps the original behavior for numeric strings and leaves
+point arrays on the existing fallback path.
+
+diff --git a/lib/chunky_png/vector.rb b/lib/chunky_png/vector.rb
+--- a/lib/chunky_png/vector.rb
++++ b/lib/chunky_png/vector.rb
+@@ -166,13 +166,13 @@
+ # @return [Array<ChunkyPNG::Point>] The list of points interpreted from the input array.
+ def self.multiple_from_array(source)
+ return [] if source.empty?
+- if source.first.is_a?(Numeric) || source.first =~ /^\d+$/
++ if source.first.is_a?(Numeric) || (source.first.is_a?(String) && source.first =~ /^\d+$/)
+ raise ArgumentError, "The points array is expected to have an even number of items!" if source.length % 2 != 0
+
+ points = []
+ source.each_slice(2) { |x, y| points << ChunkyPNG::Point.new(x, y) }
+ return points
+ else
+ source.map { |p| ChunkyPNG::Point(p) }
+ end
+ end
diff --git a/ruby-2.0.0.patch b/ruby-2.0.0.patch
deleted file mode 100644
index c8f5f76..0000000
--- a/ruby-2.0.0.patch
+++ /dev/null
@@ -1,83 +0,0 @@
-From 9f71cd26504242e204b7fa062121d160f0d14e20 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <v.ondruch at tiscali.cz>
-Date: Thu, 14 Mar 2013 10:14:40 +0100
-Subject: [PATCH] Fix Ruby 2.0.0 compatibility
-
-In Ruby 2.0.0, the default encoding of source files was changed to UTF-8 and now, there are test suite errors such as:
-
- Failure/Error: stream.should == "\0\x20\0\xD0"
- ArgumentError:
- invalid byte sequence in UTF-8
-
-Since the stream is obviously binary, it should be compared to binary data, hence use the #force_encoding("BINARY") to explicitly set the encoding of compared string.
----
- spec/chunky_png/canvas/png_encoding_spec.rb | 18 +++++++++---------
- 1 file changed, 9 insertions(+), 9 deletions(-)
-
-diff --git a/spec/chunky_png/canvas/png_encoding_spec.rb b/spec/chunky_png/canvas/png_encoding_spec.rb
-index 54ffdf7..44f2123 100644
---- a/spec/chunky_png/canvas/png_encoding_spec.rb
-+++ b/spec/chunky_png/canvas/png_encoding_spec.rb
-@@ -122,32 +122,32 @@
-
- it "should encode using 8-bit RGBA mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_TRUECOLOR_ALPHA, 8, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x01\x02\x03\x04\xFC\xFD\xFE\xFF\0\xFF\xFE\xFD\xFC\x04\x03\x02\x01"
-+ stream.should == "\0\x01\x02\x03\x04\xFC\xFD\xFE\xFF\0\xFF\xFE\xFD\xFC\x04\x03\x02\x01".force_encoding("BINARY")
- end
-
- it "should encode using 8 bit RGB mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_TRUECOLOR, 8, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x01\x02\x03\xFC\xFD\xFE\0\xFF\xFE\xFD\x04\x03\x02"
-+ stream.should == "\0\x01\x02\x03\xFC\xFD\xFE\0\xFF\xFE\xFD\x04\x03\x02".force_encoding("BINARY")
- end
-
- it "should encode using 1-bit grayscale mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_GRAYSCALE, 1, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x40\0\x80" # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
-+ stream.should == "\0\x40\0\x80".force_encoding("BINARY") # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
- end
-
- it "should encode using 2-bit grayscale mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_GRAYSCALE, 2, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x30\0\xC0" # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
-+ stream.should == "\0\x30\0\xC0".force_encoding("BINARY") # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
- end
-
- it "should encode using 4-bit grayscale mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_GRAYSCALE, 4, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x0F\0\xF0" # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
-+ stream.should == "\0\x0F\0\xF0".force_encoding("BINARY") # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
- end
-
- it "should encode using 8-bit grayscale mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_GRAYSCALE, 8, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x03\xFE\0\xFD\x02" # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
-+ stream.should == "\0\x03\xFE\0\xFD\x02".force_encoding("BINARY") # Using the B byte of the pixel == 3, assuming R == G == B for grayscale images
- end
-
- it "should not encode using 1-bit indexed mode because the image has too many colors" do
-@@ -158,17 +158,17 @@
-
- it "should encode using 2-bit indexed mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_INDEXED, 2, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x20\0\xD0"
-+ stream.should == "\0\x20\0\xD0".force_encoding("BINARY")
- end
-
- it "should encode using 4-bit indexed mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_INDEXED, 4, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x02\0\x31"
-+ stream.should == "\0\x02\0\x31".force_encoding("BINARY")
- end
-
- it "should encode using 8-bit indexed mode correctly" do
- stream = @canvas.encode_png_pixelstream(ChunkyPNG::COLOR_INDEXED, 8, ChunkyPNG::INTERLACING_NONE, ChunkyPNG::FILTER_NONE)
-- stream.should == "\0\x00\x02\0\x03\x01"
-+ stream.should == "\0\x00\x02\0\x03\x01".force_encoding("BINARY")
- end
- end
-
---
-1.7.10
-
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/ruby-chunky_png.git/commitdiff/b4e7e74ee42adbdd9545706713d9f01d2c4696f5
More information about the pld-cvs-commit
mailing list