Some weeks ago, Ian Jackson sent a mail to {debian,ubuntu}-devel to speak about a very interesting feature of dpkg he was working on: triggers.

Quoting from the specification :

A dpkg trigger is a facility that allows events caused by one package but of interest to another package to be recorded and aggregated, and processed later by the interested package. This feature simplifies various registration and system-update tasks and reduces duplication of processing.

This seemed to be a very good idea to me, therefore I was looking forward to seeing this implemented in gutsy. This has been implemented in apt/aptitude for a few days now, and the result is very amazing! Here is a quick example:

  • previously, if you had to update usplash, xubuntu-artwork-usplash, linux-image-2.6.XX-Y-generic and initramfs-tools packages, apt would have called sudo update-initramfs -u -k $(uname -r) 4 times (once for each postinst script). This was not very optimal…
  • now, with the same packages, update-initramfs will only run once. For each postinst script which calls update-initramfs, dpkg arms a trigger. Then, at the end of the execution, dpkg will call update-initramfs if the trigger is armed, which saves 3 calls.

Of course, this is not really useful if you update a single package. :) So far, the only use of this feature is with update-initramfs, as far as I know. However, I think this should be really improved and extended, especially for some time/cpu-consuming upgrades: to avoid multiple font cache updates when installing several fonts packages, or to avoid updating TeX cache fifty times when installing the texlive-full metapackage!