compose-tree: Fix location of rpmdb querying for caching

We were just repeatedly hitting the cache...oops.

Also add an assertion that the returned data isn't empty.