It would be very helpful if 'rpm -qa' (and all queries) would return the packages in a topological order. That is the list of package would come back in an order which is valid for installing. The order would respect the dependencies implicit in the packages.
Is this practical to do inside of RPM or creating a helper program that uses rpmlib or similar tools?
This is doable ina any number of ways, but, since it's a FAQ, needs to be done on the CLI too.
Implemented in rpm-4.4, packages available at ftp://ftp.jbj.org/pub/rpm-4.4