I think I have solved a majority of the problems with ordering, my biggest fear is that the limited interface to dpkg is going to make a mess of everything (imagine, tell it to do something, it fails, you have no idea what failed..) :< There are likely problems with conflict+replace packages too..
Here is the blurb on the ordering code, This is a modified version of Manoj's Routine B. It consists of two independant stages, installation+removal ordering and configuration ordering. Installation ordering considers each package and its predepends+conflicts only. It orders the packages so that when a package is unpacked there are no unmet predepends or conflicts. Removal ordering considers each package and its reverse dependancies and reverse predepends. It shceduals and unpack of its reverses before it is removed to advoid broken configured dependancies. Removal and installation happen in the same pass so packages can be unpacked to clear removal depends requirements. Configuration ordering considers each package that has been unpacked and decides if it is possible to configure it. Because ordered removals are involved it is possible a package was unpacked to satisify a remove but does not have complete dependancies yet. These packages are ignored in the configure ordering phase. Once a list of valid, configurable packages has been gathered it then sorts by dependancy only to produce an ordered configure list. By calling the configuration routine whenever an unmet predepends is encountered breaks in the installation are created. The configuration routine installs all the packages it can, though only the packages required to deal with predepends are truely needed. Jason

