I sometimes end up with a pile of packages built from ports, or extracted from an existing machine, which I want to bulk install. Currently, pkg(8) has an "add" command that excepts a single package. It would be really useful to have one (or both) of:
pkg add-bulk [file1 file2 ...]
Install a set of packages, first sorting them by dependencies so that things are installed in a suitable order.
pkg sort [file1 file2 ...]
Sort packages by dependencies, returning the filename list in an order suitable to pass via a script iteratively running "pkg add".
Ideally if there were missing dependencies, the command would fail and tell you the list of missing packages, so that you could go find them if needed.