init: generate build-depends with >=x.x && <x.y syntax instead of ==x.*

fixes #1329.
Add a function for reading the contents of a single package DB.

'getInstalledPackages' requires to pass in a 'PackageDBStack'.
Add a function for listing packages installed in a sandbox.