September 17th 2007

Graphing the Debhelper Design Pattern


In case anyone has missed it, Debian Live is a neat framework for creating live Debian distributions on CD, DVD, USB or netboot media.

Debian Live's primary utility, live-helper, is implemented using what Daniel calls the "Debhelper" design pattern: that is, a number of small shell scripts (or helpers) that are run just below a configuration directory. Each helper should ideally perform a single task, and running a helper is always 'safe', meaning that any logic for determining whether the helper's actions should take place is in the helper itself, rather than in the caller.

This arrangement results in a somewhat modular design (for shell scripts, anyway) and allows for simple debugging - simply run the helpers manually, or 'set -x' the helper you are interested in and re-run the lot.

live-helper currently has a total 69 helpers, and included in this are a number of 'meta-helpers' such as lh_build, lh_chroot, etc. whose job it is to simply call other helpers in the correct order. In an attempt to tame this large number, I made this SVG (45KB). Each edge corresponds to a call in the direction of the edge. Source is available on the master tree.

You can subscribe to new posts via email or RSS.