[packages/ruby-chunky_png] new, version 1.2.7

glen glen at pld-linux.org
Mon Dec 8 21:40:30 CET 2014


commit 9748f4d883f9d76d150e62fcf03246d1d3906718
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Mon Dec 8 22:38:08 2014 +0200

    new, version 1.2.7
    
    based on fedora package 225873c

 ruby-2.0.0.patch     | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 ruby-chunky_png.spec | 70 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 153 insertions(+)
---
diff --git a/ruby-chunky_png.spec b/ruby-chunky_png.spec
new file mode 100644
index 0000000..5596286
--- /dev/null
+++ b/ruby-chunky_png.spec
@@ -0,0 +1,70 @@
+#
+# Conditional build:
+%bcond_without	tests		# build without tests
+%bcond_without	doc			# don't build ri/rdoc
+
+%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:	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
+BuildRequires:	rpm-rubyprov
+BuildRequires:	rpmbuild(macros) >= 1.665
+BuildRequires:	sed >= 4.0
+%if %{with tests}
+BuildRequires:	ruby-rspec
+%endif
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This pure Ruby library can read and write PNG images without depending
+on an external image library, like RMagick. It tries to be memory
+efficient and reasonably fast.
+
+It supports reading and writing all PNG variants that are defined in
+the specification, with one limitation: only 8-bit color depth is
+supported. It supports all transparency, interlacing and filtering
+options the PNG specifications allows. It can also read and write
+textual metadata from PNG files. Low-level read/write access to PNG
+chunks is also possible. This library supports simple drawing on the
+image canvas and simple operations like alpha composition and
+cropping. Finally, it can import from and export to RMagick for
+interoperability.
+
+%prep
+%setup -q -n %{pkgname}-%{version}
+%patch0 -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
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{ruby_vendorlibdir},%{ruby_specdir}}
+cp -a lib/* $RPM_BUILD_ROOT%{ruby_vendorlibdir}
+cp -p %{pkgname}-%{version}.gemspec $RPM_BUILD_ROOT%{ruby_specdir}
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README.rdoc LICENSE BENCHMARKS.rdoc benchmarks
+%{ruby_vendorlibdir}/chunky_png.rb
+%{ruby_vendorlibdir}/chunky_png
+%{ruby_specdir}/%{pkgname}-%{version}.gemspec
diff --git a/ruby-2.0.0.patch b/ruby-2.0.0.patch
new file mode 100644
index 0000000..c8f5f76
--- /dev/null
+++ b/ruby-2.0.0.patch
@@ -0,0 +1,83 @@
+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/9748f4d883f9d76d150e62fcf03246d1d3906718



More information about the pld-cvs-commit mailing list