dpkg-tools: less-painful OS package building

dpkg-tools is a set of tools which aim to dramatically simplify the process of creating and building OS packages. We’re targetting .debs, and creating one can be as simple as creating and maintaining a YAML configuration file. For Rubygems, the process is even easier - a single command makes a gem ready to be built into a .deb

Warning: Alpha software

Hey, this is alpha stuff. There’s plenty cruft and rough edges, the RDoc’s pretty bad and there’s a general lack of good documentation and examples. I’m working on it. You’re more than welcome to join in.

How to get it

gem install dpkg-tools

Or, the gem can be downloaded from rubyforge.org/projects/dpkg-tools/.

The source is available from Github: github.com/fidothe/dpkg-tools/, and bugs, requests and other queries can be filed at dpkg-tools.lighthouseapp.com/. You can clone the public Git repo with:

git clone git://github.com/fidothe/dpkg-tools.git

How to use it

dpkg-tools comes with three utilities, to create packages from three different kinds of things. dpkg-gem makes it easy to generate .debs from local and remote rubygems. dpkg-etc makes it easy to create packages of configuration files. Finally, dpkg-rails makes it easy to package up Rails apps.

dpkg-gem

dpkg-gem {gem_name}

This will grab the gem gem_name from Rubyforge, along with all its dependencies, and create package directories for all of them. All you need to do then is run dpkg-buildpackage from inside the directory and you’re away.

dpkg-gem --from-gem /path/to/rubygem.gem

Will do the same for a local .gem file.

dpkg-etc

dpkg-etc /path/to/package/dir

Will take a directory and drop in the scaffolding needed to make it a configuration package. Configuration files go in /path/to/package/dir/etc, and dpkg-tools makes dpkg-buildpackage know what to do…

dpkg-rails

dpkg-rails /path/to/rails/app

Will add the necessary configuration files and rake tasks to a Rails app so that a base deployment package can be generated with dpkg-buildpackage. Installing that package prepares a machine with a Mongrel cluster setup plus Apache 2’s mod_proxy_balancer, allowing adding developer SSH keys for simple Capistrano deployment (tasks for that are generated too).