Misc touchup
Created by: eli-schwartz
From @lukeshu
The interesting bits are proper glob handling, and better handling of error cases e.g. in repo-add. I've added a commit to unify the repo-add/repo-remove caller in order to facilitate using the same path escape/quoting style for the db as well as for packages.