Bug 921650

Summary: ruby 2.0 creates bad makefiles
Product: [Fedora] Fedora Reporter: Orion Poplawski <orion>
Component: rubyAssignee: Vít Ondruch <vondruch>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 19CC: bkabrda, cfeist, jeremy, jskarvad, ktdreyer, mmorsi, mtasaka, slukasik, tagoh, vanmeeuwen+fedora, vondruch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: ruby-2.0.0.247-14.fc19 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-15 21:35:46 EDT Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Attachments:
Description Flags
Adjust rubygems to #8115
none
Adjust rubygems to #8115
none
fix for the DESTDIR issue none

Description Orion Poplawski 2013-03-14 11:12:15 EDT
Description of problem:

Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.D2sqcQ
+ umask 022
+ cd /builddir/build/BUILD
+ '[' /builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386 '!=' / ']'
+ rm -rf /builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386
++ dirname /builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386
+ mkdir -p /builddir/build/BUILDROOT
+ mkdir /builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386
+ cd mysql-ruby-2.8.2
+ rm -rf /builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386
+ env DESTDIR=/builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386 make install
make: *** No rule to make target `/builddir/build/BUILDROOT/ruby-mysql-2.8.2-9.fc20.i386/usr/include/ruby.h', needed by `mysql.o'.  Stop. 

Workaround:

make install DESTDIR=%{buildroot} ruby_headers= 

Version-Release number of selected component (if applicable):
2.0.0.0-4.fc19
Comment 1 Vít Ondruch 2013-03-14 12:50:58 EDT
Just FYI, this is difference between Makefile for F18 and Rawhide. Upstream changed the configuration process on last second, apparently breaking everything more than fixing :/

Need to analyze it and report ... Also, there were already some reports with broken builds etc, so it might be fixed upstream, dunno.
Comment 2 Vít Ondruch 2013-03-14 12:51:36 EDT
Forgot to sent the link: https://gist.github.com/voxik/5162950
Comment 3 Ken Dreyer 2013-03-14 18:54:01 EDT
I'm hitting this with the Ruby bindings for remctl on Fedora 20 also.

