Further package download logic fixes to ensure a package is not potentially entered into the resource cache several times, and that packages in the cache are scanned for only when necessary.
For Travis CI - switch CI build to use OS X build environment.