Monday, July 21, 2008

Debian Packaging - A new experience

Well, I've decided to package up the redmine program for inclusion into Debian Linux. It's not the most simple software in the world but it shouldn't be too bad to package. One of the things that is throwing me right now is that it is based on Ruby On Rails and all of the documentation I'm reading only discusses compiling applications, not packaging scripted language software.

One of my first tasks is to find and document all of the licenses for all of the files in the redmine source code. This is not as easy as it sounds as while most of redmine is licensed under the GPL some of the files have other licenses or none at all. At first I attempted to do a simple grep to check for the appropriate license, but that hammer was just too crude for the task. After asking around a little bit I found a program called licensecheck (in the devscripts package) that processes files and tries to find out what license that file was developed under. Just what I need!

One twist in my copyright journy is that I'm trying to create my debian/copyright file in accordance with the new format instead of the old, standard format. Hey, if I'm gonna package this thing up I might as well use all the latest & greatest tools, right? Anyway, the new format is pretty strict about how things are supposed to be laid out, filenames, labels, etc. and the output of licensecheck is not very pretty. After a bit of trial and error I came up with the following command. It's not perfect (yet) but it gets me closer to the proper format, and since I'm lazy that means less hand editing for me. Yea!

licensecheck -copyright -r * | grep -v "*No copyright*" | sed '/^$/d' | sed '2~1 {N;s/\n/ /g}' | sort

I'm still working on the details and I have to adjust a couple of things, but if I can get it working properly it will mean a lot less work on my part and hopefully someone else will be able to use it as well. Who knows, if I can get it working really well maybe I'll try to get it added to licensecheck as an additional output format. Cool!