diff --git a/hiredis-0.6.3-bump-hiredis-to-1.0.0.patch b/hiredis-0.6.3-bump-hiredis-to-1.0.0.patch new file mode 100644 index 0000000..3ff3f5b --- /dev/null +++ b/hiredis-0.6.3-bump-hiredis-to-1.0.0.patch @@ -0,0 +1,31 @@ +From 1a3b7d5f41caa35eeb664053d1cc956e071a0b8b Mon Sep 17 00:00:00 2001 +From: artygus +Date: Wed, 21 Oct 2020 14:39:19 +0300 +Subject: [PATCH] bump hiredis to 1.0.0 + +--- + ext/hiredis_ext/reader.c | 4 +++- + 1 files changed, 3 insertions(+), 1 deletions(-) + +diff --git a/ext/hiredis_ext/reader.c b/ext/hiredis_ext/reader.c +index e0c9fb7..3cf6d0b 100644 +--- a/ext/hiredis_ext/reader.c ++++ b/ext/hiredis_ext/reader.c +@@ -34,7 +34,7 @@ static void *createStringObject(const redisReadTask *task, char *str, size_t len + return tryParentize(task,v); + } + +-static void *createArrayObject(const redisReadTask *task, int elements) { ++static void *createArrayObject(const redisReadTask *task, size_t elements) { + volatile VALUE v = rb_ary_new2(elements); + return tryParentize(task,v); + } +@@ -57,7 +57,9 @@ redisReplyObjectFunctions redisExtReplyObjectFunctions = { + createStringObject, + createArrayObject, + createIntegerObject, ++ NULL, + createNilObject, ++ NULL, + freeObject + }; diff --git a/hiredis-0.6.3-tests.tgz b/hiredis-0.6.3-tests.tgz new file mode 100644 index 0000000..438aa3f Binary files /dev/null and b/hiredis-0.6.3-tests.tgz differ diff --git a/hiredis-0.6.3.gem b/hiredis-0.6.3.gem new file mode 100644 index 0000000..c9ab5b2 Binary files /dev/null and b/hiredis-0.6.3.gem differ diff --git a/rubygem-hiredis-0.6.1-Build-against-system-hiredis.patch b/rubygem-hiredis-0.6.1-Build-against-system-hiredis.patch new file mode 100644 index 0000000..7ac1e88 --- /dev/null +++ b/rubygem-hiredis-0.6.1-Build-against-system-hiredis.patch @@ -0,0 +1,46 @@ +From 3339e1d7eb7a7f4e14b1c2be7597af60384b123c Mon Sep 17 00:00:00 2001 +From: Pavel Valena +Date: Wed, 9 May 2018 15:50:22 +0200 +Subject: [PATCH] Build against system hiredis. + +--- + ext/hiredis_ext/extconf.rb | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/ext/hiredis_ext/extconf.rb b/ext/hiredis_ext/extconf.rb +index da39eb5..4bdfc00 100644 +--- a/ext/hiredis_ext/extconf.rb ++++ b/ext/hiredis_ext/extconf.rb +@@ -8,12 +8,6 @@ RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC'] + end + + RbConfig::MAKEFILE_CONFIG['CC'] = ENV['CC'] if ENV['CC'] +- +-hiredis_dir = File.join(File.dirname(__FILE__), %w{.. .. vendor hiredis}) +-unless File.directory?(hiredis_dir) +- STDERR.puts "vendor/hiredis missing, please checkout its submodule..." +- exit 1 +-end + + RbConfig::CONFIG['configure_args'] =~ /with-make-prog\=(\w+)/ + make_program = $1 || ENV['make'] +@@ -27,15 +26,7 @@ end + end + + if build_hiredis +- # Make sure hiredis is built... +- Dir.chdir(hiredis_dir) do +- success = system("#{make_program} static") +- raise "Building hiredis failed" if !success +- end +- +- # Statically link to hiredis (mkmf can't do this for us) +- $CFLAGS << " -I#{hiredis_dir}" +- $LDFLAGS << " #{hiredis_dir}/libhiredis.a" ++ pkg_config 'hiredis' + + have_func("rb_thread_fd_select") + create_makefile('hiredis/ext/hiredis_ext') +-- +2.13.6 + diff --git a/rubygem-hiredis.spec b/rubygem-hiredis.spec new file mode 100644 index 0000000..0eea83f --- /dev/null +++ b/rubygem-hiredis.spec @@ -0,0 +1,101 @@ +%global gem_name hiredis + +Name: rubygem-%{gem_name} +Version: 0.6.3 +Release: 1 +Summary: Ruby wrapper for hiredis +License: BSD +URL: http://github.com/redis/hiredis-rb +Source0: https://rubygems.org/gems/%{gem_name}-%{version}.gem +# Get the test suite: +# git clone https://github.com/redis/hiredis-rb.git && cd hiredis-rb/ +# git checkout v0.6.3 && tar czvf hiredis-0.6.3-tests.tgz test/ +Source1: %{gem_name}-%{version}-tests.tgz +# Build against system hiredis library +Patch0: rubygem-hiredis-0.6.1-Build-against-system-hiredis.patch +# Compatibility with hiredis 1.0.0. +# https://github.com/redis/hiredis-rb/pull/69 +Patch1: hiredis-0.6.3-bump-hiredis-to-1.0.0.patch +BuildRequires: ruby(release) +BuildRequires: rubygems-devel +BuildRequires: ruby-devel +BuildRequires: gcc +BuildRequires: hiredis-devel +BuildRequires: rubygem(minitest) + +%description +Ruby wrapper for hiredis (protocol serialization/deserialization and blocking +I/O). + +%package doc +Summary: Documentation for %{name} +Requires: %{name} = %{version}-%{release} +BuildArch: noarch + +%description doc +Documentation for %{name}. + +%prep +%setup -q -n %{gem_name}-%{version} -b1 + + +# Remove bundled hiredis +%gemspec_remove_file Dir.glob('vendor/**/*') +rm -rf ./vendor + +# Use system hiredis +%patch0 -p1 +%patch1 -p1 + + +%build +gem build ../%{gem_name}-%{version}.gemspec +%gem_install + +%install +mkdir -p %{buildroot}%{gem_dir} +cp -a .%{gem_dir}/* \ + %{buildroot}%{gem_dir}/ + +mkdir -p %{buildroot}%{gem_extdir_mri}/hiredis/ext +cp -a .%{gem_extdir_mri}/gem.build_complete %{buildroot}%{gem_extdir_mri}/ +cp -a .%{gem_extdir_mri}/%{gem_name}/ext/*.so %{buildroot}%{gem_extdir_mri}/%{gem_name}/ext + +# Prevent dangling symlink in -debuginfo (rhbz#878863). +rm -rf %{buildroot}%{gem_instdir}/ext/ + + +%check +pushd .%{gem_instdir} +cp -a %{_builddir}/test . + +# Tests calling #flush don't work properly. +# https://github.com/redis/hiredis-rb/issues/62 +sed -i '/^ def test_recover_from_partial_write/ a skip' \ + test/connection_test.rb +sed -i '/^ def test_eagain_on_write_followed_by_remote_drain/ a skip' \ + test/connection_test.rb + +# Make sure the test does not fail in mock with disabled networking. +sed -i -r '/(name or service not known)/ s|(/i)|\|(temporary failure in name resolution)\1|' \ + test/connection_test.rb + +ruby -Ilib:$(dirs +1)%{gem_extdir_mri} -e 'Dir.glob "./test/**/*_test.rb", &method(:require)' +popd + +%files +%dir %{gem_instdir} +%{gem_extdir_mri} +%license %{gem_instdir}/COPYING +%{gem_libdir} +%exclude %{gem_cache} +%exclude %{gem_instdir}/ext +%{gem_spec} + +%files doc +%doc %{gem_docdir} +%{gem_instdir}/Rakefile + +%changelog +* Thu Mar 3 2022 caodongxia - 0.6.3-1 +- Init package