Bug 822796 - FindRuby: Setting RUBY_VENDORARCH_DIR fails.
FindRuby: Setting RUBY_VENDORARCH_DIR fails.
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: cmake (Show other bugs)
16
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Orion Poplawski
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-18 03:58 EDT by Ales Kozumplik
Modified: 2014-09-30 19:40 EDT (History)
9 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-01 13:04:44 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ales Kozumplik 2012-05-18 03:58:21 EDT
This is for cmake-2.8.5-3.fc16.x86_64 but there's the same problem with the rawhide version.

Steps to Reproduce:
1. Use "FIND_PACKAGE (Ruby)" to have FindRuby set ruby directories for you.

Actual results:
RUBY_VENDORARCH_DIR does not get set


Expected results:
RUBY_VENDORARCH_DIR gets set and points to rbconfig's Config::CONFIG['vendorarchdir']

Additional info:
FindRuby does the following to determine the dir:

   EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r vendor-specific -e "print 'true'"
      OUTPUT_VARIABLE RUBY_HAS_VENDOR_RUBY  ERROR_QUIET)

   IF(RUBY_HAS_VENDOR_RUBY)
      EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorlibdir']"
         OUTPUT_VARIABLE RUBY_VENDORLIB_DIR)

      EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['vendorarchdir']"
         OUTPUT_VARIABLE RUBY_VENDORARCH_DIR)
   ENDIF(RUBY_HAS_VENDOR_RUBY)

But RUBY_HAS_VENDOR_RUBY always ends up false because vendor-specific is not an existing module in Fedora.

I am not sure if this is something to be fixed in ruby (i.e. adding the 'vendor-specific' module) or in CMake (i.e. using some other way to determine we are on a distro with vendor-specific dirs).

CCing bkabrda, a Ruby guy who knows about the situation.
Comment 1 Bohuslav "Slavek" Kabrda 2012-05-18 04:12:54 EDT
I guess that there are two possible options:

1) Find out if vendor dirs exist in some other way - maybe just looking if they are defined:
ruby -e "if Config::CONFIG.has_key?('vendorarchdir') then exit 0 else exit 1 end"

or

2) We could add the vendor-specific.rb file to Ruby (would have to communicate with Ruby SIG on this one). Are there any specific needs for this file or is it sufficient if it only exists?

CCing vondruch, who is Ruby maintainer in Fedora and will for sure bring in some more options/opinions on this.
Comment 2 Vít Ondruch 2012-05-18 05:17:00 EDT
Config was deprecated in favour of RbConfig:

$ ruby -r rbconfig -e "print Config::CONFIG['vendorlibdir']"
-e:1: Use RbConfig instead of obsolete and deprecated Config.

$ ruby -r rbconfig -e "print RbConfig::CONFIG['vendorlibdir']"
/usr/share/ruby/vendor_ruby

CMake should be updated if there is used "Config". Note that RbConfig works also for Ruby 1.8.7, so it should not be an issue.
Comment 3 Vít Ondruch 2012-05-18 05:32:40 EDT
Actually, I am not sure where the vendor-specific should come from. Isn't it part of CMake? There is also difference between Ruby 1.8 and 1.9. Ruby 1.8 will require the file which is in current directory, while Ruby 1.9 will not.

However I am not sure what is the issue, since you are referencing F16 and Rawhide, which have different Ruby versions.
Comment 4 Orion Poplawski 2012-05-21 12:32:19 EDT
[root@orca ~]# ruby -r vendor-specific -e "print 'true'"
ruby: no such file to load -- vendor-specific (LoadError)
[root@orca ~]# ruby -r rbconfig -e "print Config::CONFIG['vendorarchdir']"
/usr/lib/ruby/1.8/i386-linux
[root@orca ~]# ruby -r rbconfig -e "print RbConfig::CONFIG['vendorarchdir']"
/usr/lib/ruby/1.8/i386-linux

This has been reported upstream here: http://public.kitware.com/Bug/view.php?id=12965 but apparently there is no maintainer for FindRuby.  Apparently vendor-specific in an OpenSUSE thing.
Comment 5 Orion Poplawski 2012-05-21 12:40:19 EDT
Ales - Can you test cmake-2.8.8-4.fc18?  If that works for you I'll push updates to F16/17.
Comment 6 Vít Ondruch 2012-05-22 03:16:53 EDT
(In reply to comment #4)
> Apparently vendor-specific in an OpenSUSE thing.

Yes, it seems to be SUSE, taken from MacPorts ... but note that even on OpenSUSE, this "extension" is available just for Ruby 1.8
Comment 7 Ales Kozumplik 2012-05-22 03:59:18 EDT
(In reply to comment #5)
> Ales - Can you test cmake-2.8.8-4.fc18?  If that works for you I'll push
> updates to F16/17.

Thank you, works and FWIW the patch looks reasonable to me.
Comment 8 Ales Kozumplik 2012-05-22 04:01:44 EDT
(In reply to comment #3)
> Actually, I am not sure where the vendor-specific should come from. Isn't it
> part of CMake? There is also difference between Ruby 1.8 and 1.9. Ruby 1.8
> will require the file which is in current directory, while Ruby 1.9 will not.
> 
> However I am not sure what is the issue, since you are referencing F16 and
> Rawhide, which have different Ruby versions.

Yes, and it fails with both.

It indeed seems plausible that 'vendor-specific' is an (empty?) module in opensuse's ruby distribution, grepping for it with 'yum provides' didn't show anything on Fedora.
Comment 9 Fedora Update System 2012-05-22 12:16:48 EDT
cmake-2.8.8-4.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/cmake-2.8.8-4.fc16
Comment 10 Fedora Update System 2012-05-22 12:17:23 EDT
cmake-2.8.8-4.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/cmake-2.8.8-4.fc17
Comment 11 Fedora Update System 2012-05-24 11:34:39 EDT
Package cmake-2.8.8-4.fc17:
* should fix your issue,
* was pushed to the Fedora 17 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cmake-2.8.8-4.fc17'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-8301/cmake-2.8.8-4.fc17
then log in and leave karma (feedback).
Comment 12 Fedora Update System 2012-06-01 13:04:44 EDT
cmake-2.8.8-4.fc17 has been pushed to the Fedora 17 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 Fedora Update System 2012-06-09 21:33:21 EDT
cmake-2.8.8-4.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.