Debra: Make Debian packages with Ruby


Because I found the process of making Debian packages a little long winded. It does seem to work well for my use case: building binary packages of web applications on a CI server.

Also, I'm still learning the Debian packaging system so wouldn't recommend this for serious use, just your own packages.



$: sudo gem install debra

Create a Debfile in your projects directory

# Debfile
Debra do

    # Specify the files to be included (just a Rake::FileList delegate)
    files "etc/**/*"

    # Specify your control file fields
    # See
    control do 
        package       "my-package"
        version       "0.1"
        section       "base"
        priority      "optional"
        architecture  "all"
        depends       "apache2, apache2-dev"
        maintainer    "My Name <>"
        description   %q{My Pacakge Title
            Extended description goes here ...

    # Specify preinst, postinst, prerm, postrm files like this
    postinst %q{#!/bin/bash         

service apache restart



Build your file

$: sudo debra

Command line options

Usage: debra [options]
    -h, --help                       Show this message
    -v, --verbose                    Run verbosely
    -f, --file file                  Load a specific Debfile
        --version                    Show version


See the examples directory



Copyright (C) 2009 Matt Haynes

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <w