[rubygem-rack] Update to rack 1.4.0

Bohuslav Kabrda bkabrda at fedoraproject.org
Thu Jan 5 09:23:35 UTC 2012


commit 6361e4101714681e3a294585f543a05332b9ee50
Author: Bohuslav Kabrda <bkabrda at redhat.com>
Date:   Thu Jan 5 10:23:28 2012 +0100

    Update to rack 1.4.0

 .gitignore                                         |    1 +
 ...m-rack-test-object-which-responds-to-each.patch |   43 ++++++++++++++
 ...k-tests-now-accept-different-query-orders.patch |   62 ++++++++++++++++++++
 rubygem-rack.spec                                  |   29 +++++++--
 sources                                            |    2 +-
 5 files changed, 130 insertions(+), 7 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 3fb2b4e..99e8dd0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
 rack-1.1.0.gem
 /rack-1.3.0.gem
+/rack-1.4.0.gem
diff --git a/rubygem-rack-test-object-which-responds-to-each.patch b/rubygem-rack-test-object-which-responds-to-each.patch
new file mode 100644
index 0000000..f8d4bdf
--- /dev/null
+++ b/rubygem-rack-test-object-which-responds-to-each.patch
@@ -0,0 +1,43 @@
+From 17a3e1ea7be50094d09b6f5fbb4770b5468e8421 Mon Sep 17 00:00:00 2001
+From: HannesG <hag at informatik.uni-kiel.de>
+Date: Thu, 29 Dec 2011 19:23:32 +0100
+Subject: [PATCH] Test an object which repsonds to each instead of a set.
+
+---
+ test/spec_response.rb |    9 ++++++---
+ 1 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/test/spec_response.rb b/test/spec_response.rb
+index 07dd012..589063e 100644
+--- a/test/spec_response.rb
++++ b/test/spec_response.rb
+@@ -1,4 +1,3 @@
+-require 'set'
+ require 'rack/response'
+ require 'stringio'
+ 
+@@ -125,7 +124,6 @@ describe Rack::Response do
+     response = Rack::Response.new
+     response.redirect "/foo"
+     status, header, body = response.finish
+-
+     status.should.equal 302
+     header["Location"].should.equal "/foo"
+ 
+@@ -147,7 +145,12 @@ describe Rack::Response do
+     str = ""; body.each { |part| str << part }
+     str.should.equal "foobar"
+ 
+-    r = Rack::Response.new(["foo", "bar"].to_set)
++    object_with_each = Object.new
++    def object_with_each.each
++      yield "foo"
++      yield "bar"
++    end
++    r = Rack::Response.new(object_with_each)
+     r.write "foo"
+     status, header, body = r.finish
+     str = ""; body.each { |part| str << part }
+-- 
+1.7.7.5
+
diff --git a/rubygem-rack-tests-now-accept-different-query-orders.patch b/rubygem-rack-tests-now-accept-different-query-orders.patch
new file mode 100644
index 0000000..dec64d3
--- /dev/null
+++ b/rubygem-rack-tests-now-accept-different-query-orders.patch
@@ -0,0 +1,62 @@
+From c711cd421f3eacfde9965b4b38f41acc5754b5d0 Mon Sep 17 00:00:00 2001
+From: HannesG <hag at informatik.uni-kiel.de>
+Date: Thu, 29 Dec 2011 19:24:03 +0100
+Subject: [PATCH] Utils tests now accept different query orders.
+
+---
+ test/spec_utils.rb |   21 +++++++++++++++------
+ 1 files changed, 15 insertions(+), 6 deletions(-)
+
+diff --git a/test/spec_utils.rb b/test/spec_utils.rb
+index a787763..069e229 100644
+--- a/test/spec_utils.rb
++++ b/test/spec_utils.rb
+@@ -3,6 +3,15 @@ require 'rack/utils'
+ require 'rack/mock'
+ 
+ describe Rack::Utils do
++
++  # A helper method which checks
++  # if certain query parameters 
++  # are equal.
++  def equal_query_to(query)
++    parts = query.split('&')
++    lambda{|other| (parts & other.split('&')) == parts }
++  end
++
+   def kcodeu
+     one8 = RUBY_VERSION.to_f < 1.9
+     default_kcode, $KCODE = $KCODE, 'U' if one8
+@@ -187,13 +196,13 @@ describe Rack::Utils do
+   end
+ 
+   should "build query strings correctly" do
+-    Rack::Utils.build_query("foo" => "bar").should.equal "foo=bar"
++    Rack::Utils.build_query("foo" => "bar").should.be equal_query_to("foo=bar")
+     Rack::Utils.build_query("foo" => ["bar", "quux"]).
+-      should.equal "foo=bar&foo=quux"
++      should.be equal_query_to("foo=bar&foo=quux")
+     Rack::Utils.build_query("foo" => "1", "bar" => "2").
+-      should.equal "foo=1&bar=2"
++      should.be equal_query_to("foo=1&bar=2")
+     Rack::Utils.build_query("my weird field" => "q1!2\"'w$5&7/z8)?").
+-      should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
++      should.be equal_query_to("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F")
+   end
+ 
+   should "build nested query strings correctly" do
+@@ -202,9 +211,9 @@ describe Rack::Utils do
+     Rack::Utils.build_nested_query("foo" => "bar").should.equal "foo=bar"
+ 
+     Rack::Utils.build_nested_query("foo" => "1", "bar" => "2").
+-      should.equal "foo=1&bar=2"
++      should.be equal_query_to("foo=1&bar=2")
+     Rack::Utils.build_nested_query("my weird field" => "q1!2\"'w$5&7/z8)?").
+-      should.equal "my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F"
++      should.be equal_query_to("my+weird+field=q1%212%22%27w%245%267%2Fz8%29%3F")
+ 
+     Rack::Utils.build_nested_query("foo" => [nil]).
+       should.equal "foo[]"
+-- 
+1.7.7.5
+
diff --git a/rubygem-rack.spec b/rubygem-rack.spec
index 6d79524..8769546 100644
--- a/rubygem-rack.spec
+++ b/rubygem-rack.spec
@@ -6,13 +6,16 @@ Name:           rubygem-%{gemname}
 Summary:        Common API for connecting web frameworks, web servers and layers of software
 # Introduce Epoch (related to bug 552972)
 Epoch:          1
