Gem permissions

Posted by Jonathan

Lately I've seen several people struggling with an error message like this:

`gem_original_require': no such file to load -- sqlite3/database

This is for the SQLite3 gem but I've seen it also with Capistrano.

The problem is that some files have incorrect permissions in the authors repository and those incorrect permission are replayed by the gem packaging.

The next version of SQLite and Capistrano will solve those problems, the short term fix is just:

$ sudo chmod -R a+r /usr/lib/ruby/gems/1.8/gems


Rubygems to be included in the official Ruby release

Posted by Jonathan

A long time there was no good and common way to distribute, install, and manage Ruby applications and libraries. After first steps with install.rb and setup.rb there were two candidates: Rubygems and the Ruby Production Archive.

The Ruby community could not decide which one should be the official packet management software to be included in the official Ruby sources. As Rubygems was becoming more and more the most popular management software, the next logical step was taken.

Rubygems is going to be included in the offical Ruby distribution. why the lucky stiff announced on the Rubygems-developers mailing-list that

...Matz has given the OK to start checking RubyGems into the Ruby trunk. I’m afraid it’s probably too late for 1.8.3 (which is due out today), but Matz has planned 1.8.4 for December. He loves dropping versions on Christmas, so I’ll bet he sticks to his plan. Whatever the case, I think we’re long overdue on this.

This is wonderful news as it helps making Ruby and Ruby-libs in the form of gems more easy to install for newbies. Hopefully there will be an end to the require/require_gem problem.

Further it seems like 1.8.3 will be announced shortly…

UPDATE:
So Ruby-1.8.3 is out but there seems to be a problem with rails.

Rubygems in the ports tree

Posted by Jonathan

It seems like my efforts to integrate Rubygems into the FreeBSD ports tree were not only for my own needs. Ports for the RGL and Stream rubygems were submitted by Ulrich Spoerlein and are now part of the ports tree.

RGL is a framework for graph datastructures and algorithms implemented in Ruby while Stream is an interface for external iterators.

I hope that this will be continue to be useful for FreeBSD users. My work on the OpenBSD integration is at a halt on the moment because I wait for the Ruby 1.8.2 integration. Due to the upcoming 3.8 release commits on the ports are bug-fixing only so this will be delayed until 3.8 will be released in November.

Rubygems now integrated in the FreeBSD ports tree

Posted by Jonathan

My patches have been commited. New rubygems can now be easily integrated into the FreeBSD ports tree.

The common Makefile in devel/ruby-gems handels the download and installation for the .gem file.

That means that the user is now able to manage gems through the ports tree and does not have to also use the gem command.
For example in order to install rails do:

# cd /usr/ports/www/rubygem-rails
# make install clean

And all the rubygems on which rails depends will be installed.

These rubygems-ports are available yet:

databases/rubygem-activerecord
mail/rubygem-actionmailer
devel/rubygem-rake
devel/rubygem-activesupport
www/rubygem-actionpack
www/rubygem-rails
www/rubygem-actionwebservice
www/rubygem-redcloth
www/typo

If you want to use the rubygem-* ports make sure to deinstall the manually installed gems before (not all of course, only those that would conflict with the ports version).

I also work on patches for OpenBSD and hope to get them integrated into OpenBSD 3.8.

Status of Rubygems in BSD ports trees 0

Posted by Jonathan

It’s been a while since I reported on my effort to integrate rubygems into the FreeBSD and OpenBSD ports tree.

My FreeBSD patches a waiting in the PR database for someone to commit them but I need to update them to 0.13.1.

Today I sent patches to ports@openbsd.org that integrate rubygems in the OpenBSD ports tree along with ports for Rake, Rails, Actionmailer, Actionpack, Actionwebservice, Activerecord, and Activesupport. Further I created a port for ruby-sqlite and sent a patch that updates Ruby to 1.8.2.

I hope that this time the patches will be reviewed and commited.

You can get my patches here:

gem-ports.tgz (ruby-gems and all the gem-* ports as several directories)
ruby_mega.patch (ruby-gems and all the gem-* ports as a big patch)
ruby-sqlite.tgz
ruby182.patch

First version of RubyGems in the FreeBSD ports tree

Posted by Jonathan

After a weekend working on the infrastructure for RubyGems in the FreeBSD ports tree, I finally have a version that is worth releasing.

It works by wrapping the gem install calls in make install/pkg_add. I created the following ports:

  • devel/gem-rake
  • devel/gem-activesupport
  • databases/gem-activerecord
  • www/gem-actionpack
  • www/gem-actionwebservice
  • www/gem-rails
  • www/gem-redcloth
  • www/typo

The various gem ports include my Makefile.common (placed in devel/ruby-gems). This Makefile sets common install instructions and variables.
A new gem-port has now not much to tell in it’s Makefile.

From www/gem-actionpack/Makefile:

PORTNAME= actionpack
PORTVERSION= 1.8.1
CATEGORIES= www gem

MAINTAINER= jw@innerewut.net
COMMENT= Action Controller and Action View of Rails MVC Framework

MASTER_SITES= http://rubyforge.org/frs/download.php/4149/

BUILD_DEPENDS= ${LOCALBASE}/${SPEC_DIR}/activesupport-1.0.4.gemspec:${PORTSDIR}/devel/gem-activesupport
RUN_DEPENDS= ${BUILD_DEPENDS}

.include <bsd.port.pre.mk>
.include ”${PORTSDIR}/devel/ruby-gems/Makefile.common”
.include <bsd.port.post.mk>

You further have to create a pkg-plist file that lists all files installed by this gem-port. At first I thought about getting these from the gem specification as it lists all installed files. But the gemspec does not include the rdoc files and creating the pkg-plist file with pkg_trackinst/pkg_genplist is very easy.

For now the gem-rails and typo port have no webserver or database listed as a dependency. They come with WEBrick and installing MySQL or SQLite is not complicated. I plan to include them in the future.

You can get my work here. Read the README for instructions.

Please test this and comment!

Progress on my BSD ports

Posted by Jonathan

The last days I’ve been working on some ports for OpenBSD and FreeBSD.

I created an OpenBSD port for dnsmasq-2.22. dnsmasq is a caching DNS-forwarder and DHCP server designed for small networks. It is very easy to setup and configure. I use it for my home network as caching DNS server on FreeBSD and I wanted to be able to use it on OpenBSD too.

I already sent it to ports@openbsd.org and got some feedback. But actual testing feedback is welcome. You can get the port here. Just unpack it into /usr/ports/net, give it a try and let me know if you have any problems.

Then I spent some time working on the rails/ruby-gems stuff on FreeBSD. Again I wrote an email to ports@freebsd.org, asking if somebody will join my effort. But again no reaction. I guess I have to do it by myself. I also tried to join the rubygems-developers mailing list, but I got no response from the webinterface after registering. Maybe I have till Monday or Tuesday until an actual human will review the administration email.

Further I looked how PHP Pear compatibility is realized in the FreeBSD ports and thought about how do copy it for ruby-gems. I tried to figure out, how exactly a gem is installed. It seems like that the gem is a tar-archive with two GNUzip-files in it, data.gz and metadata.gz. data.gz (a tar archive) hold the actual files and libraries while metadata.gz is a compressed file, metadata, that hold the, suprise, metadata information like dependencies, author, and file list.

As far as I know, if a gem GEMNAME is installed, the content of data.gz is copied to

/usr/local/lib/ruby/gems/1.8/gems/GEMNAME

and a gem specification file (GEMNAME.gemspec) is installed in

/usr/local/lib/ruby/gems/1.8/specifications/

My problem is that the .gemspec file in /specifications/ is different from metadata (but the content seems nearly the same) and I have to know how the former is created from the latter.

If this hurdle is taken, I hope that gem support on FreeBSD is not far away. I then have to expand the ruby-gems port with a Makefile that holds all common information like the path to the gem directory and how to copy the files. Then each new gem-port would only have to name its URL and dependencies. Then common Makefile would download and extract the gem, get the names of the included files from the metadata file and copy the files to the above described directories.

I fear that it will be complicated than this. But it is a start.

Apart from this effort I finally filled out problem reports for my updates to ruby-mysql, ruby-sqlite, and ruby-fcgi as knu@freebsd.org (their maintainer and maintainer of Ruby on FreeBSD) did not react since 3 weeks. ruby-sqlite was committed this morning and I hope that the other updates will be committed soon.

I did not filled problem reports for my various rails ports as these are not gems but “normal” ruby libraries. They install into

/usr/local/lib/ruby/site_ruby/1.8/

and so they are not recognized by ruby-gems as needed for rails. But they could be of value for a non-rails developer who wants to use this libraries without ruby-gems so I’m not sure if they should be dumped in favour of the ruby-gems ports that are to come.

Ruby on Rails and the FreeBSD ports

Posted by Jonathan

Yesterday I tried to combine Ruby on Rails with the FreeBSD ports tree. RoR relies heavily on ruby-gems but I prefer installing programs with the ports tree.

The ideal solution would be an integration of the two like done for PHP-pear and Perl CPAN in the ports tree but this is heavy lifting.
I started with creating non-gems ports of the several packages within rails.

I created:

devel/ruby-actionsupport
www/ruby-actionpack
www/ruby-actionwebservice
databases/ruby-activerecord
mail/ruby-actionmailer

When I went on to www/rails I found out that the rails.tgz from the rubyforge website includes all packages in the vendor directory :-(

That means that I should have created only the www/rails port or (cleaner) I should extract the packages from the vendor directory and let the rails port depend on my ports. The latter would benefit if somebody wants to use the various packages alone.

I’m not sure what to do as my goal is to combine gems and the ports tree.

Apart from this work I created some update-diffs for ruby ports that are needed by rails. I sent them to their maintainer who seems to be someone really involved in the ruby-stuff on FreeBSD. Maybe I should talk to him about the ruby-gems stuff…

Anyway, you can find my work here:

rails-ports.tar.gz
ruby-fcgi.patch
ruby-mysql.patch
ruby-sqlite.patch