More package promise fixes

@tzz: Note in particular the first commit. It makes an actual change to masterfiles.

The rest is about fixing the tests so more of them pass.