[rubygem-zoom] fix this beasty
Tom Callaway
spot at fedoraproject.org
Fri Mar 23 20:37:54 UTC 2012
commit c97e950d0ae55747bc9e874d567a716bd5ce5f28
Author: Tom Callaway <spot at fedoraproject.org>
Date: Fri Mar 23 16:37:51 2012 -0400
fix this beasty
rubygem-zoom.spec | 77 ++++++++++++++++++---------
zoom-0.4.1-authors.patch | 11 ++++
zoom-0.4.1-cert-chain-must-not-be-nil.patch | 11 ++++
zoom-0.4.1-no-newline.patch | 12 ++++
zoom-0.4.1-ruby19.patch | 66 +++++++++++++++++++++++
zoom-0.4.1-use-abort.patch | 19 +++++++
6 files changed, 170 insertions(+), 26 deletions(-)
---
diff --git a/rubygem-zoom.spec b/rubygem-zoom.spec
index d03ff20..89c46dc 100644
--- a/rubygem-zoom.spec
+++ b/rubygem-zoom.spec
@@ -1,24 +1,34 @@
-%define gemdir %(ruby -rubygems -e 'puts Gem::dir' 2>/dev/null)
+%define gemdir %{_datadir}/rubygems
%define gemname zoom
%define geminstdir %{gemdir}/gems/%{gemname}-%{version}
+%define gemextdir %{_libdir}/gems/exts/%{gemname}-%{version}
-%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts Config::CONFIG['sitearchdir']")}
+%{!?ruby_sitearch: %global ruby_sitearch %(ruby -rrbconfig -e "puts RbConfig::CONFIG['sitearchdir']")}
-%define rubyabi 1.8
+%define rubyabi 1.9
%define repoid 28211
Name: rubygem-%{gemname}
Version: 0.4.1
-Release: 13%{?dist}
+Release: 14%{?dist}
Group: Development/Languages
Summary: Ruby binding to ZOOM
License: LGPLv2+
URL: http://ruby-zoom.rubyforge.org/
Source0: http://gems.rubyforge.org/gems/%{gemname}-%{version}.gem
-
-BuildRequires: ruby(abi) = %{rubyabi}
+Patch0: zoom-0.4.1-cert-chain-must-not-be-nil.patch
+Patch1: zoom-0.4.1-authors.patch
+# Use abort() instead of break
+Patch2: zoom-0.4.1-use-abort.patch
+# Somehow, a newline '\n' character shows up in the result of yaz-config --cflags.
+# We use tr to replace any newline characters with " " so as to not break the Makefile
+Patch3: zoom-0.4.1-no-newline.patch
+# Fixes for Ruby 1.9
+Patch4: zoom-0.4.1-ruby19.patch
+
+BuildRequires: ruby(abi) >= %{rubyabi}
BuildRequires: rubygem(rake)
BuildRequires: ruby-devel
@@ -28,7 +38,7 @@ BuildRequires: libxslt-devel
BuildRequires: libyaz-devel
BuildRequires: tcp_wrappers-devel
-Requires: ruby(abi) = %{rubyabi}
+Requires: ruby(abi) >= %{rubyabi}
Requires: ruby(rubygems)
Provides: rubygem(%{gemname}) = %{version}-%{release}
@@ -52,7 +62,22 @@ This package contains documentation for %{name}.
%prep
-%setup -q -c -T
+gem unpack %{SOURCE0}
+%setup -q -D -T -n %{gemname}-%{version}
+
+gem spec %{SOURCE0} -l --ruby > %{gemname}.gemspec
+
+%patch0 -p1
+%patch1 -p1
+%patch2 -p1 -b .use-abort
+%patch3 -p1 -b .no-newline
+%patch4 -p1 -b .ruby19
+
+%build
+mkdir -p .%{gemdir}
+
+# Create the gem as gem install only works on a gem file
+gem build %{gemname}.gemspec
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install \
@@ -60,27 +85,25 @@ gem install \
--local \
--install-dir ./%{gemdir} \
--force \
- %{SOURCE0}
+ --rdoc \
+ %{gemname}-%{version}.gem
chmod 0644 ./%{gemdir}/cache/%{gemname}-%{version}.gem
find . -type f -print0 | xargs --null chmod ugo+r
-%build
-
%install
-# 1. copy all
-mkdir -p %{buildroot}%{_prefix}
-cp -a .%{_prefix}/* %{buildroot}%{_prefix}/
+mkdir -p %{buildroot}%{gemdir}
+cp -a ./%{gemdir}/* %{buildroot}%{gemdir}/
-# 2. move ruby C extention
-mkdir -p %{buildroot}%{ruby_sitearch}
-mv -f %{buildroot}%{geminstdir}/lib/*.so \
- %{buildroot}%{ruby_sitearch}/
+# If there are C extensions, mv them to the extdir.
+# $REQUIRE_PATHS is taken from the first value of the require_paths field in
+# the gemspec file. It will typically be either "lib" or "ext". For instance:
+# s.require_paths = ["lib"]
+mkdir -p %{buildroot}%{gemextdir}/lib
+mv %{buildroot}%{geminstdir}/lib/%{gemname}.so %{buildroot}%{gemextdir}/lib/
-# 3. Cleanups
-# Use rmdir, to check if any files are left under lib/
-rmdir %{buildroot}%{geminstdir}/lib/
-rm -rf %{buildroot}%{geminstdir}/src/
+# clean the built bits out
+rm -rf %{buildroot}%{gemdir}/gems/%{gemname}-%{version}/src/*.o %{gemdir}/gems/%{gemname}-%{version}/src/*.so
%check
# Net connection needed, disabling now.
@@ -88,13 +111,12 @@ exit 0
rake test
%files
-%defattr(-, root, root,-)
-%{ruby_sitearch}/%{gemname}.so
-
+%{gemextdir}/lib/%{gemname}.so
%dir %{geminstdir}/
%doc %{geminstdir}/[A-Z]*
-
%{gemdir}/cache/%{gemname}-%{version}.gem
+%{gemdir}/doc/%{gemname}-%{version}/
+%{geminstdir}/src/
%{gemdir}/specifications/%{gemname}-%{version}.gemspec
%files doc
@@ -104,6 +126,9 @@ rake test
%{geminstdir}/test/
%changelog
+* Fri Mar 23 2012 Tom Callaway <spot at fedoraproject.org> - 0.4.1-14
+- get this thing working
+
* Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.4.1-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
diff --git a/zoom-0.4.1-authors.patch b/zoom-0.4.1-authors.patch
new file mode 100644
index 0000000..2e13306
--- /dev/null
+++ b/zoom-0.4.1-authors.patch
@@ -0,0 +1,11 @@
+diff -up zoom-0.4.1/zoom.gemspec.authors zoom-0.4.1/zoom.gemspec
+--- zoom-0.4.1/zoom.gemspec.authors 2012-03-23 12:49:08.356202638 -0400
++++ zoom-0.4.1/zoom.gemspec 2012-03-23 12:49:54.032793599 -0400
+@@ -6,6 +6,7 @@ Gem::Specification.new do |s|
+
+ s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
+ s.autorequire = "zoom"
++ s.authors = ["Laurent Sansonetti"]
+ s.date = "2007-11-20"
+ s.extensions = ["src/extconf.rb"]
+ s.files = ["src/rbzoomquery.c", "src/rbzoomresultset.c", "src/rbzoomoptions.c", "src/rbzoompackage.c", "src/rbzoomrecord.c", "src/rbzoom.c", "src/rbzoomconnection.c", "src/rbzoom.h", "src/extconf.rb", "test/zebra", "test/record.dat", "test/search_test.rb", "test/search_batch_test.rb", "test/thread_test.rb", "test/package_live.rb", "test/package_test.rb", "test/record.txt", "test/record-update.xml", "test/record.xml", "test/zebra/records", "test/zebra/register", "test/zebra/shadow", "test/zebra/tab", "test/zebra/key", "test/zebra/lock", "test/zebra/zebra.cfg", "test/zebra/records/programming_ruby.xml", "test/zebra/records/programming_ruby_update.xml", "test/zebra/register/empty_file", "test/zebra/shadow/empty_file", "test/zebra/tab/string.chr", "test/zebra/tab/record.abs", "test/zebra/tab/bib1.att", "test/zebra/tab/default.idx", "test/zebra/tab/usmarc.mar", "test/zebra/tab/numeric.chr", "test/zebra/key/empty_file", "test/zebra/lock/empty_file", "sample/hello.rb", "sample/n
eedle.rb", "README", "ChangeLog", "Rakefile"]
diff --git a/zoom-0.4.1-cert-chain-must-not-be-nil.patch b/zoom-0.4.1-cert-chain-must-not-be-nil.patch
new file mode 100644
index 0000000..46a3374
--- /dev/null
+++ b/zoom-0.4.1-cert-chain-must-not-be-nil.patch
@@ -0,0 +1,11 @@
+diff -up zoom-0.4.1/zoom.gemspec.fix zoom-0.4.1/zoom.gemspec
+--- zoom-0.4.1/zoom.gemspec.fix 2012-03-23 12:47:26.145117111 -0400
++++ zoom-0.4.1/zoom.gemspec 2012-03-23 12:47:29.051091122 -0400
+@@ -6,7 +6,6 @@ Gem::Specification.new do |s|
+
+ s.required_rubygems_version = nil if s.respond_to? :required_rubygems_version=
+ s.autorequire = "zoom"
+- s.cert_chain = nil
+ s.date = "2007-11-20"
+ s.extensions = ["src/extconf.rb"]
+ s.files = ["src/rbzoomquery.c", "src/rbzoomresultset.c", "src/rbzoomoptions.c", "src/rbzoompackage.c", "src/rbzoomrecord.c", "src/rbzoom.c", "src/rbzoomconnection.c", "src/rbzoom.h", "src/extconf.rb", "test/zebra", "test/record.dat", "test/search_test.rb", "test/search_batch_test.rb", "test/thread_test.rb", "test/package_live.rb", "test/package_test.rb", "test/record.txt", "test/record-update.xml", "test/record.xml", "test/zebra/records", "test/zebra/register", "test/zebra/shadow", "test/zebra/tab", "test/zebra/key", "test/zebra/lock", "test/zebra/zebra.cfg", "test/zebra/records/programming_ruby.xml", "test/zebra/records/programming_ruby_update.xml", "test/zebra/register/empty_file", "test/zebra/shadow/empty_file", "test/zebra/tab/string.chr", "test/zebra/tab/record.abs", "test/zebra/tab/bib1.att", "test/zebra/tab/default.idx", "test/zebra/tab/usmarc.mar", "test/zebra/tab/numeric.chr", "test/zebra/key/empty_file", "test/zebra/lock/empty_file", "sample/hello.rb", "sample/n
eedle.rb", "README", "ChangeLog", "Rakefile"]
diff --git a/zoom-0.4.1-no-newline.patch b/zoom-0.4.1-no-newline.patch
new file mode 100644
index 0000000..2e38351
--- /dev/null
+++ b/zoom-0.4.1-no-newline.patch
@@ -0,0 +1,12 @@
+diff -up zoom-0.4.1/src/extconf.rb.no-newline zoom-0.4.1/src/extconf.rb
+--- zoom-0.4.1/src/extconf.rb.no-newline 2012-03-23 13:23:34.205603451 -0400
++++ zoom-0.4.1/src/extconf.rb 2012-03-23 13:23:51.271449068 -0400
+@@ -8,7 +8,7 @@ unless have_header('yaz/zoom.h')
+ abort("yaz zoom header not available")
+ end
+
+-$CFLAGS << " #{`yaz-config --cflags`} "
++$CFLAGS << " #{`yaz-config --cflags| tr "\n" " "`} "
+ $LDFLAGS << " #{`yaz-config --libs`} "
+
+ create_makefile("zoom")
diff --git a/zoom-0.4.1-ruby19.patch b/zoom-0.4.1-ruby19.patch
new file mode 100644
index 0000000..fb2bf00
--- /dev/null
+++ b/zoom-0.4.1-ruby19.patch
@@ -0,0 +1,66 @@
+diff -up zoom-0.4.1/src/rbzoomconnection.c.fix zoom-0.4.1/src/rbzoomconnection.c
+--- zoom-0.4.1/src/rbzoomconnection.c.fix 2012-03-23 13:57:02.940035843 -0400
++++ zoom-0.4.1/src/rbzoomconnection.c 2012-03-23 14:10:29.701625139 -0400
+@@ -207,7 +207,7 @@ rbz_connection_set_option (VALUE self, V
+ connection = rbz_connection_get (self);
+ ZOOM_connection_option_set (connection,
+ RVAL2CSTR (key),
+- RVAL2CSTR (rb_obj_as_string (val)));
++ RVAL2CSTR (val));
+ RAISE_IF_FAILED (connection);
+
+ return self;
+diff -up zoom-0.4.1/src/rbzoom.h.fix zoom-0.4.1/src/rbzoom.h
+--- zoom-0.4.1/src/rbzoom.h.fix 2012-03-23 13:35:29.907115944 -0400
++++ zoom-0.4.1/src/rbzoom.h 2012-03-23 14:09:07.169383312 -0400
+@@ -53,7 +53,7 @@ void rbz_connection_check(VALUE obj);
+
+ /* useful macros */
+ #if !defined (RVAL2CSTR)
+-# define RVAL2CSTR(x) (NIL_P (x) ? NULL : STR2CSTR(x))
++# define RVAL2CSTR(x) (NIL_P (x) ? NULL : StringValueCStr(x))
+ #endif
+ #if !defined (CSTR2RVAL)
+ # define CSTR2RVAL(x) (x == NULL ? Qnil : rb_str_new2(x))
+diff -up zoom-0.4.1/src/rbzoomoptions.c.fix zoom-0.4.1/src/rbzoomoptions.c
+--- zoom-0.4.1/src/rbzoomoptions.c.fix 2012-03-23 13:30:34.979792163 -0400
++++ zoom-0.4.1/src/rbzoomoptions.c 2012-03-23 13:36:25.996606575 -0400
+@@ -32,10 +32,10 @@ ruby_hash_to_zoom_options (VALUE hash)
+ options = ZOOM_options_create ();
+
+ ary = rb_funcall (hash, rb_intern ("to_a"), 0);
+- for (i = 0; i < RARRAY (ary)->len; i++) {
+- pair = RARRAY (ary)->ptr[i];
+- key = RARRAY (pair)->ptr[0];
+- value = RARRAY (pair)->ptr[1];
++ for (i = 0; i < RARRAY_LEN (ary); i++) {
++ pair = RARRAY_PTR (ary)[i];
++ key = RARRAY_PTR (pair)[0];
++ value = RARRAY_PTR (pair)[1];
+
+ switch (TYPE (value)) {
+ case T_TRUE:
+diff -up zoom-0.4.1/src/rbzoompackage.c.fix zoom-0.4.1/src/rbzoompackage.c
+--- zoom-0.4.1/src/rbzoompackage.c.fix 2012-03-23 13:57:26.132822831 -0400
++++ zoom-0.4.1/src/rbzoompackage.c 2012-03-23 14:09:35.584122268 -0400
+@@ -95,7 +95,7 @@ rbz_package_set_option (VALUE self, VALU
+ package = rbz_package_get (self);
+ ZOOM_package_option_set (package,
+ RVAL2CSTR (key),
+- RVAL2CSTR (rb_obj_as_string (val)));
++ RVAL2CSTR (val));
+
+ return self;
+ }
+diff -up zoom-0.4.1/src/rbzoomresultset.c.fix zoom-0.4.1/src/rbzoomresultset.c
+--- zoom-0.4.1/src/rbzoomresultset.c.fix 2012-03-23 13:53:15.095156361 -0400
++++ zoom-0.4.1/src/rbzoomresultset.c 2012-03-23 14:10:01.038888444 -0400
+@@ -66,7 +66,7 @@ rbz_resultset_set_option (VALUE self, VA
+ {
+ ZOOM_resultset_option_set (rbz_resultset_get (self),
+ RVAL2CSTR (key),
+- RVAL2CSTR (rb_obj_as_string (val)));
++ RVAL2CSTR (val));
+
+ return self;
+ }
diff --git a/zoom-0.4.1-use-abort.patch b/zoom-0.4.1-use-abort.patch
new file mode 100644
index 0000000..9eaa2c9
--- /dev/null
+++ b/zoom-0.4.1-use-abort.patch
@@ -0,0 +1,19 @@
+diff -up zoom-0.4.1/src/extconf.rb.useabort zoom-0.4.1/src/extconf.rb
+--- zoom-0.4.1/src/extconf.rb.useabort 2012-03-23 12:52:51.806199476 -0400
++++ zoom-0.4.1/src/extconf.rb 2012-03-23 12:53:37.433789845 -0400
+@@ -1,13 +1,11 @@
+ require 'mkmf'
+
+ unless system('yaz-config')
+- $stderr.puts 'yaz does not appear to be installed'
+- break
++ abort("yaz does not appear to be installed")
+ end
+
+ unless have_header('yaz/zoom.h')
+- $stderr.puts 'yaz zoom header not available'
+- break
++ abort("yaz zoom header not available")
+ end
+
+ $CFLAGS << " #{`yaz-config --cflags`} "
More information about the scm-commits
mailing list