I uploaded an initial phase runner, drpkg.inc, and an interface to dependency.inc to the bryght svn.
It is a short and self explanatory file.
drpkg_install_exec($packages,$uri) is the thing to be called by installer routines, where $packages is an array of package name and uri should point to a PACKAGES file.
The code assumes that for each package there is a file in modules|themes|theme_engines for each install phase, called package_name.phase, for example relations.install .
Please discuss this in this drupal forum thread
Opps, I have found an error, need to replace packages with modules in drpkg_load_package
Ther is an alternative method I'm investigating for doing the same job - it relies on a little code generator, so the heavy duty recursion in dependency.inc will happen only once - on code generation, and the rest will just work. But it is not going to be as flexible, faster but adding a new package to PACKAGES, will need a regeneration.