Place downloading of package files into its own function.

This will make it easier to make it more robust by trying various urls
if one compression format is not supported (anymore).
Added support for various compression formats for Packages download.

Now xz (apparently the new default), bzip2 and gz are supported.