-Version:        1.3.0
+Version:        1.4.0
 Release:        1%{?dist}
 Group:          Development/Languages
 License:        MIT
 URL:            http://rubyforge.org/projects/%{gemname}/
 Source0:        http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
-
+# These patches fix the test failuers with Ruby 1.8.7-p357 and are already
+# proposed upstream: https://github.com/rack/rack/pull/298
+Patch0:         rubygem-rack-test-object-which-responds-to-each.patch
+Patch1:         rubygem-rack-tests-now-accept-different-query-orders.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 Requires:       rubygems
 Requires:       ruby(abi) = 1.8
@@ -26,14 +29,23 @@ Rack provides a common API for connecting web frameworks,
 web servers and layers of software in between
 
 %prep
+%setup -q -c -T
+mkdir -p .%{gemdir}
+gem install --local --install-dir .%{gemdir} \
+            --force %{SOURCE0}
+
+pushd .%{geminstdir}
+%patch0 -p1
+%patch1 -p1
+popd
 
 %build
 
 %install
 rm -rf %{buildroot}
 mkdir -p %{buildroot}%{gemdir}
-gem install --local --install-dir %{buildroot}/%{gemdir} \
-            --force %{SOURCE0}
+cp -a .%{gemdir}/* \
+        %{buildroot}%{gemdir}/
 
 # Remove backup files
 find %{buildroot}/%{geminstdir} -type f -name "*~" -delete
@@ -57,7 +69,7 @@ find %{buildroot}/%{geminstdir} -type f -perm /g+wx -exec chmod -v g-w {} \;
 # Find files that are not readable
 find %{buildroot}/%{geminstdir} -type f ! -perm /go+r -exec chmod -v go+r {} \;
 
-# Move %{gemdir}/bin/rackup to %{_bindir}
+# Move %%{gemdir}/bin/rackup to %%{_bindir}
 mkdir -p %{buildroot}/%{_bindir}
 mv %{buildroot}/%{gemdir}/bin/rackup %{buildroot}/%{_bindir}
 rm -rf %{buildroot}/%{gemdir}/bin/
@@ -76,7 +88,7 @@ popd
 %doc %{gemdir}/doc/%{gemname}-%{version}
 %doc %{geminstdir}/COPYING
 %doc %{geminstdir}/Rakefile
-%doc %{geminstdir}/README
+%doc %{geminstdir}/README.rdoc
 %doc %{geminstdir}/KNOWN-ISSUES
 %doc %{geminstdir}/SPEC
 %doc %{geminstdir}/example
@@ -90,6 +102,11 @@ popd
 %{gemdir}/specifications/%{gemname}-%{version}.gemspec
 
 %changelog
+* Thu Jan 05 2012 Bohuslav Kabrda <bkabrda at redhat.com> - 1:1.4.0-1
+- Update to Rack 1.4.
+- Moved gem install to %%prep to be able to apply patches.
+- Applied two patches that fix test failures with Ruby 1.8.7-p357.
+
 * Tue Jun 28 2011 Vít Ondruch <vondruch at redhat.com> - 1:1.3.0-1
 - Updated to Rack 1.3.
 - Fixed FTBFS.
diff --git a/sources b/sources
index 1ca9d8a..e1d3e12 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-765f523bb32c4475bfcb6898eddbc877  rack-1.3.0.gem
+c2a2100159ebd81ceffc20bd38323152  rack-1.4.0.gem


More information about the scm-commits mailing list