resurrect the deb_packages table

This is an attempt to pick up where #324 / #325 left off.

I basically resurrected everything as it stood from that PR with minor changes to get it compiling again. The only notable change is `:145` and `:146` - without closing the package DB between queries, `pkg_array_init_from_db` bombs out when it tries to load in each of the packages again thinking they're duplicates.

I wasn't sure if there was any technical reason that #325 was closed, or if it was just inactivity. If there was any further work to be done for it, I'd be happy to take a crack.