Justin Hahn wrote:
> I'm trying to setup an automated build system for all of our upstream
> binary dependencies (that we don't get from our OS). Since we track a
> newer ruby than most of our machines ship with, this means building ruby
> and installing gems. For the most part this works fine, except when I
> need to install a gem like mongrel that has several versions.


I do this the hard way probably, but I convert gems into RPMs and then
push the RPMs to the systems. It takes quite a while but I can be sure
of:

(assuming your using Linux and an RPM-based distribution)
- no external dependencies(e.g. servers calling to the internet to
  download something)
- one package manager to query for all files on the system
- more compatible with our automated management system(www.cfengine.org)
- installs exactly the versions we use, never have to worry about the
  wrong version getting installed by accident.
- don't need development stuff installed to install the gems
  (though we still have development stuff installed, at some point
   I expect we'll remove non essentials from most systems)

Currently I maintain 29 gems using this method. If your interested I
can send you a short little HOWTO doc I wrote so when I go through
this painful process I remember all of the commands I need.

Basically what I do is:
- build a list of files in /usr
- install the gem(one gem at a time!), for me I resolve dependencies
manually, and download the gems direct from
http://rubyforge.vm.bytemark.co.uk/gems/
- build a list of files again in /usr
- run a diff between the two lists to find new files(this is a fairly
  complicated command, the one I often forget:
  for i in `diff -u /tmp/usr-before-gd.log /tmp/usr-after-gd.log | grep ^+ |
grep /usr/ | sed s'/+//'g`; do [ -d $i ] || echo $i ;done >/tmp/new.txt

- tar those new files up into a tarball
- copy tarball to debian/ubuntu system (or some system that has alien
installed)
- run alien in prepare mode, edit the SPEC file, change values as needed(I
add descriptions and stuff so we can query what the rpm is)
- run rpmbuild to build the binary

it takes about 10 minutes per gem, if your updating gems often this is
painful, but we don't update too often, I've gone through this process about
4 times in the past year. Been deploying gems this way for over a year now
and haven't had any problems(as in the files I built missing stuff or bad
versions etc). If there's a better/faster way to build RPMs that'd be great,
I'd love to build source rpms from gems, though the only way I know how to
build rpms myself is with alien which is cheating, but it works.. I think
building source rpms would take a lot more time.

The resulting RPMs are pushed out to about 60 systems.

nate