Measurnig maintainer scripts LOCs
After some discussions which touched them in various (Debian and non-Debian) mailing lists, I got interested in having a closer look to maintainer scripts. The first question I was asking myself is «how big they are?».
As an absolutely empirical, non-scientific test, I hacked a
couple of scripts to graph the distribution of
maintainer script lengths (measured as LOCs). I just run them
on /var/lib/dpkg/info/*.{post,pre}{inst,rm}
on my
laptop, which contains ATM 3612 scripts. Here is the result:
The obvious (though, I repeat, absolutely empirically obtained) point is that, as expected, most of the scripts are really short, with 1/3 of them being just 7 LOCs. And I guess you can guess (sorry) what the 7 lines are about:
#!/bin/sh
set -e
# Automatically added by dh_makeshlibs
if [ "$1" = "configure" ]; then
ldconfig
fi
# End automatically added section
dear old debhelper boilerplate.
The longest script, not shown properly in the graph due to my
low gnuplot karma, is 1905 LOCs (and the winner is:
/var/lib/dpkg/info/xserver-xorg.postinst
). The
shortest scripts are 5 LOCs, but they are structurally equivalent
to the 7 LOCs above, sometimes invoking some other idempotent
update-bla tool, and sporting less newlines.