cd ruby && make install DESTDIR=/builddir/build/BUILDROOT/remctl-3.3-3.fc20.i386
make[2]: Entering directory `/builddir/build/BUILD/remctl-3.3/ruby'
make[2]: Leaving directory `/builddir/build/BUILD/remctl-3.3/ruby'
make[2]: *** No rule to make target `/builddir/build/BUILDROOT/remctl-3.3-3.fc20
.i386/usr/include/ruby.h', needed by `remctl.o'.  Stop.
make[1]: *** [install-data-local-ruby] Error 2
make[1]: Leaving directory `/builddir/build/BUILD/remctl-3.3'
make: *** [install-am] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.9wCG1w (%install)


Is the plan to fix Ruby, or to fix each app individually?
Comment 4 Vít Ondruch 2013-03-15 04:39:07 EDT
First we must understand if it is bug in Ruby or if that is change in "internals" of Ruby which we abused or if it is bug in our configuration.
Comment 5 Jaroslav Škarvada 2013-03-18 07:45:38 EDT
The same problem with ruby bindings for rrdtool.
Comment 6 Vít Ondruch 2013-03-18 08:55:27 EDT
Reported upstream: https://bugs.ruby-lang.org/issues/8115
Comment 7 Jaroslav Škarvada 2013-03-18 10:33:58 EDT
I used the following as a workaround:
$ make DESTDIR="%{buildroot}" hdrdir="%{_includedir}" rubyhdrdir="%{_includedir}" install

I also had to create $(RUBYARCHDIR)/$(DLLIB) by hand (e.g. /tmp/usr/lib64/ruby/vendor_ruby), because the following snippet is missing from the new Makefile:

$(RUBYARCHDIR)/$(DLLIB): $(DLLIB)
        -$(Q)$(MAKEDIRS) $(@D)
        $(INSTALL_PROG) $(DLLIB) $(@D)
Comment 8 Mamoru TASAKA 2013-03-22 01:12:28 EDT
Umm... the upstream closed https://bugs.ruby-lang.org/issues/8115 , however when I apply r39841 change and rebuild srpm, it fails on test_install_extension_and_script(TestGemInstaller) as

http://koji.fedoraproject.org/koji/taskinfo?taskID=5155431

( ruby-2.0.0.0-5.fc19 successfully builds, so this failure is not due to rubygems 2.0.3:
http://koji.fedoraproject.org/koji/taskinfo?taskID=5155429 )
Comment 9 Jaroslav Škarvada 2013-03-25 06:15:34 EDT
I had to switch to the following workaround:

$ mkdir -p "%{buildroot}%{_libdir}/ruby/vendor_ruby" && make DESTDIR="%{buildroot}" hdrdir="%{_includedir}" rubyhdrdir="%{_includedir}" includedir="${_includedir}" install
Comment 10 Chris Feist 2013-04-03 17:13:30 EDT
Jaroslav, I used the exact same workaround, but it looks like you may have one typo.

includedir="${_includedir}"

should probably be

includedir="%{_includedir}"
Comment 11 Jaroslav Škarvada 2013-04-03 17:44:35 EDT
(In reply to comment #10)
> Jaroslav, I used the exact same workaround, but it looks like you may have
> one typo.
> 
> includedir="${_includedir}"
> 
> should probably be
> 
> includedir="%{_includedir}"

Thanks for the correction. Actually I had to fix the Makefile in my package, but for this BZ I tried to rewrite the fix by hand for SPEC syntax and I make the typo :)
Comment 12 Vít Ondruch 2013-04-09 08:59:39 EDT
Created attachment 733207 [details]
Adjust rubygems to #8115

(In reply to comment #8)
It seems to be caused by these two lines [1]. They match until second $.

The relevant lines from Makefile without the patch used to look like:

RUBYLIBDIR    = $(sitelibdir)$(target_prefix)
RUBYARCHDIR   = $(sitearchdir)$(target_prefix)

While with the patch, they look like:

RUBYLIBDIR    = $(DESTDIR)$(sitelibdir)$(target_prefix)
RUBYARCHDIR   = $(DESTDIR)$(sitearchdir)$(target_prefix)

I am not sure what was the intention in keeping $(target_prefix) in there, but since it is empty, I would suggest to drop it entirely and we should be fine.

Please note that upstream version of RubyGems does not already contain this lines, or they were moved on other place, so although we see test suite error, the upstream test suite probably works.


[1] https://github.com/ruby/ruby/blob/v2_0_0_0/lib/rubygems/ext/builder.rb#L20-L21
Comment 13 Vít Ondruch 2013-04-09 09:01:26 EDT
(In reply to comment #12)
Please consider this WIP, since it makes fail another test:

  7) Failure:
test_class_make(TestGemExtExtConfBuilder) [/builddir/build/BUILD/ruby-2.0.0-p0/test/rubygems/test_gem_ext_ext_conf_builder.rb:141]:
Expected /\nRUBYARCHDIR\ =\ \/tmp\/test_rubygems_29492\/ext\$\(target_prefix\)\n/ to match "# \xCF\x80\nRUBYARCHDIR = /tmp/test_rubygems_29492/ext\nRUBYLIBDIR = /tmp/test_rubygems_29492/ext\nall:\ninstall:\n".
Comment 14 Vít Ondruch 2013-04-10 11:18:45 EDT
Created attachment 733748 [details]
Adjust rubygems to #8115

So I made patch which is passing Ruby's test suite. Unfortunately, it does not seems to fix our issues :/
Comment 15 Vít Ondruch 2013-04-11 04:51:30 EDT
(In reply to comment #12)
> Please note that upstream version of RubyGems does not already contain this
> lines, or they were moved on other place, so although we see test suite
> error, the upstream test suite probably works.

This is the relevant commit:

https://github.com/rubygems/rubygems/commit/83e01ec2bd2131f751c60e73f50c07c5c7455010
Comment 16 Vít Ondruch 2013-06-25 15:58:45 EDT
Created attachment 765269 [details]
fix for the DESTDIR issue

This patch should fix the issue if anybody cares to test it.
Comment 17 Vít Ondruch 2013-06-26 10:43:42 EDT
Upstream patch: https://bugs.ruby-lang.org/projects/ruby-200/repository/revisions/41658
Comment 18 Fedora Update System 2013-07-01 10:02:53 EDT
ruby-2.0.0.247-9.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ruby-2.0.0.247-9.fc19
Comment 19 Fedora Update System 2013-07-01 20:30:39 EDT
Package ruby-2.0.0.247-9.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ruby-2.0.0.247-9.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-12118/ruby-2.0.0.247-9.fc19
then log in and leave karma (feedback).
Comment 20 Fedora Update System 2013-07-02 21:44:29 EDT
Package ruby-2.0.0.247-11.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ruby-2.0.0.247-11.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-12118/ruby-2.0.0.247-11.fc19
then log in and leave karma (feedback).
Comment 21 Fedora Update System 2013-07-09 07:06:21 EDT
ruby-2.0.0.247-12.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/ruby-2.0.0.247-12.fc19
Comment 22 Fedora Update System 2013-07-15 21:35:46 EDT
ruby-2.0.0.247-14.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.