Hi rubyists,

Working toward Ruby 2.1.0 in Fedora, there are going to be necessary some changes to gems with binary extensions. In short, the extensions are not installed into %{buildroot}%{gem_extdir_mri}/REQUIRE_PATHS/ anymore, but %{buildroot}%{gem_extdir_mri}/ will be used for the future. This is improvement and this change is coming from RubyGems upstream. It should also simplify the guidelines a bit [1] (on the first look).

Unfortunately, although the resulting rubygem- packages are much nicer and closer to upstream then they used to be, the way how to create them got uglier :/ You can see changes needed to make rubygem-bcrypt-ruby compatible with new RubyGems in attached diff.

Since I am not happy about the situation, I'd like to ask you for your feedback, how would you envision to simplify this process.

I am thinking about several possibilities:

1) Modify our operating_system.rb and let it treat gem installation into %{buildroot} specially 2) Use some environment variable, to let RubyGems know, that we need to treat %{buildroot} similarly to system directories 3) Introduce some additional parameter to gem install command, which will modify the --install-dir option to install extensions properly
4) Introduce some RPM macros which will handle all this stuff for us.

Please let me know if you have another bright idea :)


Thanks



Vít


[1] https://fedoraproject.org/wiki/Packaging:Ruby#Building_gems
diff --git a/rubygem-bcrypt-ruby.spec b/rubygem-bcrypt-ruby.spec
index 59f020e..cdda89b 100644
--- a/rubygem-bcrypt-ruby.spec
+++ b/rubygem-bcrypt-ruby.spec
@@ -38,15 +38,24 @@ mkdir -p %{buildroot}%{gem_dir}
 cp -pa .%{gem_dir}/* \
         %{buildroot}%{gem_dir}/
 
-mkdir -p %{buildroot}%{gem_extdir_mri}/lib
-mv %{buildroot}%{gem_libdir}/bcrypt_ext.so %{buildroot}%{gem_extdir_mri}/lib
+mkdir -p %{buildroot}%{gem_extdir_mri}
+find %{buildroot}%{gem_dir}/extensions \( \
+  -type f -name '*.so' -o \
+  -type f -name gem.build_complete \) \
+  -exec mv '{}' %{buildroot}%{gem_extdir_mri} \;
 
 # Prevent dangling symlink in -debuginfo (rhbz#878863).
 rm -rf %{buildroot}%{gem_instdir}/ext/
 
+rm -rf %{buildroot}%{gem_dir}/extensions
+
+# This is unexpected and unnecessary.
+# https://github.com/rubygems/rubygems/issues/758
+rm -rf %{buildroot}%{gem_dir}/doc/extensions
+
 %check
 pushd .%{gem_instdir}
-rspec spec
+rspec -I%{buildroot}%{gem_extdir_mri} spec
 popd
 
 %files
_______________________________________________
ruby-sig mailing list
[email protected]
https://admin.fedoraproject.org/mailman/listinfo/ruby-sig

Reply via email to