Move the AppStream cache functionality to it's own file

Additionally support .xml and .xml.gz AppStream files. This gets us some degree
of Ubuntu compatibility.