diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..69afc46 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/dalli-2.7.2.gem diff --git a/.rh-ror41-rubygem-dalli.metadata b/.rh-ror41-rubygem-dalli.metadata new file mode 100644 index 0000000..1a69800 --- /dev/null +++ b/.rh-ror41-rubygem-dalli.metadata @@ -0,0 +1 @@ +39691cff5709a63ee3128e6f4afc13809ff92e11 SOURCES/dalli-2.7.2.gem diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/rubygem-dalli-2.7.2-Assorted-changes-to-get-specs-to-green.patch b/SOURCES/rubygem-dalli-2.7.2-Assorted-changes-to-get-specs-to-green.patch new file mode 100644 index 0000000..07bd561 --- /dev/null +++ b/SOURCES/rubygem-dalli-2.7.2-Assorted-changes-to-get-specs-to-green.patch @@ -0,0 +1,152 @@ +From d204330c6ed4bbc6f15717d6ecbf597c586387db Mon Sep 17 00:00:00 2001 +From: "Peter M. Goldstein" +Date: Mon, 23 Jun 2014 21:50:29 -0700 +Subject: [PATCH] Assorted changes to get specs to green. Clean up memcached + processes after creation, so the processes aren't reused. Remove use of the + 'second' method on Array (added by ActiveSupport). Fix Travis rbx keys. Set + value on stats spec, so it doesn't depend on server processes from other + specs. + +--- + test/memcached_mock.rb | 4 +++- + test/test_active_support.rb | 36 ++++++++++++++++++++---------------- + test/test_cas_client.rb | 4 ++-- + test/test_dalli.rb | 1 + + test/test_rack_session.rb | 7 +++++-- + 5 files changed, 31 insertions(+), 21 deletions(-) + +diff --git a/test/memcached_mock.rb b/test/memcached_mock.rb +index 7fdd8c1..9ed167a 100644 +--- a/test/memcached_mock.rb ++++ b/test/memcached_mock.rb +@@ -68,12 +68,14 @@ def find_memcached + def memcached(port=19122, args='', options={}) + memcached_server(port, args) + yield Dalli::Client.new(["localhost:#{port}", "127.0.0.1:#{port}"], options) ++ memcached_kill(port) + end + + def memcached_cas(port=19122, args='', options={}) + memcached_server(port, args) + require 'dalli/cas/client' + yield Dalli::Client.new(["localhost:#{port}", "127.0.0.1:#{port}"], options) ++ memcached_kill(port) + end + + def memcached_server(port=19122, args='') +@@ -82,7 +84,7 @@ def memcached_server(port=19122, args='') + cmd = "#{Memcached.path}memcached #{args} -p #{port}" + + $started[port] ||= begin +- #puts "Starting: #{cmd}..." ++ # puts "Starting: #{cmd}..." + pid = IO.popen(cmd).pid + at_exit do + begin +diff --git a/test/test_active_support.rb b/test/test_active_support.rb +index 4af1816..b897eb9 100644 +--- a/test/test_active_support.rb ++++ b/test/test_active_support.rb +@@ -17,26 +17,30 @@ def cache_key + end + + it 'allow mute and silence' do +- @dalli = ActiveSupport::Cache.lookup_store(:dalli_store, 'localhost:19122') +- @dalli.mute do +- assert op_addset_succeeds(@dalli.write('foo', 'bar', nil)) +- assert_equal 'bar', @dalli.read('foo', nil) ++ memcached do ++ @dalli = ActiveSupport::Cache.lookup_store(:dalli_store, 'localhost:19122') ++ @dalli.mute do ++ assert op_addset_succeeds(@dalli.write('foo', 'bar', nil)) ++ assert_equal 'bar', @dalli.read('foo', nil) ++ end ++ refute @dalli.silence? ++ @dalli.silence! ++ assert_equal true, @dalli.silence? + end +- refute @dalli.silence? +- @dalli.silence! +- assert_equal true, @dalli.silence? + end + + it 'handle nil options' do +- @dalli = ActiveSupport::Cache.lookup_store(:dalli_store, 'localhost:19122') +- assert op_addset_succeeds(@dalli.write('foo', 'bar', nil)) +- assert_equal 'bar', @dalli.read('foo', nil) +- assert_equal 18, @dalli.fetch('lkjsadlfk', nil) { 18 } +- assert_equal 18, @dalli.fetch('lkjsadlfk', nil) { 18 } +- assert_equal 1, @dalli.increment('lkjsa', 1, nil) +- assert_equal 2, @dalli.increment('lkjsa', 1, nil) +- assert_equal 1, @dalli.decrement('lkjsa', 1, nil) +- assert_equal true, @dalli.delete('lkjsa') ++ memcached do ++ @dalli = ActiveSupport::Cache.lookup_store(:dalli_store, 'localhost:19122') ++ assert op_addset_succeeds(@dalli.write('foo', 'bar', nil)) ++ assert_equal 'bar', @dalli.read('foo', nil) ++ assert_equal 18, @dalli.fetch('lkjsadlfk', nil) { 18 } ++ assert_equal 18, @dalli.fetch('lkjsadlfk', nil) { 18 } ++ assert_equal 1, @dalli.increment('lkjsa', 1, nil) ++ assert_equal 2, @dalli.increment('lkjsa', 1, nil) ++ assert_equal 1, @dalli.decrement('lkjsa', 1, nil) ++ assert_equal true, @dalli.delete('lkjsa') ++ end + end + + it 'support fetch' do +diff --git a/test/test_cas_client.rb b/test/test_cas_client.rb +index 423e360..31e146f 100644 +--- a/test/test_cas_client.rb ++++ b/test/test_cas_client.rb +@@ -41,14 +41,14 @@ + # Invocation without block + resp = dc.get_multi_cas(%w(a b c d e f)) + resp.each_pair do |k, data| +- value, cas = [data.first, data.second] ++ value, cas = [data.first, data[1]] + assert_equal expected_hash[k], value + assert(cas && cas != 0) + end + + # Invocation with block + dc.get_multi_cas(%w(a b c d e f)) do |k, data| +- value, cas = [data.first, data.second] ++ value, cas = [data.first, data[1]] + assert_equal expected_hash[k], value + assert(cas && cas != 0) + end +diff --git a/test/test_dalli.rb b/test/test_dalli.rb +index fb67991..cf75ced 100644 +--- a/test/test_dalli.rb ++++ b/test/test_dalli.rb +@@ -147,6 +147,7 @@ + it "support stats" do + memcached do |dc| + # make sure that get_hits would not equal 0 ++ dc.set(:a, "1234567890"*100000) + dc.get(:a) + + stats = dc.stats +diff --git a/test/test_rack_session.rb b/test/test_rack_session.rb +index 657b061..d264b58 100644 +--- a/test/test_rack_session.rb ++++ b/test/test_rack_session.rb +@@ -9,13 +9,16 @@ + Rack::Session::Dalli::DEFAULT_OPTIONS[:memcache_server] = 'localhost:19129' + + before do +- memcached(19129) do +- end ++ memcached_server(19129) + + # test memcache connection + Rack::Session::Dalli.new(incrementor) + end + ++ after do ++ memcached_kill(19129) ++ end ++ + let(:session_key) { Rack::Session::Dalli::DEFAULT_OPTIONS[:key] } + let(:session_match) do + /#{session_key}=([0-9a-fA-F]+);/ diff --git a/SPECS/rubygem-dalli.spec b/SPECS/rubygem-dalli.spec new file mode 100644 index 0000000..ed26d7e --- /dev/null +++ b/SPECS/rubygem-dalli.spec @@ -0,0 +1,122 @@ +%{?scl:%scl_package rubygem-%{gem_name}} +%{!?scl:%global pkg_name %{name}} + +# Generated from dalli-2.6.4.gem by gem2rpm -*- rpm-spec -*- +%global gem_name dalli + +# Depends on Rails and its needed by Rails +%global enable_test 1 + +Name: %{?scl_prefix}rubygem-%{gem_name} +Version: 2.7.2 +Release: 2%{?dist} +Summary: High performance memcached client for Ruby +Group: Development/Languages +License: MIT +URL: http://github.com/mperham/dalli +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# This makes the test suite to behave a bit better. +# https://github.com/mperham/dalli/commit/d204330c6ed4bbc6f15717d6ecbf597c586387db +Patch0: rubygem-dalli-2.7.2-Assorted-changes-to-get-specs-to-green.patch +Requires: %{?scl_prefix_ruby}ruby(release) +Requires: %{?scl_prefix_ruby}ruby(rubygems) +BuildRequires: %{?scl_prefix_ruby}ruby(release) +BuildRequires: %{?scl_prefix_ruby}rubygems-devel +%if 0%{enable_test} > 0 +BuildRequires: memcached +BuildRequires: %{?scl_prefix_ruby}rubygem(minitest) +BuildRequires: %{?scl_prefix}rubygem(mocha) +BuildRequires: %{?scl_prefix}rubygem(rails) +%endif +BuildRequires: %{?scl_prefix_ruby}ruby +BuildArch: noarch +Provides: %{?scl_prefix}rubygem(%{gem_name}) = %{version} + +%description +High performance memcached client for Ruby + +%package doc +Summary: Documentation for %{pkg_name} +Group: Documentation +Requires: %{?scl_prefix}%{pkg_name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{pkg_name} + +%prep +%{?scl:scl enable %{scl} "} +gem unpack %{SOURCE0} +%{?scl:"} + +%setup -q -D -T -n %{gem_name}-%{version} + +%{?scl:scl enable %{scl} "} +gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec +%{?scl:"} + +%patch0 -p1 + +%build +%{?scl:scl enable %{scl} - << \EOF} +gem build %{gem_name}.gemspec +%gem_install +%{?scl:EOF} + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -pa .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +%check +%if 0%{enable_test} > 0 +pushd .%{gem_instdir} +%{?scl:scl enable %{scl} - << \EOF} +set -e + +# connection_pool is not yet in Fedora +sed -i -e '3d' test/test_active_support.rb +# There are 2 failures and 1 error regarding SALS +# https://github.com/mperham/dalli/issues/439 +ruby -Ilib:test -e "Dir.glob './test/test_*.rb', &method(:require)" \ + | grep '121 runs, 14578 assertions, 2 failures, 1 errors, 0 skips' +%{?scl:EOF} +popd +%endif + +%files +%dir %{gem_instdir} +%{gem_libdir} +%exclude %{gem_cache} +%{gem_spec} +%doc %{gem_instdir}/LICENSE + +%files doc +%doc %{gem_docdir} +%doc %{gem_instdir}/README.md +%doc %{gem_instdir}/Performance.md +%doc %{gem_instdir}/History.md +%{gem_instdir}/%{gem_name}.gemspec +%{gem_instdir}/Rakefile +%{gem_instdir}/Gemfile +%{gem_instdir}/test + +%changelog +* Mon Feb 02 2015 Vít Ondruch - 2.7.2-2 +- Enable test suite. + +* Mon Jan 19 2015 Josef Stribny - 2.7.2-1 +- Update to 2.7.2 + +* Fri Mar 21 2014 Vít Ondruch - 2.6.4-4 +- Rebuid against new scl-utils to depend on -runtime package. + Resolves: rhbz#1069109 + +* Thu Oct 03 2013 Josef Stribny - 2.6.4-3 +- Rebuild for scl + +* Thu Aug 08 2013 Josef Stribny - 2.6.4-2 +- Enable tests + +* Wed Jul 31 2013 Josef Stribny - 2.6.4-1 +- Initial package