[oe] [meta-ruby][0/1] introduce a class to assist in building gems

Mark Asselstine mark.asselstine at windriver.com
Fri Sep 5 15:07:12 UTC 2014


For a while now we have had functionality in meta-cloud-services in
Yocto to assist in building Ruby gems in to the rootfs images. Many of
these gems and the ruby.bbclass that was written to facilitate the
building of gems are not specific to our work in meta-cloud-services
and should be made more widely available by moving them to
meta-ruby. So this is my first attempt to get things moved and in
doing so make the meta-ruby layer more comprehensive.

We have used this ruby.bbclass in meta-cloud-services to build about
25 gems and in doing so we have worked out a number of issues and have
been successful in adding new gem recipes easily. Although at this
time focus has been on x86 and x86-64 so we have not yet attempting
any cross ARCH cross compiling. Since there are many parallels between
Ruby and Python we expect that when we do start to cross-compile we
will run into similar issues and don't anticipate major obstacles.

For now I have included a recipe for single gem, bundler. Including
this gem in your image will demonstrate that the class is able to
perform as advertised and examining bundler on the target we can
confirm the validity of the build:

--
root at qemux86-64:~# cat Gemfile
source 'https://rubygems.org'
gem 'rspec', :require => 'spec'

root at qemux86-64:~# bundle install
Don't run Bundler as root. Bundler can ask for sudo if it is needed, and
installing your bundle as root will break this application for all non-root
users on this machine.
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using diff-lcs 1.2.5
Installing rspec-support 3.1.0
Installing rspec-core 3.1.0
Installing rspec-expectations 3.1.0
Installing rspec-mocks 3.1.0
Installing rspec 3.1.0
Using bundler 1.6.2
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.

root at qemux86-64:~# bundle show
Gems included by the bundle:
  * bundler (1.6.2)
  * diff-lcs (1.2.5)
  * rspec (3.1.0)
  * rspec-core (3.1.0)
  * rspec-expectations (3.1.0)
  * rspec-mocks (3.1.0)
  * rspec-support (3.1.0)
--

Once ruby.bbclass is accepted in to meta-ruby I will submit additional
reviews to copy more of our gem recipes from meta-cloud-services.

I look forward to hearing feedback and hope that I can get things to a
point where we can get this merged.

Regards,
Mark


More information about the Openembedded-devel mailing list