I spent eight hours in the train today, one more than planned. I had 20 minutes for changing trains but mine was 22 minutes late. Tough luck.
I was going to rewrite the dependency handling stuff in the pkgtools but I had to clean up the convoluted mess that is pkg_do() in pkg_add. The function contained more than 500 lines of code. I did some refactoring: the automatic loading of dependencies is now done in separate functions. I think recursive autoloading via ftp is broken but we don't have binary packages on ftp anyway. However, recording of dependencies is now handled much more sanely. Before, the tools did two passes over the plist: one for checking the dependencies and one for recording them. Wildcards were newly expanded each time so you could not be sure you record the dependency on the same package you checked earlier.
For the user, there should be no functional change. pkg_add now creates a $LOCALBASE/db/pkg/pkgname/+DEPENDS file, which contains the correct forward dependencies for the package. This file is essentially unused at the moment but will be more important later.
These changes will eventually lead to abandoning the dependency checker in perl. I already got rid of all calls to pkg dependencies check in bsd.port.mk; these can be replaced by calling pkg_info -qe.