#34 [WIP] Install operating_system.rb in %prep section.
Opened 2 years ago by vondruch. Modified 2 years ago
rpms/ vondruch/ruby o-s-rb-in-prep  into  rawhide

file modified
+4 -7
@@ -559,6 +559,10 @@ 

  # https://github.com/ruby/ruby/blob/trunk/tool/compile_prelude.rb#L26

  cp -a %{SOURCE6} .


+ # Install custom operating_system.rb.

+ mkdir -p lib/rubygems/defaults

+ install -m 644 %{SOURCE1} lib/rubygems/defaults




@@ -629,13 +633,6 @@ 

  install -m 755 %{SOURCE10} %{buildroot}%{_rpmconfigdir}

  install -m 755 %{SOURCE11} %{buildroot}%{_rpmconfigdir}


- # Install custom operating_system.rb.

- mkdir -p %{buildroot}%{rubygems_dir}/rubygems/defaults

- cp %{SOURCE1} %{buildroot}%{rubygems_dir}/rubygems/defaults


- # Move gems root into common direcotry, out of Ruby directory structure.

- mv %{buildroot}%{ruby_libdir}/gems %{buildroot}%{gem_dir}


  # Create folders for gem binary extensions.

  # TODO: These folders should go into rubygem-filesystem but how to achieve it,

  # since noarch package cannot provide arch dependent subpackages?

This helps Ruby installation process to pickup the operating_system.rb and make interference with possibly installed ruby less painful (although there might be still some interferences and I strongly discourage to have Ruby installed during the build of Ruby).

@jaruga could you please give it a try?

"installing default gems" to /usr/share/ruby (It's wrong. It should be "/usr/share/ruby/gems/" as you know.) in %install section and the tests were failed in %check section.

But I think it is better situation with current one.

$ rpm -q ruby

$ which ruby

$ fedpkg --release master srpm

$ rpmbuild \
  --rebuild \
  --target=x86_64 \
  --rcfile /usr/lib/rpm/rpmrc:/usr/lib/rpm/redhat/rpmrc \
  ./*.src.rpm 2>&1 \
  | tee -a rpmbuild.log

$ vi rpmbuild.log
installing default gems from lib:   /usr/share/gems (build_info, cache, doc, extensions, gems, specifications)
                                    cmath 1.0.0 
                                    csv 1.0.0 
                                    fileutils 1.0.2 
                                    ipaddr 1.2.0 
                                    rdoc 6.0.1 
                                    scanf 1.0.0 
                                    webrick 1.4.2 
  1) Failure:
TestGem#test_default_path_vendor_dir [/home/jaruga/rpmbuild/BUILD/ruby-2.5.3/test/rubygems/test_gem.rb:381]:
--- expected
+++ actual
@@ -1 +1 @@
-["/usr/share/gems", "/tmp/test_rubygems_30480/vendor/gems/"]
+["/usr/share/gems", "/usr/local/share/gems"]

  2) Failure:
TestGem#test_default_path_user_home [/home/jaruga/rpmbuild/BUILD/ruby-2.5.3/test/rubygems/test_gem.rb:366]:
--- expected
+++ actual
@@ -1 +1,3 @@
-["/tmp/test_rubygems_30480/userhome/.gem/ruby", "/usr/share/gems"]
+ "/usr/share/gems",
+ "/usr/local/share/gems"]
 77) Error:
Errno::EACCES: Permission denied @ rb_sysopen - /usr/share/gems/specifications/default/default-2.gemspec
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/installer.rb:444:in `initialize'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/installer.rb:444:in `open'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/installer.rb:444:in `write_default_spec'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/installer.rb:302:in `install'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/test_case.rb:742:in `block in install_default_specs'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/test_case.rb:740:in `each'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/test_case.rb:740:in `install_default_specs'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/lib/rubygems/test_case.rb:727:in `install_default_gems'
    /home/jaruga/rpmbuild/BUILD/ruby-2.5.3/test/rubygems/test_gem_uninstaller.rb:213:in `test_uninstall_default_gem_with_same_version'

Finished tests in 390.046105s, 44.5691 tests/s, 5805.4727 assertions/s.
17384 tests, 2264402 assertions, 53 failures, 24 errors, 18 skips

ruby -v: ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-linux]
make: *** [uncommon.mk:698: yes-test-almost] Error 77
error: Bad exit status from /var/tmp/rpm-tmp.GF64ly (%check)

Thanks for looking into this. I have tried this patch just with Ruby 2.6 where it seems to work just fine. Will take a look at Ruby 2.5 soon again.

$ which ruby

BTW this ^^ does not look as RPM packaged Ruby.

Testing it more, it seems I was wrong about Ruby 2.6, since it fails for me the similar way as Ruby 2.5 :( I thought that quick workaround could be to remove the operating_system.rb prior the test suite is executed, but neither this helped. So I'm going to postpone this PR until I find time to dig deeper into the RubyGems test suite issues. But except the test suite, this is IMO the step in the right direction.

BTW this ^^ does not look as RPM packaged Ruby.

Yes, this is Ruby installed from source. I just showed my environment above.
Sure for the postpone of the PR.